:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --success: #198754;
    --success-light: #d1e7dd;
    --success-bright: #22c55e;
    --warning: #ffc107;
    --warning-light: #fff3cd;
    --danger: #dc3545;
    --dark: #1a1a2e;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-500: #6c757d;
    --gray-600: #6c757d;
    --gray-800: #343a40;
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.25);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0a1628;
    color: white;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Feature Cards */
.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 3rem auto 0;
    padding: 0 1rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 1.75rem;
    text-align: center;
    transition: all 0.3s ease;
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
}

.feature-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    color: var(--success-bright);
}

.feature-icon svg {
    width: 100%;
    height: 100%;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: white;
}

.feature-card p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
}

/* Hero Section */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('/img/img1.webp');
    background-size: cover;
    background-position: center;
    z-index: 1;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(10, 22, 40, 0.85) 0%, rgba(10, 22, 40, 0.7) 50%, rgba(10, 22, 40, 0.6) 100%);
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    text-align: center;
}

/* UK Map Silhouette */
.uk-map-silhouette {
    position: absolute;
    top: 10%;
    right: 5%;
    width: 300px;
    height: 400px;
    opacity: 0.1;
    z-index: 2;
    pointer-events: none;
}

.uk-map-silhouette svg {
    width: 100%;
    height: 100%;
}

