/* ============================================
   BauTask Ziegelzähler
   Design: Dark theme matching BauTask branding
   Colors: Dark charcoal + BauTask green
   ============================================ */

:root {
    /* BauTask brand colors */
    --green: #1DB954;
    --green-hover: #1AA34A;
    --green-light: rgba(29, 185, 84, 0.15);
    --green-glow: rgba(29, 185, 84, 0.3);

    /* Dark palette */
    --bg-darkest: #141C22;
    --bg-dark: #1A252E;
    --bg-card: #1E2D38;
    --bg-card-hover: #243642;
    --bg-elevated: #253545;
    --bg-input: #1A252E;

    /* Text */
    --text-white: #FFFFFF;
    --text-primary: #E8ECF0;
    --text-secondary: #8B9DAF;
    --text-muted: #5A7084;

    /* Borders */
    --border: #2A3E4E;
    --border-light: #344D60;

    /* Semantic */
    --success: #1DB954;
    --warning: #F5A623;
    --error: #E74C3C;

    /* Shadows */
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-green: 0 4px 16px rgba(29, 185, 84, 0.25);

    /* Radii */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;

    /* Fonts */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-darkest);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============ HEADER ============ */
.header {
    background: var(--bg-dark);
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-img {
    height: 40px;
    width: auto;
    display: block;
}

.header-nav-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--green);
    background: var(--green-light);
    padding: 5px 14px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============ HERO ============ */
.hero {
    background: var(--bg-dark);
    padding: 56px 0 52px;
    border-bottom: 1px solid var(--border);
}

.hero-inner {
    display: flex;
    align-items: flex-start;
}

.hero-content {
    max-width: 640px;
}

.hero h1 {
    color: var(--text-white);
    font-size: 38px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}

.text-underline {
    text-decoration: underline;
    text-decoration-color: var(--green);
    text-underline-offset: 4px;
    text-decoration-thickness: 3px;
}

.hero-features {
    list-style: none;
    margin-bottom: 32px;
}

.hero-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
}

.check-icon {
    width: 22px;
    height: 22px;
    color: var(--green);
    flex-shrink: 0;
    background: var(--green-light);
    border-radius: 50%;
    padding: 3px;
}

.hero-cta {
    text-decoration: none;
}

/* ============ STEP INDICATOR ============ */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 32px 0 16px;
}

.step-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-elevated);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.step-dot.active .step-num {
    background: var(--green);
    color: var(--text-white);
    border-color: var(--green);
    box-shadow: var(--shadow-green);
}

.step-dot.completed .step-num {
    background: var(--green);
    color: var(--text-white);
    border-color: var(--green);
    opacity: 0.7;
}

.step-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.step-dot.active .step-label {
    color: var(--green);
}

.step-dot.completed .step-label {
    color: var(--text-secondary);
}

.step-line {
    width: 60px;
    height: 2px;
    background: var(--border);
    margin: 0 8px;
    margin-bottom: 22px;
    transition: background 0.3s ease;
}

.step-line.active {
    background: var(--green);
}

/* ============ CARDS ============ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin: 16px 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.card-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--green);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-white);
}

.card-body {
    padding: 28px;
}

.card-description {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.step-card {
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.step-card.hidden {
    display: none;
}

/* ============ DROPZONE ============ */
.dropzone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-dark);
}

.dropzone:hover,
.dropzone.drag-over {
    border-color: var(--green);
    background: rgba(29, 185, 84, 0.05);
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    color: var(--green);
}

.dropzone-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 4px;
}

.dropzone-hint {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.dropzone-formats {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============ FILE PREVIEWS ============ */
.file-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.file-preview {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border);
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview-video {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    padding: 8px;
    height: 100%;
}

.file-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
}

.file-preview-remove:hover {
    background: var(--error);
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-white);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-accent {
    background: var(--green);
    color: #fff;
}

.btn-accent:hover:not(:disabled) {
    background: var(--green-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-green);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-elevated);
    color: var(--text-white);
    border-color: var(--border-light);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
    margin-top: 24px;
    border-radius: var(--radius);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-arrow {
    width: 18px;
    height: 18px;
}

.btn-icon {
    width: 18px;
    height: 18px;
}

/* ============ PROGRESS ============ */
.progress-section {
    text-align: center;
    padding: 20px 0;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--green), #2EE86A);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 14px;
}

.progress-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ RESULTS TABLE ============ */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.results-table th {
    text-align: left;
    padding: 10px 14px;
    background: var(--bg-dark);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 2px solid var(--border);
}

