body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0; /* Remove body padding */
    background-color: #f7f8fa;
    display: flex;
    flex-direction: column;
    position: fixed; /* Aggressively lock body to viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; /* Fallback */
    height: 100dvh; /* Dynamic height */
    color: #2c3e50;
    overflow: hidden;
    overscroll-behavior: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

h1 {
    text-align: center;
    color: #fff;
    padding: var(--spacing-lg) 0;
    margin: 0;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-bottom: 3px solid #FFC107;
    font-size: 1.8em;
    font-weight: 600;
    letter-spacing: 1px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.container {
    display: flex;
    flex-grow: 1; /* Allow container to fill remaining height */
    min-height: 0;
    overflow: hidden; /* Prevent container overflow */
}

#map {
    height: 100%; /* Map takes full height of container */
    flex: 3; /* Map takes more space */
    border-right: 1px solid #ccc;
    position: relative;
}

#locate-me-btn {
    position: absolute;
    top: 80px;
    left: 10px;
    z-index: 1000;
    width: 36px;
    height: 36px;
    background-color: white;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    box-sizing: border-box;
    box-shadow: 0 1px 5px rgba(0,0,0,0.65);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease, background-color 0.2s ease;
}

/* Hide UI elements when popup is active */
#map.popup-active #locate-me-btn,
#map.popup-active .map-legend,
#map.popup-active .leaflet-control-zoom {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#locate-me-btn:hover {
    background-color: var(--light-bg);
    transform: scale(1.05);
}

#locate-me-btn img {
    width: 16px;
    height: 16px;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.35));
}

.sidebar {
    flex: 1; /* Sidebar takes less space */
    display: flex;
    flex-direction: column;
    background-color: #fff;
    min-width: 280px; /* Ensure sidebar has reasonable width */
    max-width: 400px;
    height: 100%; /* Full height */
    overflow: hidden; /* Hide overflow for the sidebar itself */
}

#brand-filter {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    background-color: #fff;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 5;
}

#brand-filter.collapsed {
    padding-bottom: var(--spacing-sm);
}

.brand-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
}

#brand-filter h2 {
    margin: 0;
    font-size: 1.05em;
    text-align: left;
    color: var(--primary-color);
    font-weight: 600;
}

.filter-toggle-btn {
    border: none;
    background: rgba(30, 60, 114, 0.1);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-toggle-btn:hover {
    background: rgba(30, 60, 114, 0.2);
}

.brand-filter-summary {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 4px;
    margin-bottom: 4px;
}

#brand-filter-body {
    margin-top: var(--spacing-sm);
}

#brand-filter.collapsed #brand-filter-body {
    display: none;
}

#brand-filter.collapsed .brand-filter-summary {
    margin-bottom: 0;
}

.brand-filter-controls {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
    flex-wrap: wrap;
}

.brand-filter-btn {
    padding: 4px 12px;
    font-size: 0.85em;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.brand-filter-btn:hover {
    background: var(--light-bg);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

#brand-checkboxes {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    background-color: var(--light-bg);
}

#brand-checkboxes label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xs);
    cursor: pointer;
    font-size: 0.9em;
    padding: var(--spacing-sm) var(--spacing-sm);
    border-radius: 6px;
    transition: all 0.2s;
    background: white;
    border: 1px solid transparent;
}

#brand-checkboxes label:hover {
    background-color: var(--light-bg);
    border-color: var(--border-color);
}

#brand-checkboxes label.selected {
    background-color: rgba(30, 60, 114, 0.05);
    border-color: var(--primary-color);
}

#brand-checkboxes input {
    margin-right: var(--spacing-sm);
    flex-shrink: 0;
}

.brand-label-text {
    flex-grow: 1;
}

.brand-count {
    font-size: 0.85em;
    color: var(--text-secondary);
    background: var(--light-bg);
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: var(--spacing-sm);
}

#station-list {
    padding: 0 15px 15px 15px; /* No top padding needed */
    flex-grow: 1; /* Allow list to fill remaining sidebar space */
    overflow-y: auto; /* Enable scrolling ONLY for the list */
    overflow-x: hidden; /* Prevent horizontal scroll when list items shift */
    height: 0; /* Necessary for flex-grow + overflow-y to work */
    display: flex;
    flex-direction: column;
}

.sidebar-ad-container {
    padding: var(--spacing-md);
    text-align: center;
    border-top: 1px solid var(--border-color);
    background-color: #fff;
    min-height: 100px; /* Reserve space for the ad */
    flex-shrink: 0; /* Don't allow the ad to be compressed */
}

