/**
 * Fuel Calculator for Sim Racing - Styles
 * Version: 1.1.0
 * Copyright (c) 2024. All rights reserved.
 * 
 * Updated: Aligned with FOV Calculator design system
 * Theme: Green accent (#4CAF50) replacing orange (#ff4b2b)
 */

/* CSS Custom Properties for Design System */
:root {
    /* Primary Colours */
    --fuel-primary: #4CAF50;
    --fuel-primary-hover: #45a049;
    --fuel-primary-dark: #388E3C;
    --fuel-primary-light: rgba(76, 175, 80, 0.1);
    --fuel-primary-lighter: rgba(76, 175, 80, 0.02);
    
    /* Background Colours */
    --fuel-bg-primary: #1a1a1a;
    --fuel-bg-secondary: #2d2d2d;
    --fuel-bg-overlay: rgba(0, 0, 0, 0.3);
    --fuel-bg-subtle: rgba(0, 0, 0, 0.2);
    
    /* Text Colours */
    --fuel-text-primary: #ffffff;
    --fuel-text-secondary: rgba(255, 255, 255, 0.7);
    --fuel-text-muted: rgba(255, 255, 255, 0.5);
    
    /* Border & Input Colours */
    --fuel-border-light: rgba(255, 255, 255, 0.2);
    --fuel-border-lighter: rgba(255, 255, 255, 0.1);
    --fuel-input-bg: rgba(255, 255, 255, 0.1);
    --fuel-input-bg-hover: rgba(255, 255, 255, 0.15);
    
    /* Status Colours */
    --fuel-success: #4CAF50;
    --fuel-warning: #ff9800;
    --fuel-error: #f44336;
    
    /* Layout */
    --fuel-border-radius: 16px;
    --fuel-border-radius-sm: 8px;
    --fuel-border-radius-xs: 6px;
    --fuel-input-height: 45px;
    --fuel-transition: all 0.3s ease;
}

/* Main Container */
#fuel-calculator-wrapper {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    background: linear-gradient(135deg, var(--fuel-bg-primary) 0%, var(--fuel-bg-secondary) 100%);
    border-radius: var(--fuel-border-radius);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    position: relative;
}

/* Optional: For centered, max-width layout */
.fuel-calculator-contained #fuel-calculator-wrapper {
    max-width: 1200px;
}

/* Pattern overlay - Updated to green */
#fuel-calculator-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 35px, 
        var(--fuel-primary-lighter) 35px, var(--fuel-primary-lighter) 70px);
    pointer-events: none;
    z-index: 1;
}

/* Tab Navigation - Styled to match FOV button approach */
.calculator-tabs {
    display: flex;
    background: var(--fuel-bg-overlay);
    padding: 0;
    position: relative;
    z-index: 2;
}

.calculator-tabs .tab {
    flex: 1;
    padding: 20px;
    background: transparent;
    border: none;
    color: var(--fuel-text-secondary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--fuel-transition);
    position: relative;
}

.calculator-tabs .tab:hover {
    color: var(--fuel-text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.calculator-tabs .tab.active {
    color: var(--fuel-text-primary);
    background: var(--fuel-primary);
}

.calculator-tabs .tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--fuel-primary-hover);
}

/* Tab Content */
.tab-content {
    display: none;
    position: relative;
    z-index: 2;
}

.tab-content.active {
    display: block;
}

/* Calculator Card */
.calculator-card {
    padding: 60px;
    color: var(--fuel-text-primary);
}

@media (max-width: 1200px) {
    .calculator-card {
        padding: 40px;
    }
}

.calculator-card h2 {
    color: var(--fuel-text-primary);
    margin: 0 0 30px 0;
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.calculator-card h3 {
    color: var(--fuel-primary);
    margin: 30px 0 20px 0;
    font-size: 1.3rem;
    font-weight: 600;
}
/* Input Groups */
.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

/* Updated Input Styling to Match FOV */
.input-wrapper input[type="number"] {
    width: 100%;
    height: var(--fuel-input-height);
    padding: 0 50px 0 15px;
    background: var(--fuel-input-bg);
    border: 1px solid var(--fuel-border-light);
    border-radius: var(--fuel-border-radius-sm);
    color: var(--fuel-text-primary);
    font-size: 16px;
    font-weight: 500;
    transition: var(--fuel-transition);
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.input-wrapper input[type="number"]:hover {
    background: var(--fuel-input-bg-hover);
}

.input-wrapper input[type="number"]:focus {
    outline: none;
    border-color: var(--fuel-primary);
    background: var(--fuel-input-bg-hover);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.input-wrapper input[type="number"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Remove spin buttons */
.input-wrapper input[type="number"]::-webkit-inner-spin-button,
.input-wrapper input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.unit {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--fuel-text-muted);
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
}

/* Toggle Switch - Updated to green */
.switch-container {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    gap: 15px;
}

.switch-container span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
}

.switch {
    position: relative;
    width: 60px;
    height: 30px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--fuel-border-light);
    transition: .4s;
    border-radius: 30px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--fuel-primary);
}