.results-table td {
    padding: 10px 14px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.results-table td:nth-child(2) {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--green);
}

.results-table tr:hover td {
    background: var(--bg-elevated);
}

.confidence-high { color: var(--green) !important; font-weight: 600; }
.confidence-medium { color: var(--warning) !important; font-weight: 600; }
.confidence-low { color: var(--error) !important; font-weight: 600; }

/* ============ TOTAL SECTION ============ */
.total-section {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 20px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.total-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.total-value {
    font-family: var(--font-mono);
    font-size: 32px;
    font-weight: 700;
    color: var(--green);
}

.total-unit {
    font-size: 16px;
    color: var(--text-secondary);
}

/* ============ OVERRIDE SECTION ============ */
.override-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.override-section label {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ============ INPUTS ============ */
.input-field {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 15px;
    color: var(--text-white);
    background: var(--bg-input);
    transition: all 0.2s ease;
    width: 100%;
}

.input-field:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-light);
}

.input-field::placeholder {
    color: var(--text-muted);
}

.input-sm {
    width: 140px;
    padding: 6px 10px;
    font-size: 14px;
}

/* ============ DIMENSION INPUTS ============ */
.dimension-inputs {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin: 24px 0;
}

.dimension-x {
    font-size: 24px;
    font-weight: 300;
    color: var(--text-muted);
    padding-bottom: 8px;
}

.input-group {
    flex: 1;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ============ PRESETS ============ */
.presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    padding: 10px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font);
    text-align: left;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}

.preset-btn:hover {
    border-color: var(--green);
    background: var(--green-light);
}

.preset-btn.active {
    border-color: var(--green);
    background: var(--green-light);
    color: var(--green);
}

.preset-btn span {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 2px;
}

.preset-btn.active span {
    color: var(--green);
    opacity: 0.8;
}