.popup-action-btn {
    flex: 1;
    min-width: 140px;
}

.station-ocr-subtext {
    margin: 6px 0;
    font-size: 0.82em;
    color: var(--text-secondary);
}

.station-action-hint {
    margin: 10px 0 0;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-primary);
}

.scan-price-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.9em;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.scan-price-btn:hover {
    background: #163055;
}

.scan-price-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.station-ocr-header .scan-price-btn {
    font-size: 0.8em;
    padding: 4px 10px;
}

.confirm-ocr-btn {
    margin-left: 8px;
    background: #2ecc71;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8em;
    cursor: pointer;
    transition: background 0.2s;
}

.confirm-ocr-btn:hover {
    background: #27ae60;
}

.confirm-ocr-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.station-ocr-output {
    margin-top: 6px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.station-ocr-output.error {
    color: #c0392b;
}

.station-ocr-output ul {
    list-style: none;
    padding: 0;
    margin: 6px 0 0 0;
}

.station-ocr-output li {
    background: #f8f9fa;
    padding: 6px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
}

.manual-report-btn {
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.9em;
    cursor: pointer;
    font-weight: 600;
    background: #e2e8f0;
    color: var(--text-primary);
    transition: background 0.2s;
}

.manual-report-btn:hover {
    background: #cbd5e1;
}

.station-ocr-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-top: 4px;
}

.station-ocr-meta-pending {
    background: #ffe08a;
    color: #7c4a00;
    padding: 2px 6px;
    border-radius: 999px;
    font-weight: 600;
}

.station-ocr-message {
    margin: 6px 0;
    font-size: 0.85em;
}

.station-ocr-preview {
    margin-top: 6px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #dbe2ef;
}

.station-ocr-preview img {
    width: 100%;
    display: block;
}

.station-ocr-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.confirm-all-btn,
.clear-ocr-btn {
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85em;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.confirm-all-btn {
    background: var(--primary-color);
    color: #fff;
}

.confirm-all-btn:hover {
    background: #163055;
}

.clear-ocr-btn {
    background: #e2e8f0;
    color: var(--text-primary);
}

.clear-ocr-btn:hover {
    background: #cbd5e1;
}

.ocr-success-badge {
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #2ecc71;
    color: #fff;
    font-size: 0.75em;
    font-weight: 600;
}

.ocr-error-text {
    margin-left: 8px;
    color: #c0392b;
    font-size: 0.85em;
}

.ocr-pending-text {
    margin-left: 8px;
    color: var(--text-secondary);
    font-size: 0.85em;
    font-style: italic;
}

.ocr-pending-badge {
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #ffe08a;
    color: #7c4a00;
    font-size: 0.75em;
    font-weight: 600;
}

.ocr-warning-badge {
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #ffb347;
    color: #5c3300;
    font-size: 0.75em;
    font-weight: 600;
}

.ocr-warning-hint {
    margin-top: 4px;
    font-size: 0.75em;
    color: #5c3300;
}

.station-ocr-status {
    margin-top: 6px;
    font-size: 0.85em;
    color: var(--text-secondary);
}

.station-ocr-status .error {
    color: #c0392b;
}

#list-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 5px 0 0 0;
    background: #fff;
    padding: var(--spacing-sm) 0; /* Balanced vertical padding */
    border-bottom: 2px solid #e9ecef;
}

#list-controls h2 {
    margin: 0;
    font-size: 1.2em;
    color: #1e3c72;
    font-weight: 600;
    line-height: 1.2;
}

#sort-select {
    padding: 6px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9em;
    line-height: 1.2;
    cursor: pointer;
    background-color: #fff;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

#sort-select:hover {
    border-color: var(--primary-color);
}

#sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.1);
}

#list-search-container {
    padding: 10px 0 0 0; /* Padding around search input (removed bottom) */
    background: #fff;
    margin-bottom: 0; /* Removed bottom margin */
}

#search-list-input {
    width: calc(100% - 10px); /* Full width minus some padding */
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    font-size: 0.95em;
    margin: 0 5px; /* Center it a bit if calc(100% - 10px) */
    transition: border-color 0.3s;
}
#search-list-input:focus {
    outline: none;
    border-color: #1e3c72;
    box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.1);
}

#list-loader {
    text-align: center;
    padding: 10px;
    color: #777;
    font-style: italic;
    display: none; /* Hidden by default, JS will toggle */
}

