:root {
    --primary: #1a5f7a;
    --primary-dark: #134b61;
    --secondary: #57837b;
    --accent: #c38e70;
    --background: #faf8f5;
    --surface: #ffffff;
    --text: #2d3436;
    --text-light: #636e72;
    --border: #dfe6e9;
    --success: #27ae60;
    --warning: #f39c12;
    --error: #e74c3c;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.tagline {
    color: var(--text-light);
    font-size: 1.1rem;
}

.search-form {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.form-row {
    margin-bottom: 1.5rem;
}

.form-row:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

input[type="text"],
select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

.slider-row label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
    accent-color: var(--primary);
}

.preset-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.preset-buttons button {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid var(--border);
    background: var(--surface);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.preset-buttons button:hover,
.preset-buttons button.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.checkbox-label input {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--primary);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-btn:hover {
    background: var(--primary-dark);
}

.submit-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

.advanced-toggle {
    margin-top: 1.5rem;
    text-align: center;
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.toggle-btn:hover {
    color: var(--primary-dark);
}

.toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.advanced-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.advanced-section.hidden {
    display: none;
}

.results-section {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.results-section.hidden {
    display: none;
}

.loading {
    text-align: center;
    padding: 3rem;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.station-card {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.station-card:last-child {
    border-bottom: none;
}

.station-card.baseline {
    background: #f8f9fa;
    border-left: 4px solid var(--primary);
}

.station-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.station-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
}

.station-location {
    color: var(--text-light);
    font-size: 0.9rem;
}

.price-display {
    text-align: right;
}

.price-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
}

.price-updated {
    font-size: 0.8rem;
    color: var(--text-light);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.metric {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.metric-value.positive {
    color: var(--success);
}

.metric-value.negative {
    color: var(--error);
}

.verdict-box {
    background: #fff8e1;
    border-left: 4px solid var(--warning);
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.verdict-box.positive {
    background: #e8f5e9;
    border-color: var(--success);
}

.verdict-box.negative {
    background: #ffebee;
    border-color: var(--error);
}

/* Simplified comparison styles */
.verdict-box {
    padding: 1.5rem;
    margin: 0;
    border-left: none;
    border-radius: var(--radius) var(--radius) 0 0;
    text-align: center;
    font-style: normal;
}

.verdict-box h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
}

.stations-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    padding: 2rem;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.station-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    border-bottom: none;
}

.station-card.winner {
    border-color: var(--success);
    box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.1);
}

.station-card h3 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.station-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.station-details {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.station-details .brand {
    font-weight: 600;
    color: var(--primary);
}

.station-card .price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--success);
    margin: 0.5rem 0;
}

.price-freshness {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
    background: #f0f0f0;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.distance {
    font-size: 1rem;
    color: var(--text-light);
}

.station-card .distance {
    font-size: 1rem;
    color: var(--text-light);
}

.vs-divider {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-light);
    padding: 0 1rem;
}

.analysis {
    padding: 2rem;
    background: var(--surface);
}

.analysis h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-row.highlight {
    background: #f8f9fa;
    margin: 0 -1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.metric-row.yearly {
    background: var(--primary);
    color: white;
    margin-top: 1rem;
}

.metric-row.yearly .label,
.metric-row.yearly .value {
    color: white;
}

.metric-row .label {
    color: var(--text-light);
}

.metric-row .value {
    font-weight: 600;
    font-size: 1.1rem;
}

.metric-row .value.positive {
    color: var(--success);
}

.metric-row .value.negative {
    color: var(--error);
}

.recommendation {
    padding: 1.5rem 2rem;
    background: #f8f9fa;
    border-top: 1px solid var(--border);
    font-size: 1.1rem;
    text-align: center;
}

.recommendation.closest {
    background: #e8f5e9;
    color: var(--success);
}

.recommendation.cheapest {
    background: #fff3e0;
    color: var(--warning);
}

.recommendation-simplified {
    text-align: center;
    padding: 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.recommendation-simplified p {
    font-size: 1.2rem;
    color: var(--text);
    font-weight: 500;
    margin: 0;
}

.stations-comparison.single {
    display: block;
    padding: 2rem;
}

.stations-comparison.single .station-card {
    max-width: 400px;
    margin: 0 auto;
}

.error-message {
    padding: 2rem;
    text-align: center;
    color: var(--error);
}

.five-cheapest {
    padding: 1.5rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.five-cheapest h4 {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cheapest-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.cheapest-table th,
.cheapest-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.cheapest-table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.cheapest-table td.freshness {
    font-size: 0.85rem;
    color: var(--text-light);
}

.cheapest-table tr.highlight {
    background: #e8f5e9;
    font-weight: 600;
}

/* Confidence Indicators */
.confidence-indicator {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    display: inline-block;
    font-weight: 500;
}

.confidence-high {
    background: #e8f5e9;
    color: #27ae60;
}

.confidence-medium {
    background: #fff3e0;
    color: #f39c12;
}

.confidence-low {
    background: #fee;
    color: #e74c3c;
}

/* Routing Quality Section */
.routing-quality {
    padding: 1.5rem 2rem;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
}

.routing-quality h4 {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.quality-metrics {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.quality-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.quality-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success);
}

.quality-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

@media (max-width: 600px) {
    .stations-comparison {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .vs-divider {
        padding: 0.5rem 0;
    }
    
    .station-card .price {
        font-size: 2rem;
    }
    
    .five-cheapest {
        padding: 1rem;
    }
    
    .cheapest-table {
        font-size: 0.85rem;
    }
    
    .cheapest-table th,
    .cheapest-table td {
        padding: 0.5rem;
    }
}

footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.disclaimer {
    font-size: 0.85rem;
    color: var(--text-light);
}

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

    header h1 {
        font-size: 2rem;
    }

    .search-form {
        padding: 1.5rem;
    }

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