/**
 * OC Sim Racing Tools — Tire Pressure Calculator
 * Light theme matching the Fuel/FOV calculator design system.
 */

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

.ocst-tire-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-tire-calculator *,
.ocst-tire-calculator *::before,
.ocst-tire-calculator *::after {
    box-sizing: border-box;
}

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

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

.ocst-tire-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-tire-title svg {
    color: #2563eb;
    flex-shrink: 0;
}

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

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

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

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

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

/* ============================================
   4. CARDS  (aligned with Fuel/FOV system)
   ============================================ */

.ocst-tire-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-tire-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-tire-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-tire-card-title svg {
    color: #2563eb;
    flex-shrink: 0;
}

/* ============================================
   5. FORM FIELDS  (aligned with Fuel/FOV)
   ============================================ */

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

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

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

.ocst-tire-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-tire-input-group:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

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

.ocst-tire-input-group input[type="number"]::-webkit-outer-spin-button,
.ocst-tire-input-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

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

/* Range sliders — same as Fuel/FOV */
.ocst-tire-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-tire-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-tire-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-tire-range-slider::-webkit-slider-thumb:hover,
.ocst-tire-range-slider::-webkit-slider-thumb:active {
    transform: scale(1.15);
}

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

/* ============================================
   6. UNIT TOGGLE
   ============================================ */

.ocst-unit-toggle {
    display: flex;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 16px;
}

.ocst-unit-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.ocst-unit-btn.active {
    background: #ffffff;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ============================================
   7. CAR CLASS PRESETS
   ============================================ */

.ocst-car-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.ocst-car-preset-btn {
    padding: 5px 10px;
    border: 1.5px solid #cbd5e1;
    border-radius: 20px;
    background: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.ocst-car-preset-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.ocst-car-preset-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

/* ============================================
   8. PRIMARY RESULT CARD (gradient, like Fuel)
   ============================================ */

.ocst-tire-primary-result {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    border: none !important;
    text-align: center;
    padding: 32px 24px !important;
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.25), 0 4px 6px -2px rgba(37, 99, 235, 0.1) !important;
    position: relative;
    overflow: hidden;
}

.ocst-tire-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-tire-primary-result:hover {
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.25), 0 4px 6px -2px rgba(37, 99, 235, 0.1) !important;
}

.ocst-tire-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-tire-result-value {
    font-size: 4rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.03em;
}

.ocst-tire-result-unit {
    font-size: 2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.65);
    margin-left: 4px;
}

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

/* Status badge */
.ocst-pressure-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 12px;
}

.ocst-pressure-badge.optimal {
    background: rgba(255, 255, 255, 0.2);
    color: #bbf7d0;
}

.ocst-pressure-badge.low {
    background: rgba(255, 255, 255, 0.2);
    color: #fecaca;
}

.ocst-pressure-badge.high {
    background: rgba(255, 255, 255, 0.2);
    color: #fed7aa;
}

/* ============================================
   9. STATS CARD
   ============================================ */

.ocst-tire-stats-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

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

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

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

/* ============================================
   10. GAUGE DIAGRAM (Canvas)
   ============================================ */

.ocst-tire-diagram-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 0.65;
    background: #f8fafc;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

#ocst-tire-diagram {
    width: 100%;
    height: 100%;
    display: block;
}

/* ============================================
   11. RESPONSIVE
   ============================================ */

/* Sticky result bar (mobile only) */
.ocst-tire-sticky-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: white;
    padding: 16px 24px;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 1.25rem 1.25rem 0 0;
}

.ocst-sticky-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

.ocst-sticky-value {
    font-size: 1.25rem;
    font-weight: 800;
}

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

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

    .ocst-tire-sticky-bar {
        display: flex; /* Show on mobile */
    }

    .ocst-tire-body {
        display: flex;
        flex-direction: column;
    }

    .ocst-tire-results {
        order: -1; /* Move results to top */
    }

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

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

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

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

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

    .ocst-car-presets {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .ocst-car-preset-btn {
        text-align: center;
        padding: 8px 4px;
    }
}

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

    /* No specific changes needed for sticky bar here anymore */

    .ocst-tire-card {
        padding: 20px 16px;
        border-radius: 0.75rem;
    }

    .ocst-tire-primary-result {
        padding: 20px 16px !important;
        border-radius: 0.75rem !important;
    }

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

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

    .ocst-tire-input-group input[type="number"] {
        font-size: 1rem !important;
        padding: 10px 12px !important;
    }

    .ocst-tire-range-slider {
        height: 8px;
        margin: 20px 0 10px 0;
    }

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

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

    .ocst-car-presets {
        grid-template-columns: repeat(2, 1fr);
    }
}