#list-loader.visible {
    display: block;
}

/* NEW Styles for Price Grid in List */
.station-list-prices-block.price-grid {
    display: grid;
    grid-template-columns: max-content auto; /* Fuel type name takes its content width, price takes rest */
    gap: 4px 12px; /* Small row gap, larger column gap for spacing between type and price */
    margin-top: 8px;
    margin-bottom: 8px;
    font-size: 0.9em; /* Overall size for price lines */
    background-color: #f8f9fa;
    padding: 8px;
    border-radius: 6px;
}

.fuel-type-column {
    text-align: left;
    color: #555; /* Slightly dimmer color for fuel type name */
}

.price-column {
    text-align: right; /* Align price to the right for neatness */
}

.price-value { /* This class is on the <strong> tag for the price itself */
    font-weight: bold; /* Already bold due to <strong>, but can reinforce */
    font-size: 1.1em;
    color: #007bff; /* Default blue for fuel types without thresholds */
    /* Color is overridden by good-price, medium-price, high-price classes */
}

#list-view {
    list-style: none;
    padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-lg) var(--spacing-sm); /* Add top/side padding so cards clear scrollbar */
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden; /* Avoid horizontal scrollbar when hovering list items */
    box-sizing: border-box;
}

.station-card {
    background: #fff;
    border: 1px solid #e6eaf2;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    list-style: none;
    margin-right: var(--spacing-sm); /* keep right edge away from scrollbar */
}

.station-card.selected-station {
    border-color: var(--primary-color);
    box-shadow: 0 6px 24px rgba(30, 60, 114, 0.2);
}

.popup-station-card {
    box-shadow: none;
    border-color: #dce2ee;
    margin: 0 auto 12px auto;
    max-width: 360px;
    width: 100%;
    box-sizing: border-box;
}

.station-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
}
.popup-station-card:hover {
    transform: none;
    box-shadow: none;
}

.station-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 2px;
    align-items: flex-start;
}

.station-card-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.station-meta-compact {
    gap: 8px;
    font-size: 0.8em;
    align-items: center;
}

.station-meta-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.station-card-distance {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.station-extra-info {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 12px;
    margin: 8px 0 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f8fafc;
}

.station-extra-row {
    display: flex;
    gap: 8px;
    font-size: 0.85em;
}

.station-extra-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 64px;
}

.station-extra-value {
    color: var(--text-primary);
    flex: 1;
}

.leaflet-popup-close-button {
    top: 10px;
    right: 10px;
}

.station-name {
    font-weight: 600;
    font-size: 1.05em;
    color: var(--text-primary);
}

.station-meta-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 0.85em;
    color: var(--text-secondary);
}

.station-meta-secondary {
    margin-top: 2px;
}

.station-brand-pill {
    background: rgba(30, 60, 114, 0.08);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}

.station-location {
    font-style: italic;
}

.station-locality-precision {
    background: rgba(79, 70, 229, 0.12);
    color: #4c1d95;
    padding: 1px 8px;
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.7em;
}

