/* Fuelseeker.net - Main Stylesheet */
:root {
    --primary-color: #1a5f2a;
    --primary-hover: #134620;
    --secondary-color: #2c6aa0;
    --secondary-hover: #1e4a70;
    --text-color: #333;
    --text-light: #555;
    --text-muted: #767676;
    --bg-color: #f5f5f5;
    --bg-white: #fff;
    --border-color: #ddd;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 24px;
    --radius-sm: 4px;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #e8f5e9 0%, #e3f2fd 50%, #f3e5f5 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0.5rem;
    border-radius: var(--radius-sm);
}

.nav-link:hover {
    background-color: rgba(44,106,160,0.1);
    color: var(--secondary-hover);
}

main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

.hero {
    text-align: center;
    padding: 0 1rem 0.5rem 1rem;
}

.hero h1 {
    font-size: 2rem;
    margin: 0 0 0.5rem;
    color: var(--text-color);
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-light);
    margin: 0;
}

.search-container {
    display: flex;
    justify-content: center;
    padding: 0 0 3rem;
}

.search-box {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
}

.search-box h2 {
    margin: 0 0 1.5rem;
    text-align: center;
    color: var(--text-color);
    font-size: 1.5rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-light);
}

.input-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.input-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.separator {
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-weight: 500;
}

.separator.tight {
    margin: 0.5rem 0;
}

.button-group {
    margin-top: 1rem;
}

