/* === Self-hosted Inter font (v20) === */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('./fonts/inter-v20-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('./fonts/inter-v20-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('./fonts/inter-v20-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('./fonts/inter-v20-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('./fonts/inter-v20-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('./fonts/inter-v20-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('./fonts/inter-v20-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('./fonts/inter-v20-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --bg-color: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-blue: #0ea5e9;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(203, 213, 225, 0.6);
    --glass-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background gradient effect simplified for performance */
.background-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: 
        radial-gradient(circle at 15% 50%, rgba(14, 165, 233, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.03), transparent 25%);
    z-index: -1;
    pointer-events: none;
    transform: translateZ(0); /* Force compositing layer */
    backface-visibility: hidden;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center-align logo and text */
    margin-bottom: 2rem;
    position: relative;
    will-change: opacity, transform; /* Hint for browser optimization */
    transform: translateZ(0); /* Force compositing layer */
    backface-visibility: hidden;
}

.main-logo {
    max-width: 308px;
    height: auto;
    display: block;
    margin-bottom: 0.5rem;
    transition: transform 0.3s ease;
}

.main-logo:hover {
    transform: scale(1.02);
    transform-origin: center center;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 0;
    gap: 0.75rem;
}

.version-badge {
    position: static; /* Back to normal flow */
    font-size: 0.75rem;
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent-blue);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

.sub-title {
    color: #000;
    font-weight: 700;
    margin-top: 0;
    font-size: 1.2rem;
}

.dashboard {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
    align-items: start;
}

.glass {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px 0 rgba(0, 0, 0, 0.08);
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.75rem;
}

.input-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.input-row {
    display: flex;
    gap: 1rem;
}

.input-group.half {
    flex: 1;
}

label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    font-weight: 500;
}

input[type="number"], select {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="number"]:focus, select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.helper-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: -0.5rem;
    font-style: italic;
}

/* Summary Section */
.sticky {
    position: sticky;
    top: 2rem;
}

.summary-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(226, 232, 240, 1);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* Removed transform properties that break position: sticky */
}

.summary-card.glass:hover {
    /* Prevent hover transform from breaking sticky position */
    transform: none;
}

.total-display {
    text-align: center;
    margin: 1.5rem 0;
}

.current-weight {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--accent-green);
    transition: color 0.3s ease;
}

.current-weight .unit {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 0.25rem;
}

.gvwr-target {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 0.5rem;
}

.progress-bar-container {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-green);
    border-radius: 6px;
    transition: width 0.5s cubic-bezier(0.1, 0.7, 0.1, 1), background-color 0.3s ease;
}

.remaining-display {
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--accent-green);
    margin-bottom: 2rem;
    transition: color 0.3s ease;
}

.remaining-display.warning {
    color: var(--accent-yellow);
}

.remaining-display.danger {
    color: var(--accent-red);
}

/* Modifier classes for current weight color */
.current-weight.warning { color: var(--accent-yellow); }
.current-weight.danger { color: var(--accent-red); }
.progress-bar.warning { background: var(--accent-yellow); }
.progress-bar.danger { background: var(--accent-red); }

.tab-selector {
    display: flex;
    background: rgba(226, 232, 240, 0.6);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid var(--glass-border);
}

.tab-selector input[type="radio"] {
    display: none;
}

.tab-selector label {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    margin-bottom: 0;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.tab-selector label:hover {
    color: var(--text-primary);
}

.tab-selector input[type="radio"]:checked + label {
    background: var(--accent-blue);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.option-item:hover {
    background: #ffffff;
    border-color: var(--accent-blue);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.option-checkbox {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.option-content {
    display: flex;
    flex-direction: column;
}

.option-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.option-weight {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.axle-summary {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(241, 245, 249, 0.6);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.axle-summary h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.axle-stat {
    margin-bottom: 0.75rem;
}

.axle-stat:last-child {
    margin-bottom: 0;
}

.axle-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.axle-labels .remaining {
    color: var(--accent-green);
    font-weight: 600;
}
.axle-labels .remaining.warning { color: var(--accent-yellow); }
.axle-labels .remaining.danger { color: var(--accent-red); }

.progress-bar-container.small {
    height: 6px;
    margin-bottom: 0;
    box-shadow: none;
}

.breakdown h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    font-size: 0.95rem;
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-item span:last-child {
    font-weight: 600;
}

.option-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(226, 232, 240, 0.5);
    pointer-events: none;
    border-color: rgba(203, 213, 225, 0.3);
}

/* New class for passenger tabs to disable interaction without changing look */
.tab-selector.locked {
    pointer-events: none;
}

/* Responsive */
@media (max-width: 900px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
    
    .sticky {
        position: static;
    }
    
    .summary-section {
        order: -1; /* Move summary to top on mobile */
    }

    .main-logo, header p {
        margin-left: 0;
        max-width: 260px;
    }
}

@media (max-width: 600px) {
    .app-container {
        padding: 1rem;
    }

    .current-weight {
        font-size: 2.8rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1rem;
    }
}

/* === Migrated from inline styles === */
.options-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
}

.options-card-header h2 {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

#clearOptionsBtn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    cursor: pointer;
    transition: all 0.2s;
}

#waterContainer {
    margin-bottom: 1.5rem;
}

.readonly-input {
    background: rgba(226, 232, 240, 0.5);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.summary-section {
    align-self: start;
}

.no-bottom-margin {
    margin-bottom: 0;
}

@media (max-width: 500px) {
    .input-row {
        flex-direction: column;
        gap: 0;
    }
}