.price-freshness-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.price-freshness-badge.fresh {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.price-freshness-badge.stale {
    background: rgba(251, 191, 36, 0.18);
    color: #92400e;
}

.price-freshness-badge.no-data {
    background: rgba(148, 163, 184, 0.3);
    color: #334155;
}

.station-card .station-address {
    display: block;
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.station-card-no-prices {
    background: #fdf2f2;
    color: #c53030;
    padding: 8px;
    border-radius: 6px;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.station-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    justify-content: space-between;
    align-items: stretch;
}

.station-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    border-radius: 999px;
    padding: 10px 16px;
    border: none;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    flex: 1 1 150px;
    min-width: 0;
    text-align: center;
}

.station-card-actions .scan-price-btn {
    flex: 2 1 55%;
    min-width: 180px;
}

.station-card-actions .manual-report-btn {
    flex: 1 1 35%;
    min-width: 140px;
}

.station-action-btn .btn-icon {
    font-size: 1.1em;
}

.station-action-btn.cta-stale {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 10px 20px rgba(30, 60, 114, 0.18);
}

.station-action-btn.cta-stale:hover {
    background: #163055;
}

.station-action-btn.cta-urgent {
    background: #f97316;
    color: #fff;
    box-shadow: 0 12px 24px rgba(249, 115, 22, 0.35);
}

.station-action-btn.cta-urgent:hover {
    background: #ea580c;
}

.station-action-btn.cta-fresh {
    background: transparent;
    color: var(--primary-color);
    border: 1.5px solid rgba(30, 60, 114, 0.4);
    box-shadow: none;
    padding: 8px 14px;
}

.station-action-btn.cta-fresh:hover {
    border-color: var(--primary-color);
    color: var(--primary-dark);
}

.secondary-action-btn {
    background: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid #d8dee9;
    flex: 1 1 150px;
}

.secondary-action-btn:hover {
    background: #e2e8f0;
}

.station-card .station-ocr-output {
    border-top: 1px dashed #e2e8f0;
    margin-top: 12px;
    padding-top: 8px;
}

.station-price-group {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.station-price-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.93em;
    padding: 4px 0;
    align-items: flex-start;
}

.station-price-row:not(:last-child) {
    border-bottom: 1px dashed #e2e8f0;
}

.station-price-row.price-row-urgent:not(:last-child),
.station-price-row.price-row-stale:not(:last-child) {
    border-bottom: none;
}

.station-price-row.price-row-urgent {
    background: rgba(239, 68, 68, 0.08);
    border-radius: 8px;
    border-left: 3px solid #dc2626;
    padding-left: 8px;
}

.station-price-row.price-row-stale {
    background: rgba(249, 115, 22, 0.08);
    border-radius: 8px;
    border-left: 3px solid #f97316;
    padding-left: 8px;
}

.fuel-type-label {
    font-weight: 600;
    color: var(--text-primary);
}

.price-value-block {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    padding-right: 10px;
}

.price-value-block strong {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.price-stale-indicator {
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
}

.price-stale-indicator[data-status="urgent"] {
    color: #b91c1c;
}

.price-stale-indicator[data-status="stale"] {
    color: #b45309;
}

.price-warning-icon {
    color: #dc2626;
    font-weight: 700;
    margin-left: 4px;
    display: inline-flex;
}


.station-distance-badge {
    background: rgba(30, 60, 114, 0.08);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Loader Styles */
#loader {
    position: fixed; /* Or absolute relative to body */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px 30px;
    border-radius: 5px;
    z-index: 10000; /* Ensure it's on top */
    font-size: 1.2em;
    display: none; /* Hidden by default */
}
#loader.visible {
    display: block;
}

/* Error message styling */
#api-error {
    color: red;
    text-align: center;
    padding: 5px;
    background-color: #ffe0e0;
    border-bottom: 1px solid red;
    /* Removed margin-bottom, let layout handle spacing */
}
#api-error:empty {
    display: none; /* Hide if empty */
}

/* Leaflet Popup Adjustments */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
    padding: 12px 14px 14px;
    max-width: min(380px, calc(100vw - 32px));
    width: auto;
    box-sizing: border-box;
}
.leaflet-popup-content {
    margin: 0;
    font-size: 0.95em;
    line-height: 1.4;
    min-width: 0;
    max-width: none;
    width: 100%;
    padding: 0;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
}

.popup-container {
    overflow-y: auto;
    width: 100%;
    max-width: 352px;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

.leaflet-popup-content .popup-container {
    padding: 4px 4px 8px;
}

/* Popup structure */
.popup-header {
    padding: 12px 15px;
    background-color: var(--light-bg);
    border-bottom: 1px solid var(--border-color);
}

.popup-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: var(--primary-color);
    font-weight: 600;
}

.popup-header .brand-info {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-top: 2px;
}

.popup-body {
    padding: 12px 15px;
}

.popup-address {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 0.9em;
}

.popup-amenities {
    margin: 10px 0;
    padding: 8px;
    background-color: var(--light-bg);
    border-radius: 4px;
    font-size: 0.85em;
}

.popup-amenities strong {
    display: block;
    margin-bottom: 4px;
    color: var(--primary-color);
}

.popup-prices {
    margin: 12px 0;
}

.popup-prices h3 {
    margin: 0 0 8px 0;
    font-size: 0.95em;
    color: var(--primary-color);
    font-weight: 600;
}

.price-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.price-fuel-type {
    font-weight: 500;
    color: var(--text-primary);
}

.price-value {
    font-weight: 600;
    font-size: 1.05em;
}

.price-value.good-price {
    color: var(--success-color);
}

.price-value.medium-price {
    color: #fd7e14;
}

.price-value.high-price {
    color: var(--danger-color);
}

.price-value-muted {
    color: #475569 !important;
}

.price-age {
    font-size: 0.75em;
    color: var(--text-secondary);
    font-style: italic;
}