/* Header Styles */
header {
    margin-bottom: 3rem;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-subtitle {
    font-size: 1.25rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    line-height: 1.2;
}

.hero-description {
    font-size: 1.3rem;
    font-weight: 500;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    max-width: 650px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    background: rgba(34, 197, 94, 0.2);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

/* Search Container */
.search-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Inline Search Form */
.search-form-inline {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.search-input-group {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
    margin-bottom: 1rem;
}

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

.input-wrapper .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    display: flex;
    align-items: center;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-left: 2.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--gray-800);
    transition: var(--transition);
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    outline: none;
    border-color: var(--success-bright);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.input-wrapper input::placeholder {
    color: var(--gray-500);
}

.select-wrapper select {
    padding-left: 1rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

.submit-btn-inline {
    padding: 0.875rem 2rem;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.submit-btn-inline:hover {
    background: var(--success-bright);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

/* Advanced Settings */
.advanced-toggle {
    text-align: center;
}

.toggle-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.toggle-btn:hover {
    color: white;
}

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

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

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

.advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.slider-group label span {
    font-weight: 700;
    color: var(--success-bright);
    background: rgba(34, 197, 94, 0.15);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.slider-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    accent-color: var(--success-bright);
}

/* Results Section */
.results-section {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 22, 40, 1.0);
    z-index: 100;
    overflow: auto;
    padding: 2rem;
    touch-action: auto;
    overscroll-behavior: contain;
}

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

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    color: white;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--success-bright);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

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

/* Results Layout */
.results-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    padding-top: 4rem;
}

.results-header {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    z-index: 1000;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.results-header:hover {
    transform: translateX(-50%) scale(1.05);
}

.results-logo {
    width: 40px;
    height: 40px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.results-brand {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.results-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
    height: calc(100vh - 8rem);
}

/* Left Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Savings Banner */
.savings-banner {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.savings-icon {
    width: 40px;
    height: 40px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.savings-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: white;
}

.savings-content p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
}

.savings-amount {
    color: var(--success-bright);
    font-weight: 700;
}

/* Features List */
.features-list {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    padding: 1rem;
}

.features-list ul {
    list-style: none;
}

.features-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.feature-check {
    width: 20px;
    height: 20px;
    background: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Stations Considered Count */
.stations-considered {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    text-align: center;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
}

.stations-considered strong {
    color: var(--success-bright);
    font-weight: 700;
}

/* Station Cards */
.station-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.station-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: var(--transition);
}

.station-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.station-card.best {
    border-color: var(--success-bright);
    background: rgba(34, 197, 94, 0.1);
}

/* Station Labels */
.station-label {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.nearest-label {
    background: var(--primary);
    color: white;
}

.best-label {
    background: var(--success);
    color: white;
}

/* Price Age Badge */
.price-age-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.station-price .per-litre {
    font-size: 0.9rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
    margin-left: 0.5rem;
}

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

.station-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: white;
}

.station-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--success-bright);
}

.station-price span {
    font-size: 0.9rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
}

.station-details {
    display: flex;
    gap: 1rem;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.station-savings {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.savings-row {
    display: flex;
    justify-content: space-between;
}

.savings-row .label {
    color: rgba(255, 255, 255, 0.6);
}

.savings-row .value {
    font-weight: 600;
}

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

.savings-row .value.negative {
    color: var(--danger);
}

.net-gain {
    font-weight: 700;
    font-size: 1rem;
    margin-top: 0.25rem;
}

.time-row {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
}

.time-row .value {
    color: rgba(255, 255, 255, 0.7);
}

/* Other Stations Dropdown */
.other-stations-dropdown {
    padding: 0;
    overflow: hidden;
}

.other-stations-toggle {
    width: 100%;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.other-stations-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.other-stations-toggle .toggle-icon {
    font-size: 0.875rem;
    transition: transform 0.2s;
}

.other-stations-list {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.other-stations-list.hidden {
    display: none;
}

.other-station-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

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

.other-station-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.other-station-name {
    font-weight: 600;
    color: white;
    font-size: 0.95rem;
}

.other-station-postcode {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.25rem;
}

.other-station-price {
    font-weight: 700;
    color: var(--success-bright);
    font-size: 1.1rem;
    text-align: right;
}

.other-station-price .price-age-badge {
    display: block;
    margin-left: 0;
    margin-top: 0.25rem;
    font-size: 0.65rem;
}

/* Right Side - Map */
.map-container {
    position: relative;
    height: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

#map {
    width: 100%;
    height: 100%;
    min-height: 500px;
}

/* Map Markers */
.marker-price {
    background: var(--success);
    color: white;
    padding: 0.35rem 0.6rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.marker-price.high {
    background: var(--primary);
}

.marker-user {
    width: 20px;
    height: 20px;
    background: #e91e63;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Error Message */
.error-message {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: white;
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    max-width: 600px;
    margin: 2rem auto;
}

/* Close Results Button */
.close-results {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
    z-index: 1000;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.close-results:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 1024px) {
    .results-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: auto;
    }

    .sidebar {
        max-height: 50vh;
        order: 2;
    }

    .map-container {
        order: 1;
        min-height: 400px;
    }

    .uk-map-silhouette {
        width: 150px;
        height: 200px;
        opacity: 0.05;
    }

    .hero-title {
        font-size: 2rem;
    }

    .search-input-group {
        flex-direction: column;
    }

    .submit-btn-inline {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .hero-content {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .hero-title {
        font-size: 1.5rem;
    }

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

    .results-section {
        padding: 1rem;
        padding-bottom: 5rem;
        -webkit-overflow-scrolling: touch;
        position: fixed;
    }

    .results-wrapper {
        padding-top: 0;
    }

    .results-header {
        display: none;
    }

    .close-results {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        transform: none;
        width: 100%;
        border-radius: 0;
        padding: 1rem;
        background: var(--success);
        border: none;
        font-size: 1rem;
        z-index: 1001;
    }

    .close-results:hover {
        transform: none;
        background: var(--success-bright);
    }

    .results-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 250px 1fr;
        height: auto;
        min-height: 100%;
        gap: 1rem;
    }

    .sidebar {
        max-height: none;
        overflow-y: visible;
        order: 1;
    }

    .map-container {
        height: 250px;
        min-height: 250px;
        pointer-events: none;
        order: 2;
    }
}

/* Leaflet Overrides */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-sm);
    background: white;
    color: var(--gray-800);
}

.leaflet-popup-content {
    margin: 0.75rem;
    font-size: 0.9rem;
}

.leaflet-container a.leaflet-popup-close-button {
    color: var(--gray-500);
    font-size: 1.25rem;
}

/* Price Age Badge */
.price-age {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.price-age.fresh {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-bright);
}

.price-age.stale {
    background: rgba(255, 193, 7, 0.2);
    color: var(--warning);
}

.price-age.expired {
    background: rgba(220, 53, 69, 0.2);
    color: var(--danger);
}
