/**
 * OC Sim Racing Tools — Fuel Calculator
 * Light theme matching the sim-racing-parts-picker and FOV calculator design system.
 */

/* ============================================
   1. CONTAINER
   ============================================ */

.ocst-fuel-calculator {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1e293b;
    line-height: 1.5;
}

.ocst-fuel-calculator *,
.ocst-fuel-calculator *::before,
.ocst-fuel-calculator *::after {
    box-sizing: border-box;
}

/* ============================================
   2. HEADER
   ============================================ */

.ocst-fuel-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.ocst-fuel-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 8px 0 !important;
    font-size: 2rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
}

.ocst-fuel-title svg {
    color: #2563eb;
    flex-shrink: 0;
}

.ocst-fuel-subtitle {
    margin: 0 !important;
    font-size: 1rem;
    color: #64748b;
}

/* ============================================
   3. BODY LAYOUT
   ============================================ */

.ocst-fuel-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.ocst-fuel-inputs {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ocst-fuel-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ============================================
   4. CARDS (shared)
   ============================================ */

.ocst-input-card,
.ocst-result-card,
.ocst-result-stats-card,
.ocst-diagram-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 1rem;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ocst-input-card:hover,
.ocst-result-stats-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.ocst-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px 0 !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    color: #64748b !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: none;
    padding-bottom: 0;
}

.ocst-card-title svg {
    color: #2563eb;
    flex-shrink: 0;
}

/* ============================================
   5. FIELDS & INPUTS
   ============================================ */

.ocst-field {
    margin-bottom: 18px;
}

.ocst-field:last-child {
    margin-bottom: 0;
}

.ocst-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.ocst-field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ocst-field-header label {
    margin-bottom: 0;
}

.ocst-input-group {
    display: flex;
    align-items: center;
    gap: 0;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ocst-input-group:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.ocst-input-group input {
    flex: 1;
    padding: 12px 16px !important;
    background: transparent !important;
    border: none !important;
    color: #1e293b !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    outline: none !important;
    min-width: 0;
    -moz-appearance: textfield;
    appearance: textfield;
    box-shadow: none !important;
    margin: 0 !important;
}

.ocst-input-group input::-webkit-outer-spin-button,
.ocst-input-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ocst-unit {
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    background: #e2e8f0;
    white-space: nowrap;
    user-select: none;
}

.ocst-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.4;
}

/* Buttons and Toggles */
.ocst-race-type-toggle {
    display: flex;
    gap: 8px;
}

.ocst-type-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: #ffffff;
    border: 2px dashed #e2e8f0;
    border-radius: 0.75rem;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.ocst-type-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.05);
}

.ocst-type-btn.active {
    border: 2px solid #2563eb;
    border-style: solid;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.05);
}

/* Multi-input groupings (Duration & Lap Time) */
.ocst-duration-inputs, .ocst-lap-time-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ocst-duration-group, .ocst-lap-group {
    flex: 1;
}

.ocst-duration-sep {
    font-size: 1.2rem;
    font-weight: 700;
    color: #64748b;
}

.ocst-mode-toggles {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.ocst-mode-toggles .ocst-field {
    flex: 1;
    margin-bottom: 0;
}

/* Modern Toggle Switch */.ocst-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    margin-top: 8px;
}

.ocst-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ocst-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 24px;
}

.ocst-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

input:checked + .ocst-slider {
    background-color: #2563eb;
}

input:focus + .ocst-slider {
    box-shadow: 0 0 1px #2563eb;
}

input:checked + .ocst-slider:before {
    transform: translateX(24px);
}

/* Range Sliders */
.ocst-switch-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ocst-range-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
    margin-top: 0.5rem;
}

.ocst-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

.ocst-range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

.ocst-range-slider::-webkit-slider-thumb:hover,
.ocst-range-slider::-webkit-slider-thumb:active {
    transform: scale(1.15);
}

.ocst-extra-val {
    font-weight: 700;
    font-size: 1rem;
    color: #1e293b;
    min-width: 60px;
    text-align: right;
}

/* ============================================
   8. RESULT CARD
   ============================================ */

.ocst-diagram-card {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

.ocst-diagram-card canvas {
    width: 100%;
    height: auto;
    max-height: 220px;
}

.ocst-primary-result {
    background: linear-gradient(135deg, #1c8e4d, #25a55d);
    border: none;
    text-align: center;
    padding: 32px 24px;
    box-shadow: 0 10px 15px -3px rgba(28, 142, 77, 0.25), 0 4px 6px -2px rgba(28, 142, 77, 0.1);
    position: relative;
    overflow: hidden;
}

.ocst-primary-result::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.12), transparent 60%);
    pointer-events: none;
}

.ocst-result-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 8px;
}

.ocst-result-value {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ocst-result-number {
    font-size: 4rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1;
}

.ocst-result-deg {
    font-size: 2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.65);
}

.ocst-result-sub {
    margin-top: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
}

/* Secondary Stats */
.ocst-result-stats-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ocst-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

#ocst-strategy-results {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px dashed #e2e8f0;
}

.ocst-stat-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ocst-stat-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.95rem;
}

.ocst-stat-value {
    font-weight: 700;
    color: #1e293b;
    font-size: 1.1rem;
}

/* ============================================
   12. RESPONSIVE REFINEMENTS
   ============================================ */

@media (max-width: 900px) {
    .ocst-fuel-body {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .ocst-fuel-calculator {
        padding: 12px;
    }

    .ocst-fuel-body {
        grid-template-columns: 1fr;
    }

    .ocst-fuel-header {
        margin-bottom: 16px;
        padding-bottom: 16px;
    }

    .ocst-fuel-title {
        font-size: 1.5rem !important;
    }

    .ocst-result-number {
        font-size: 3.5rem;
    }

    .ocst-result-deg {
        font-size: 1.8rem;
    }

    .ocst-primary-result {
        padding: 24px 20px;
    }
}

@media (max-width: 480px) {
    .ocst-fuel-calculator {
        padding: 8px;
    }

    .ocst-input-card,
    .ocst-primary-result,
    .ocst-result-stats-card,
    .ocst-diagram-card {
        padding: 20px 16px;
        border-radius: 0.75rem;
    }

    .ocst-result-number {
        font-size: 2.8rem;
    }

    .ocst-result-deg {
        font-size: 1.4rem;
    }

    .ocst-race-type-toggle {
        flex-direction: column;
        gap: 8px;
    }

    .ocst-type-btn {
        width: 100%;
        padding: 14px;
    }

    .ocst-input-group input {
        font-size: 1rem !important;
        padding: 10px 12px !important;
    }
    
    .ocst-range-slider {
        height: 8px;
        margin: 20px 0 10px 0;
    }

    .ocst-range-slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }

    .ocst-range-slider::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
}