input:checked + .slider:before {
    transform: translateX(30px);
}
/* Results Section - Aligned with FOV style */
.results-section {
    margin-top: 40px;
    padding: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid var(--fuel-border-lighter);
}

/* Results grid for better layout on wide screens */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.results-section h3 {
    margin-top: 0;
    grid-column: 1 / -1;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--fuel-border-radius-sm);
    transition: var(--fuel-transition);
}

.result-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.result-item:last-child {
    margin-bottom: 0;
}

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

.result-value {
    color: var(--fuel-primary);
    font-size: 20px;
    font-weight: 600;
}

/* Safety fuel emphasis - keeping this prominent */
.safe-fuel .result-value {
    color: var(--fuel-primary);
    font-size: 24px;
    font-weight: 700;
}

/* Stint Management - Updated colors */
.stint-container {
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid var(--fuel-border-lighter);
}

.stint-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.stint-header h4 {
    margin: 0;
    color: var(--fuel-primary);
    font-size: 1.1rem;
}

.stint-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stint-info {
    margin-top: 15px;
    padding: 10px;
    background: var(--fuel-primary-light);
    border-radius: var(--fuel-border-radius-xs);
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

/* Buttons - Updated to green theme */
.add-stint-btn,
.remove-stint-btn {
    padding: 12px 24px;
    background: var(--fuel-primary);
    color: white;
    border: none;
    border-radius: var(--fuel-border-radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--fuel-transition);
    margin-top: 20px;
}

.add-stint-btn:hover {
    background: var(--fuel-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.remove-stint-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 14px;
    margin: 0;
}

.remove-stint-btn:hover {
    background: rgba(76, 175, 80, 0.2);
    transform: none;
    box-shadow: none;
}
/* Responsive Design - Matching FOV approach */
@media (max-width: 768px) {
    #fuel-calculator-wrapper {
        border-radius: 0;
        box-shadow: none;
    }
    
    .calculator-card {
        padding: 30px;
    }
    
    .calculator-card h2 {
        font-size: 1.5rem;
    }
    
    .input-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .stint-inputs {
        grid-template-columns: 1fr;
    }
    
    .calculator-tabs .tab {
        padding: 15px 10px;
        font-size: 14px;
    }
    
    .result-value {
        font-size: 18px;
    }
    
    .safe-fuel .result-value {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    #fuel-calculator-wrapper {
        margin: 0;
    }
    
    .calculator-card {
        padding: 15px;
    }
    
    .calculator-card h2 {
        font-size: 1.25rem;
        margin-bottom: 20px;
    }
    
    .calculator-card h3 {
        font-size: 1.1rem;
    }
    
    .results-section {
        padding: 20px;
    }
    
    .add-stint-btn {
        width: 100%;
    }
}

/* Theme Overrides - Updated for consistency */
.fuel-theme-dark #fuel-calculator-wrapper {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
}

.fuel-theme-light #fuel-calculator-wrapper {
    background: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
}

.fuel-theme-light .calculator-card h2,
.fuel-theme-light .calculator-card h3 {
    color: #333333;
    text-shadow: none;
}

.fuel-theme-light .input-wrapper input[type="number"] {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.2);
    color: #333333;
}

.fuel-theme-light .calculator-tabs .tab {
    color: rgba(0, 0, 0, 0.7);
}

.fuel-theme-light .calculator-tabs .tab.active {
    color: white;
    background: var(--fuel-primary);
}

.fuel-theme-light .result-label {
    color: rgba(0, 0, 0, 0.7);
}

.fuel-theme-light .result-value {
    color: var(--fuel-primary-dark);
}

/* WordPress Compatibility */
#fuel-calculator-wrapper * {
    box-sizing: border-box;
}

#fuel-calculator-wrapper input,
#fuel-calculator-wrapper button,
#fuel-calculator-wrapper select {
    font-family: inherit;
}

/* Focus States - Accessibility */
#fuel-calculator-wrapper *:focus-visible {
    outline: 3px solid var(--fuel-primary);
    outline-offset: 2px;
}

/* Smooth animations */
#fuel-calculator-wrapper {
    scroll-behavior: smooth;
}

/* Loading state */
.fuel-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--fuel-text-secondary);
}

/* Error state */
.fuel-error {
    text-align: center;
    color: var(--fuel-error);
    font-size: 1.1rem;
    padding: 20px;
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
    border-radius: var(--fuel-border-radius-sm);
    margin: 20px;
}

/* Print styles */
@media print {
    #fuel-calculator-wrapper {
        background: white;
        color: black;
        box-shadow: none;
    }
    
    .calculator-tabs,
    .add-stint-btn,
    .remove-stint-btn {
        display: none;
    }
    
    .result-value {
        color: black;
        font-weight: bold;
    }
}