.hint-text {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

/* ============ RESULT DISPLAY ============ */
.result-display {
    text-align: center;
    padding: 44px 20px;
    background: linear-gradient(135deg, #122A1B 0%, #0F3D23 50%, #1A4A2E 100%);
    border-radius: var(--radius);
    margin-bottom: 24px;
    border: 1px solid rgba(29, 185, 84, 0.25);
    position: relative;
    overflow: hidden;
}

.result-display::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(29, 185, 84, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.result-number {
    font-family: var(--font-mono);
    font-size: 56px;
    font-weight: 700;
    color: var(--green);
    line-height: 1.1;
    position: relative;
}

.result-label {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 8px;
    position: relative;
}

.result-breakdown {
    padding: 20px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.result-breakdown p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.result-breakdown .formula {
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--text-white);
    font-weight: 500;
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ============ ERROR / WARNING ============ */
.error-message {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    color: var(--error);
    font-size: 14px;
    margin-top: 16px;
    display: none;
}

/* ============ FOOTER ============ */
.footer {
    margin-top: auto;
    background: var(--bg-dark);
    padding: 24px 0;
    border-top: 1px solid var(--border);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.footer-logo {
    height: 28px;
    width: auto;
    opacity: 0.4;
}

.footer-text {
    color: var(--text-muted);
    font-size: 13px;
}

/* ============ RESPONSIVE - TABLET (max 768px) ============ */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .hero {
        padding: 40px 0 36px;
    }

    .hero h1 {
        font-size: 30px;
    }

    .hero-features li {
        font-size: 15px;
        gap: 10px;
    }

    .step-line {
        width: 40px;
    }

    .card-body {
        padding: 24px;
    }

    .card-header {
        padding: 16px 24px;
    }

    .presets {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .result-number {
        font-size: 48px;
    }

    .results-table th:nth-child(4),
    .results-table td:nth-child(4) {
        display: none;
    }
}

/* ============ RESPONSIVE - MOBILE (max 480px) ============ */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    /* Header mobile */
    .header {
        padding: 10px 0;
    }

    .header-inner {
        gap: 8px;
    }

    .logo-img {
        height: 28px;
    }

    .header-nav-label {
        font-size: 11px;
        padding: 3px 10px;
    }

    /* Hero mobile */
    .hero {
        padding: 28px 0 24px;
    }

    .hero h1 {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .hero-features {
        margin-bottom: 24px;
    }

    .hero-features li {
        font-size: 14px;
        margin-bottom: 10px;
        gap: 8px;
    }

    .check-icon {
        width: 20px;
        height: 20px;
    }

    .btn-lg {
        padding: 12px 22px;
        font-size: 14px;
        width: 100%;
        justify-content: center;
    }

    .hero-cta {
        display: flex;
    }

    /* Step indicator mobile */
    .step-indicator {
        padding: 24px 0 12px;
    }

    .step-num {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .step-line {
        width: 24px;
        margin: 0 4px;
        margin-bottom: 20px;
    }

    .step-label {
        font-size: 10px;
    }

    /* Cards mobile */
    .card {
        margin: 12px 0;
        border-radius: var(--radius);
    }

    .card-header {
        padding: 14px 16px;
        gap: 10px;
    }

    .card-badge {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .card-header h2 {
        font-size: 16px;
    }

    .card-body {
        padding: 16px;
    }

    /* Dropzone mobile */
    .dropzone {
        padding: 32px 16px;
    }

    .dropzone-icon {
        width: 40px;
        height: 40px;
    }

    .dropzone-text {
        font-size: 14px;
    }

    .dropzone-hint {
        font-size: 13px;
    }

    .dropzone-formats {
        font-size: 11px;
    }

    /* File previews mobile */
    .file-previews {
        gap: 8px;
    }

    .file-preview {
        width: 80px;
        height: 80px;
    }

    /* Presets mobile */
    .presets {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .preset-btn {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 10px 14px;
    }

    .preset-btn span {
        margin-top: 0;
    }

    /* Dimension inputs mobile */
    .dimension-inputs {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin: 20px 0;
    }

    .dimension-x {
        text-align: center;
        padding: 0;
        font-size: 20px;
    }

    .input-field {
        font-size: 16px; /* prevents iOS zoom on focus */
        padding: 12px 14px;
    }

    /* Results table mobile */
    .results-table {
        font-size: 13px;
    }

    .results-table th {
        padding: 8px 10px;
        font-size: 10px;
    }

    .results-table td {
        padding: 8px 10px;
        font-size: 13px;
    }

    .results-table th:nth-child(3),
    .results-table td:nth-child(3),
    .results-table th:nth-child(4),
    .results-table td:nth-child(4) {
        display: none;
    }

    /* Total section mobile */
    .total-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 4px;
        padding: 16px;
    }

    .total-value {
        font-size: 28px;
    }

    /* Override section mobile */
    .override-section {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .override-section label {
        white-space: normal;
    }

    .input-sm {
        width: 100%;
        font-size: 16px;
        padding: 10px 12px;
    }

    .override-section .btn-sm {
        width: 100%;
        justify-content: center;
        padding: 10px 14px;
    }

    /* Result display mobile */
    .result-display {
        padding: 32px 16px;
    }

    .result-number {
        font-size: 40px;
    }

    .result-label {
        font-size: 14px;
    }

    .result-breakdown {
        padding: 14px;
    }

    .result-breakdown .formula {
        font-size: 13px;
        word-break: break-word;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Footer mobile */
    .footer-inner {
        flex-direction: column;
        gap: 8px;
    }

    .footer-logo {
        height: 22px;
    }

    .footer-text {
        font-size: 12px;
    }

    /* Error mobile */
    .error-message {
        font-size: 13px;
        padding: 12px 14px;
    }
}

/* ============ VERY SMALL SCREENS (max 360px) ============ */
@media (max-width: 360px) {
    .hero h1 {
        font-size: 21px;
    }

    .hero-features li {
        font-size: 13px;
    }

    .logo-img {
        height: 24px;
    }

    .header-nav-label {
        font-size: 10px;
        padding: 2px 8px;
    }

    .step-num {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .step-line {
        width: 16px;
        margin: 0 2px;
        margin-bottom: 18px;
    }

    .result-number {
        font-size: 34px;
    }
}

/* ============ TOUCH DEVICE OPTIMIZATIONS ============ */
@media (hover: none) and (pointer: coarse) {
    /* Bigger tap targets on touch devices */
    .btn {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 40px;
        padding: 8px 16px;
    }

    .preset-btn {
        min-height: 44px;
    }

    .file-preview-remove {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    /* Disable hover effects on touch */
    .dropzone:hover {
        border-color: var(--border-light);
        background: var(--bg-dark);
    }

    .dropzone.drag-over {
        border-color: var(--green);
        background: rgba(29, 185, 84, 0.05);
    }
}

/* ============ SAFE AREA (NOTCH) ============ */
@supports (padding: env(safe-area-inset-bottom)) {
    .footer {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    .header {
        padding-top: calc(12px + env(safe-area-inset-top));
    }
}