.btn-primary, .btn-secondary {
    display: block;
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

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

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

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

.error-message, .error-banner {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background-color: #f8d7da;
    color: #721c24;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--danger-color);
}

.error-banner {
    margin: 1rem 0;
    border-radius: var(--radius);
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.75rem;
    color: var(--text-light);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

.loading-overlay.hidden, .hidden {
    display: none !important;
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

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

.info-section {
    padding: 2rem 0;
}

.info-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature {
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.feature .icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.feature h3 {
    margin: 0 0 0.5rem;
    color: var(--text-color);
}

.feature p {
    margin: 0;
    color: var(--text-light);
}

.data-source {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
}

.last-updated {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.5rem 0 0;
    font-style: italic;
}

/*footer {
    background-color: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}*/

/* Map Page */
.map-page {
    padding-top: 0.5rem;
}

.location-info {
    margin-bottom: 1rem;
}

.location-info h1 {
    margin: 0 0 0.25rem;
    font-size: 1.75rem;
}

.location-details {
    margin: 0;
    color: var(--text-light);
}

.map-container {
    position: relative;
    height: 500px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.map {
    width: 100%;
    height: 100%;
}

.map-legend {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255,255,255,0.95);
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 400;
    font-size: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.25rem;
}

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

.legend-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-icon.open {
    background-color: var(--success-color);
}

.legend-icon.closed {
    background-color: var(--danger-color);
}

/* Station Markers */
.station-marker {
    background: transparent !important;
}

.station-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.station-icon.station-open {
    background-color: var(--success-color);
}

.station-icon.station-closed {
    background-color: var(--danger-color);
}

.user-location-marker {
    background: transparent !important;
}

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

.station-popup h3 {
    margin: 0 0 0.15rem;
    font-size: 0.95rem;
    color: var(--text-color);
    line-height: 1.2;
}

.station-status {
    display: inline-block;
    padding: 0.1rem 0.3rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.15rem;
    line-height: 1;
}

.station-status.open {
    background-color: #d4edda;
    color: #155724;
}

.station-status.closed {
    background-color: #f8d7da;
    color: #721c24;
}

.station-address {
    margin: 0.1rem 0 0.2rem;
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.2;
}

.google-maps-link {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--secondary-color);
    text-decoration: none;
    margin: 0;
    line-height: 1.1;
}

.google-maps-link:hover {
    text-decoration: underline;
}

.station-prices {
    background-color: var(--bg-color);
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.3rem;
}

.price-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.15rem;
    line-height: 1.2;
}

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

.fuel-type {
    font-weight: 500;
}

.price {
    font-weight: 700;
    color: var(--primary-color);
}

/* Results Section */
.results-section {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.results-section p {
    margin: 0.2rem 0 0.4rem 0.5rem;
    font-size: 1rem;
}

.results-info {
    margin: 0 0 1rem;
    color: var(--success-color);
    font-size: 1rem;
}

.table-container {
    overflow-x: auto;
}

.fuel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

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

.fuel-table th {
    background-color: var(--bg-color);
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
}

.fuel-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.fuel-table th.sortable:hover {
    background-color: #e8e8e8;
}

.fuel-table th.sorted-asc, .fuel-table th.sorted-desc {
    background-color: #e0e0e0;
}

.sort-indicator {
    margin-left: 0.5rem;
    font-size: 0.75rem;
}

.fuel-table tbody tr:hover {
    background-color: rgba(44,106,160,0.05);
}

.station-name {
    font-weight: 500;
}

.price-cell {
    font-family: monospace;
    font-weight: 600;
}

.price-cell.has-price {
    color: var(--primary-color);
}

.price-cell.no-price,
.no-price {
    color: var(--text-light);
    font-style: italic;
}

.postcode-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.postcode-link:hover {
    text-decoration: underline;
}

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

.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

/* Location Picker */
.location-picker {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 1rem;
}

.location-picker-content {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.location-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
}

.location-list li {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

.location-list li:hover {
    border-color: var(--secondary-color);
    background-color: rgba(44,106,160,0.05);
}

.location-list button {
    width: 100%;
    padding: 1rem;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.location-list .location-name {
    font-weight: 600;
    color: var(--text-color);
}

.location-list .location-details {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.location-list .location-type {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    .map-container {
        height: 350px;
    }
    .features {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    main {
        padding: 1rem;
    }
    .map-container {
        height: 300px;
    }
}
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    .map-container {
        height: 350px;
    }
    .features {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    main {
        padding: 1rem;
    }
    .map-container {
        height: 300px;
    }
}
@media (max-width: 768px) {
    .leaflet-popup-content {
        margin: 8px 10px;
    }
    
    .station-popup h3 {
        font-size: 0.95rem;
    }
    
    .station-prices {
        padding: 0.4rem;
    }
/* Smaller legend on mobile */
    .map-legend {
        padding: 0.25rem 0.35rem;
        font-size: 0.7rem;
    }
    
    .legend-item {
        gap: 0.25rem;
        margin-bottom: 0.15rem;
    }
    
    .legend-icon {
        width: 8px;
        height: 8px;
    }
}


/* Mobile popup sizing - fit within map window without overlapping controls */
@media (max-width: 768px) {
    .leaflet-popup-content-wrapper {
        max-width: 80vw !important; /* 80% of viewport width */
        min-width: 200px;
        max-height: 70vh !important; /* Limit height to 70% of viewport */
        overflow-y: auto; /* Add scrolling if content is too long */
    }

    .leaflet-popup-content {
        width: auto !important;
        margin: 8px 10px;
    }
}

/* Phones - even smaller to fit on screen */
@media (max-width: 480px) {
    .leaflet-popup-content-wrapper {
        max-width: 80vw !important;
        max-height: 50vh !important; /* 50% of screen height on phones */
    }
}

/* Compact popup styles for mobile */
@media (max-width: 768px) {
    .leaflet-popup-content {
        margin: 6px 8px !important;
    }
    
    .station-popup h3 {
        font-size: 0.85rem;
        margin-bottom: 0.1rem;
    }
    
    .station-status {
        font-size: 0.6rem;
        padding: 0.05rem 0.25rem;
        margin-bottom: 0.05rem;
    }
    
    .google-maps-link {
        font-size: 0.7rem;
        line-height: 1.1;
    }
    
    .station-address {
        font-size: 0.75rem;
        margin: 0.05rem 0 0.15rem;
        line-height: 1.15;
    }
    
    .station-prices {
        padding: 0.25rem;
        margin-bottom: 0.2rem;
    }
    
    .price-row {
        font-size: 0.8rem;
    }
    
    .station-hours {
        font-size: 0.7rem;
    }
}

/* Smaller table padding on mobile */
@media (max-width: 768px) {
    .fuel-table th, .fuel-table td {
        padding: 0.35rem 0.5rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .fuel-table th, .fuel-table td {
        padding: 0.25rem 0.35rem;
        font-size: 0.8rem;
    }
}