.price-age-urgent {
    color: #b91c1c;
    font-weight: 700;
    font-style: normal;
}

.price-age-stale {
    color: #b45309;
    font-weight: 600;
    font-style: normal;
}

/* Mobile toggle buttons */
.mobile-toggle-buttons {
    display: none;
    background-color: #fff;
    padding: 10px;
    text-align: center;
    border-top: 2px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
}

.toggle-btn {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 24px;
    margin: 0 5px;
    border-radius: 25px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.toggle-btn:hover:not(.active) {
    background-color: rgba(30, 60, 114, 0.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    html, body {
        height: 100%;
        height: 100dvh; /* Use dynamic viewport height */
        overflow: hidden; /* Prevent body scroll */
        padding-bottom: 0; /* Remove padding */
    }

    h1 {
        font-size: 1.4em;
        padding: 12px 0;
        flex-shrink: 0; /* Prevent header from shrinking */
    }

    .mobile-toggle-buttons {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        justify-content: center;
        gap: 12px;
        padding: 12px 16px;
        border-top: 2px solid var(--border-color);
        border-bottom: none;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
        z-index: 1200;
        box-sizing: border-box; /* Include padding in width */
        height: 70px; /* Fixed height for calculations */
        background-color: #fff;
    }
    
    #brand-filter {
        position: static;
    }

    .container {
        flex-direction: column;
        display: flex;
        flex: 1; /* Take remaining space */
        height: auto;
        min-height: 0;
        padding-bottom: 70px; /* Reserve space for fixed footer buttons */
        overflow: hidden;
    }
    
    #map,
    .sidebar {
        width: 100%;
        height: 100%;
        border-right: none;
        display: none; /* Hidden by default */
    }
    
    /* Toggle visibility logic */
    .container:not(.show-list) #map,
    .container.show-map #map {
        display: block;
        flex: 1; /* Take all available space */
    }
    
    .container.show-list .sidebar {
        display: flex; /* Sidebar is flex container */
        flex: 1; /* Take all available space */
        background: #fff;
        flex-direction: column;
        overflow: hidden; /* Internal scrolling only */
    }
    
    .container.show-list #station-list {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex-grow: 1;
        height: auto;
    }
    
    /* Larger touch targets for mobile */
    #list-view li {
        padding: 18px 12px;
        margin-bottom: 8px;
    }
    
    input[type="checkbox"] {
        width: 22px;
        height: 22px;
        margin-right: 12px;
    }
    
    #brand-checkboxes label {
        padding: 8px 10px;
        margin-bottom: 10px;
    }
    
    .form-group button[type="submit"] {
        padding: 16px 24px;
        font-size: 1.2em;
    }
    
    #locate-me-btn {
        width: 34px;
        height: 34px;
        padding: 0;
        top: 75px; /* Position it below the zoom controls on mobile */
    }
    
    #locate-me-btn img {
        width: 18px;
        height: 18px;
    }
    
    .map-legend {
        /* Move to top-right on mobile to avoid Safari's bottom toolbar */
        top: 10px !important;
        bottom: auto !important;
        right: 10px !important;
        font-size: 0.8em;
        padding: 8px 12px !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        display: inline-block !important;
        width: auto !important;
    }

    /* Constrain popup height on mobile to keep marker in view */
    .popup-container {
        max-height: calc(100dvh - 215px);
    }
    
    /* Improve modal on mobile */
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 20px;
        max-height: 90dvh; /* Prevent modal being taller than screen */
        overflow-y: auto; /* Scroll inside modal if needed */
    }
    
    /* Larger input fields for mobile */
    .form-group input[type="number"],
    .form-group select {
        padding: 14px;
        font-size: 1.1em;
    }
    
    #search-list-input {
        padding: 12px 16px;
        font-size: 1em;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: #fff;
    padding: var(--spacing-xl);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 400px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.visible .modal-content {
    transform: translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: var(--light-bg);
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background-color: #e2e8f0;
    color: var(--text-primary);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: var(--spacing-xs);
    font-size: 1.5em;
    color: var(--primary-color);
    text-align: left;
}

.modal-subtitle {
    margin-bottom: var(--spacing-lg);
    color: var(--text-secondary);
    font-size: 0.95em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-sm);
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9em;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    box-sizing: border-box;
    font-size: 1.1em;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #fff;
    -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(30, 60, 114, 0.1);
}

.form-hint {
    display: block;
    margin-top: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: 0.8em;
}

