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

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

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

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

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

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

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

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

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

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

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

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

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

.ocst-input-card,
.ocst-result-card,
.ocst-diagram-card,
.ocst-presets-card,
.ocst-bezel-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-presets-card:hover,
.ocst-bezel-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-mode-card {
    border-color: #f59e0b;
    background-color: #fffbeb;
}

.ocst-target-card {
    border-color: #2563eb;
    background-color: #eff6ff;
}

.ocst-mode-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ocst-mode-label {
    font-weight: 700;
    color: #92400e;
}

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

.ocst-quick-presets {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.ocst-preset-btn {
    flex: 1;
    min-width: 80px;
    padding: 6px 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ocst-preset-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
    border-color: #cbd5e1;
}

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

.ocst-badge {
    font-size: 0.65rem;
    padding: 2px 4px;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

.ocst-preset-btn.active .ocst-badge {
    background: rgba(255,255,255,0.2);
}

.ocst-reality-warning {
    margin-top: 16px;
    padding: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    color: #991b1b;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}

.ocst-reality-warning svg {
    flex-shrink: 0;
    color: #ef4444;
}

.ocst-field.calculated .ocst-input-group {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
    background: #f0fdf4;
}

.ocst-field.calculated label {
    color: #10b981;
}

.ocst-field.calculated .ocst-range-slider {
    opacity: 0.5;
    pointer-events: none;
}

.ocst-field.calculated .ocst-input-group,
.ocst-field.calculated .ocst-range-slider {
    pointer-events: none;
}

.ocst-field.calculated input {
    color: #2563eb;
    font-weight: 600;
}

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

.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-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;
    background: transparent;
    border: none;
    color: #1e293b;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    min-width: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}

.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;
}

/* Select */
.ocst-fov-calculator select {
    width: 100%;
    padding: 12px 16px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    color: #1e293b;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

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

/* Custom ratio inputs */
.ocst-ratio-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ocst-ratio-inputs input {
    flex: 1;
    padding: 12px 16px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    color: #1e293b;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}

.ocst-ratio-inputs input::-webkit-outer-spin-button,
.ocst-ratio-inputs input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

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

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

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

/* ============================================
   6. MONITOR TOGGLE
   ============================================ */

.ocst-monitor-toggle {
    display: flex;
    gap: 8px;
}

.ocst-monitor-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-monitor-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.05);
}

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

/* ============================================
   7. UNIT TOGGLE (cm / in)
   ============================================ */

.ocst-unit-toggle {
    display: flex;
    border-left: 2px solid #e2e8f0;
}

.ocst-unit-btn {
    padding: 12px 14px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
}

.ocst-unit-btn:first-child {
    border-right: 1px solid #e2e8f0;
}

.ocst-unit-btn:hover {
    color: #475569;
    background: #f1f5f9;
}

.ocst-unit-btn.active {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
}

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

.ocst-result-card {
    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-result-card::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-value.ocst-bounce {
    transform: scale(1.05);
}

.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);
}

/* ============================================
   9. DIAGRAM 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;
}

/* ============================================
   10. SIM PRESETS
   ============================================ */

.ocst-presets-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ocst-preset-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ocst-preset-item:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.ocst-preset-item.expanded {
    border-color: #2563eb;
    background: rgba(37, 99, 235, 0.05);
}

.ocst-preset-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1e293b;
}

.ocst-preset-arrow {
    color: #94a3b8;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.ocst-preset-item.expanded .ocst-preset-arrow {
    transform: rotate(180deg);
    color: #2563eb;
}

.ocst-preset-detail {
    display: none;
    padding: 12px 16px;
    margin-top: -1px;
    background: rgba(37, 99, 235, 0.03);
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 0.75rem 0.75rem;
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.6;
}

.ocst-preset-detail.visible {
    display: block;
    animation: ocst-slideDown 0.2s ease-out;
}

@keyframes ocst-slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ocst-preset-detail code {
    background: rgba(37, 99, 235, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
    color: #2563eb;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.ocst-preset-fov-type {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ocst-type-hfov {
    background: #d1fae5;
    color: #065f46;
}

.ocst-type-vfov {
    background: #fef3c7;
    color: #92400e;
}

/* ============================================
   11. TRIPLE SCREEN TIPS
   ============================================ */

.ocst-bezel-card {
    border-color: #93c5fd;
    background: #eff6ff;
}

.ocst-tips-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ocst-tips-list li {
    position: relative;
    padding: 8px 0 8px 24px;
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.5;
}

.ocst-tips-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2563eb;
    opacity: 0.5;
}

.ocst-tips-list li strong {
    color: #1e293b;
}

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

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

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

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

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

    .ocst-fov-title {
        font-size: 1.5rem;
    }

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

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

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

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

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

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

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

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

    .ocst-monitor-btn {
        width: 100%;
        padding: 14px; /* Larger tap target */
    }

    .ocst-input-group input {
        font-size: 1rem;
        padding: 10px 12px;
    }
    
    .ocst-range-slider {
        height: 8px; /* Slightly thicker for touch */
        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;
    }
}
/* ============================================
   13. CUSTOM SWITCH & RADIUS FIELD
   ============================================ */

.ocst-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.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: 34px;
}

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

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

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

/* ============================================
   14. RANGE SLIDERS
   ============================================ */

.ocst-range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 5px;
    outline: none;
    margin: 15px 0 5px 0;
}

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

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

.ocst-range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #1d4ed8;
}

.ocst-range-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    background: #1d4ed8;
}