.form-actions {
    margin-top: var(--spacing-xl);
}

.form-actions button[type="submit"] {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(30, 60, 114, 0.2);
}

.form-actions button[type="submit"]:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(30, 60, 114, 0.3);
}

.form-actions button[type="submit"]:active {
    transform: translateY(0);
}

.form-actions button[type="submit"]:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.feedback-message {
    margin-top: var(--spacing-md);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9em;
    text-align: center;
    display: none;
}

.feedback-message.visible {
    display: block;
}

.feedback-message.success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.feedback-message.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Toast System */
.toast-container {
    position: fixed;
    bottom: 90px; /* Above mobile footer */
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 90%;
    max-width: 350px;
    pointer-events: none;
}

.toast {
    background: #333;
    color: #fff;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.95em;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

.hidden {
    display: none !important;
}

/* Additional UI improvements */
:root {
    --primary-color: #1e3c72;
    --primary-dark: #16304f;
    --secondary-color: #FFC107;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --border-color: #e9ecef;
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    
    /* Spacing system based on 8px grid */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --spacing-3xl: 64px;
    --spacing-4xl: 80px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

.leaflet-control-zoom {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ced4da;
}

/* Improve checkbox styling */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-right: 10px;
    accent-color: var(--primary-color);
}

/* Price age indicator styling */
.price-age {
    font-size: 0.8em;
    color: var(--text-secondary);
    font-style: italic;
}

/* Loading state improvements */
#loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.95);
    color: var(--primary-color);
    padding: 20px 40px;
    border-radius: 12px;
    z-index: 10000;
    font-size: 1.1em;
    display: none;
    box-shadow: var(--shadow-lg);
    font-weight: 500;
}

/* Custom price marker styles */
.custom-price-marker {
    background: transparent;
    border: none;
}

.marker-pin {
    width: 30px;
    height: 30px;
    position: relative;
    background: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

/* Add pin point using pseudo-element */
.marker-pin::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 12px solid #333;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.marker-pin:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.marker-pin.green {
    background: linear-gradient(180deg, #28a745 0%, #218838 100%);
}
.marker-pin.green::after {
    border-top-color: #218838;
}

.marker-pin.orange {
    background: linear-gradient(180deg, #fd7e14 0%, #dc6502 100%);
}
.marker-pin.orange::after {
    border-top-color: #dc6502;
}

.marker-pin.red {
    background: linear-gradient(180deg, #dc3545 0%, #c82333 100%);
}
.marker-pin.red::after {
    border-top-color: #c82333;
}

.marker-pin.blue {
    background: linear-gradient(180deg, #007bff 0%, #0056b3 100%);
}
.marker-pin.blue::after {
    border-top-color: #0056b3;
}

.marker-pin.gray {
    background: linear-gradient(180deg, #6c757d 0%, #545b62 100%);
}
.marker-pin.gray::after {
    border-top-color: #545b62;
}

.marker-icon {
    font-size: 14px;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    line-height: 1;
    display: block;
}

/* Cluster customization - logical color progression */
.marker-cluster-small {
    background-color: rgba(40, 167, 69, 0.6); /* Green - few stations */
}
.marker-cluster-small div {
    background-color: rgba(40, 167, 69, 0.8);
}

.marker-cluster-medium {
    background-color: rgba(253, 126, 20, 0.6); /* Orange - moderate density */
}
.marker-cluster-medium div {
    background-color: rgba(253, 126, 20, 0.8);
}

.marker-cluster-large {
    background-color: rgba(220, 53, 69, 0.6); /* Red - high density */
}
.marker-cluster-large div {
    background-color: rgba(220, 53, 69, 0.8);
}

/* Map legend styling */
.map-legend {
    position: absolute;
    bottom: 20px;
    right: 10px;
    background: white;
    border-radius: 8px;
    padding: 10px 15px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    font-size: 0.9em;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.map-legend h2 {
    margin: 0 0 10px 0;
    font-size: 1em;
    font-weight: 600;
    color: var(--primary-color);
}

.legend-meta {
    margin: 0 0 10px 0;
    font-size: 0.8em;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

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

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    margin-right: 10px;
    display: inline-block;
}

.legend-color.green {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
}

.legend-color.orange {
    background: linear-gradient(135deg, #fd7e14 0%, #dc6502 100%);
}

.legend-color.red {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.legend-color.blue {
    background: linear-gradient(135deg, #2b6cb0 0%, #2c5282 100%);
}

.legend-color.gray {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
}


