:root {
    --primary-color: #1a73e8;
    --secondary-color: #4285f4;
    --background-light: #f4f4f4;
    --text-dark: #333;
    --text-light: #ffffff;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--background-light) !important; /* Force light background */
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

header {
    background-color: var(--primary-color) !important; /* Force primary color */
    color: var(--text-light);
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    text-align: left;
}

header nav a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 1rem;
}

header nav a.header-nav-link {
    margin-right: 1rem;
}

header nav a:hover {
    text-decoration: underline;
}

#main-container {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 68px); /* Subtract header height */
    position: relative;
    overflow: hidden;
    /* Ensure this is positioned above scroll-content */
    z-index: 10;
}

#map-container {
    flex: 2;
    position: relative;
    height: 100%;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#restaurant-list-container {
    flex: 1;
    background-color: var(--text-light);
    padding: 1rem;
    box-shadow: -2px 0 4px rgba(0,0,0,0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 400px;
}

#continent-country-filter, #city-filter, #cuisine-filter {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Hide search and sort controls until they can be fixed */
#search-container,
#sort-container {
    display: none;
}

#restaurant-search {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#search-button, #clear-search {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#clear-search {
    background-color: #6c757d;
}

#search-button:hover, #clear-search:hover {
    opacity: 0.9;
}

#sort-container {
    display: none; /* Hidden as we've moved it to the toolbar */
}

/* Sort control styling */
#sort-control {
    position: relative;
    display: flex;
    align-items: center;
}

/* Welcome Section */
#welcome-section {
    margin: 2rem 0;
    padding: 2rem;
    background: linear-gradient(135deg, #007acc 0%, #005588 100%);
    border-radius: 12px;
    color: white;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 122, 204, 0.2);
}

.welcome-content h3 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.welcome-content p {
    margin: 0 0 1rem 0;
    opacity: 0.9;
}

.welcome-instructions {
    font-weight: 500;
    margin-bottom: 0.5rem !important;
}

.welcome-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.welcome-steps li {
    padding: 0.5rem 0;
    opacity: 0.9;
}

.welcome-steps li:before {
    content: "→";
    margin-right: 0.5rem;
    font-weight: bold;
}

#welcome-geolocate {
    background: white;
    color: #007acc;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#welcome-geolocate:hover {
    background: #f0f8ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

#welcome-geolocate:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#welcome-geolocate svg {
    flex-shrink: 0;
}

#restaurants {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.no-results {
    padding: 1rem;
    text-align: center;
    color: #666;
    font-style: italic;
}

.search-highlight {
    background-color: rgba(255, 255, 0, 0.3);
    font-weight: bold;
}

#restaurants li {
    background-color: var(--background-light);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    will-change: transform;
    backface-visibility: hidden;
}

#restaurants li:hover {
    background-color: #e8f0fe;
    color: var(--text-dark);
}

#restaurants li.highlighted {
    background-color: var(--primary-color);
    color: var(--text-light);
    border-left: 4px solid #ffab00;
}

#restaurants li:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.merchant-link {
    font-size: 0.8rem;
    padding: 4px 8px;
    color: white;
    border-radius: 4px;
    text-decoration: none;
}

.website-link {
    background-color: var(--secondary-color);
}

.directions-link {
    background-color: #4caf50;
}

#loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
    font-family: var(--font-family);
}

#loading-indicator.show {
    display: flex !important;
}

#loading-indicator .loading-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(26, 115, 232, 0.1);
    text-align: center;
    min-width: 300px;
    max-width: 400px;
}

#loading-indicator p {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-dark);
    margin: 1rem 0 0 0;
    text-align: center;
    line-height: 1.4;
}

#loading-indicator .loading-spinner {
    margin: 0;
}

.progress-bar {
    width: 300px;
    max-width: 80vw;
    margin-top: 20px;
    text-align: center;
}

.progress-fill {
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    transition: width 0.3s ease;
    margin-bottom: 10px;
}

.progress-text {
    font-size: 14px;
    color: var(--text-dark);
    font-weight: 500;
}

/* Toast notifications for geolocation */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 300px;
    max-width: 400px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease-out;
    backdrop-filter: blur(10px);
}

.toast.success {
    background: linear-gradient(135deg, #4caf50, #45a049);
    border-left: 4px solid #2e7d32;
}

.toast.error {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    border-left: 4px solid #c62828;
}

.toast.info {
    background: linear-gradient(135deg, var(--primary-color), #1557b0);
    border-left: 4px solid #0d47a1;
}

.toast.warning {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    border-left: 4px solid #ef6c00;
    color: #333;
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.toast-content {
    flex: 1;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.slide-out {
    animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Mobile responsive toast */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
        width: 100%;
    }
}

/* Scroll content appears below the map */
#scroll-content {
    background-color: var(--text-light);
    position: relative;
    z-index: 1;
}

#about {
    padding: 2rem;
    background-color: var(--background-light);
    border-top: 1px solid #ddd;
}

#about h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

#about p {
    font-size: 1rem;
    line-height: 1.6;
    max-width: 1200px;
    margin: 0 auto;
}

#about p.about-paragraph {
    margin-top: 1rem;
}

footer {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 2rem;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

footer > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

p.footer-copyright {
    text-align: left;
}

div.footer-disclaimer {
    margin: 20px auto;
    font-size: 12px;
    width: 80%;
    text-align: center;
}

a.footer-amex-link {
    font-size: 12px;
}

footer p {
    text-align: left;
}

footer a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 1rem;
}

footer a:hover {
    text-decoration: underline;
}

#geolocate-button {
    position: relative;
    bottom: auto;
    right: auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: white;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: background-color 0.2s;
}

#geolocate-button:hover {
    background-color: #f1f1f1;
}

#geolocate-button svg {
    width: 16px;
    height: 16px;
    color: var(--primary-color);
}

.distance {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 12px;
    margin-left: 10px;
    vertical-align: middle;
    will-change: transform;
    backface-visibility: hidden;
}

.distance::before {
    content: "Distance: ";
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Reset button is now styled in the filter-toolbar section */

.info-message {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Filter toolbar with enhanced location functionality */
#filter-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

/* Button styles for icon buttons */
#filter-toolbar button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background-color: white;
    color: var(--primary-color);
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    will-change: transform;
    backface-visibility: hidden;
}

#filter-toolbar button:hover {
    background-color: var(--secondary-color);
    color: white;
}

/* Reset button specific style */
#reset-all-filters {
    background-color: white;
    color: #ff5722;
}

#reset-all-filters:hover {
    background-color: #ff5722;
    color: white;
}

/* Sort control styling */
#sort-control {
    position: relative;
    display: flex;
    align-items: center;
}

#sort-control label {
    position: absolute;
    left: 8px;
    color: var(--primary-color);
    pointer-events: none;
    z-index: 1;
}

#sort-control select {
    padding-left: 28px;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    color: var(--text-dark);
    font-size: 0.9rem;
    height: 36px;
}

/* Update z-index and transition for all buttons in toolbar */
#filter-toolbar button svg {
    width: 16px;
    height: 16px;
}

/* Screen reader only class for accessibility */
.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;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    transition: top 0.3s;
    z-index: 10000;
}

.skip-link:focus {
    top: 6px;
}

/* Loading spinner for better UX */
.loading-spinner {
    border: 3px solid var(--background-light);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 10px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Focus styles for better accessibility */
button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000080;
        --secondary-color: #000060;
        --background-light: #ffffff;
        --text-dark: #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: var(--primary-color);
    }
    
    html {
        scroll-behavior: auto;
    }
}

@media (max-width: 768px) {
    /* Mobile-first layout - prevent overlap with scroll content */
    body {
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    #main-container {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important; /* Let content determine height */
        min-height: calc(100vh - 68px) !important;
        overflow: visible !important;
        position: relative !important;
        z-index: 10 !important;
    }

    #map-container {
        position: relative !important;
        height: 300px !important; /* Fixed height for map visibility */
        min-height: 300px !important; /* Ensure minimum height */
        width: 100% !important;
        flex-shrink: 0 !important; /* Prevent shrinking */
        overflow: hidden !important;
        margin: 0 !important;
        display: block !important; /* Always display */
        visibility: visible !important; /* Force visibility */
    }
    
    #map {
        position: relative !important; /* Changed from absolute to relative */
        width: 100% !important;
        height: 300px !important; /* Match container height */
        min-height: 300px !important;
        display: block !important;
    }

    #restaurant-list-container {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 1rem !important;
        background-color: white !important;
        overflow: visible !important;
        box-shadow: none !important;
    }
    
    /* Scrollable restaurant list */
    #restaurants {
        display: block !important;
        height: auto !important;
        max-height: 60vh !important; /* Limit height to 60% of viewport */
        overflow-y: auto !important;
        overflow-x: hidden !important;
        background-color: transparent !important;
        padding: 0 !important;
        margin-top: 0.5rem !important;
        -webkit-overflow-scrolling: touch !important;
        flex: 1 !important;
        min-height: 200px !important; /* Ensure minimum height */
    }
    
    /* Restaurant card styling for mobile */
    #restaurants li {
        background-color: var(--background-light) !important;
        border: none !important;
        border-radius: 8px !important;
        margin-bottom: 10px !important;
        padding: 12px !important;
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
        cursor: pointer !important;
        transition: background-color 0.2s ease !important;
    }
    
    #restaurants li:hover,
    #restaurants li:active {
        background-color: #e8f0fe !important;
        color: var(--text-dark) !important;
    }
    
    #restaurants li.highlighted {
        background-color: var(--primary-color) !important;
        color: var(--text-light) !important;
        border-left: 4px solid #ffab00 !important;
    }
    
    /* Ensure scroll-content appears below main-container */
    #scroll-content {
        position: relative !important;
        z-index: 1 !important;
        margin-top: 0 !important;
        clear: both !important;
    }
    
    header div {
        flex-direction: column;
        align-items: flex-start;
    }
    
    header h1 {
        font-size: 1.3rem;
        margin-bottom: 0.5rem;
    }
    
    header nav {
        display: flex;
        gap: 1rem;
    }
    
    /* Mobile filter and search styling */
    #search-container {
        flex-wrap: wrap;
        margin-bottom: 0.75rem;
    }
    
    #restaurant-search {
        flex: 1 1 100%;
        margin-bottom: 8px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    #search-button, #clear-search {
        flex: 1;
        padding: 10px;
        font-size: 14px;
    }
    
    /* Mobile select dropdowns */
    #continent-country-filter,
    #city-filter,
    #cuisine-filter {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px;
        margin-bottom: 0.75rem;
    }
    
    /* Mobile toolbar adjustments */
    #filter-toolbar {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    #filter-toolbar button {
        min-width: 42px;
        min-height: 42px;
    }

    .view-toggle {
        display: flex;
        justify-content: center;
        margin-bottom: 1rem;
    }

    .view-toggle button {
        padding: 0.5rem 1rem;
        margin: 0 0.5rem;
        border: none;
        background-color: var(--primary-color);
        color: var(--text-light);
        border-radius: 4px;
        cursor: pointer;
    }

    .view-toggle button.active {
        background-color: var(--secondary-color);
    }
}

/* Mobile-first responsive optimizations */
.mobile-optimized {
    touch-action: manipulation;
}

.mobile-optimized * {
    -webkit-tap-highlight-color: transparent;
}

/* Mobile filter optimizations */
.mobile-filters {
    position: relative;
    overflow: hidden;
}

.filter-toggle {
    display: none;
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: var(--text-light);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.filter-toggle:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

.filter-toggle:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .filter-toggle {
        display: block;
    }
    
    .mobile-filters > *:not(.filter-toggle) {
        display: none;
    }
    
    .mobile-filters.expanded > *:not(.filter-toggle) {
        display: block;
        animation: slideDown 0.3s ease;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced error handling styles */
.error-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    padding: 2rem;
    max-width: 400px;
    width: 90vw;
    z-index: 10001;
    text-align: center;
}

.error-message h3 {
    color: #d93025;
    margin-bottom: 1rem;
}

.error-message p {
    margin-bottom: 1rem;
    line-height: 1.5;
}

.retry-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.retry-button:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

.retry-button:active {
    transform: translateY(0);
}

details {
    margin-top: 1rem;
    text-align: left;
}

summary {
    cursor: pointer;
    font-weight: 600;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 8px;
}

summary:hover {
    background: #e8f0fe;
}

/* Performance optimizations */
.info-window-content {
    max-width: 300px;
    padding: 12px;
}

.info-window-content h3 {
    margin-bottom: 8px;
    color: var(--primary-color);
    font-size: 16px;
}

.info-window-content p {
    margin-bottom: 6px;
    font-size: 14px;
    line-height: 1.4;
}

.info-window-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.info-window-content a:hover {
    text-decoration: underline;
}

/* Enhanced mobile responsiveness */
@media (max-width: 480px) {
    header {
        padding: 0.5rem;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    .container {
        padding: 0.5rem;
    }
    
    .sidebar {
        padding: 1rem 0.5rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    select, input, button {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px;
        min-height: 44px; /* Better touch target */
    }
    
    #map {
        min-height: 50vh;
    }
    
    .restaurant-list {
        max-height: 40vh;
    }
    
    .restaurant-list li {
        padding: 1rem 0.5rem;
        border-radius: 8px;
        margin-bottom: 8px;
    }
    
    /* Welcome section mobile improvements */
    #welcome {
        padding: 1.5rem 0.75rem;
        margin-top: 1rem;
    }
    
    #welcome h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    #welcome p {
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 1rem;
    }
    
    #welcome button {
        width: 100%;
        max-width: 300px;
        margin: 0.5rem auto;
        display: block;
    }
    
    /* About section and footer mobile improvements */
    #about {
        padding: 1.5rem 0.75rem;
    }
    
    #about h2 {
        font-size: 1.3rem;
    }
    
    #about p {
        font-size: 0.9rem;
    }
    
    footer {
        padding: 1.5rem 0.75rem;
    }
    
    footer > div:first-child {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    p.footer-copyright {
        text-align: center;
    }
    
    footer p {
        text-align: center;
    }
    
    div.footer-disclaimer {
        width: 95%;
        font-size: 11px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    button, select, input {
        min-height: 48px;
        padding: 14px;
    }
    
    .restaurant-list li {
        min-height: 60px;
        padding: 16px;
    }
    
    .restaurant-list li:active {
        background-color: rgba(26, 115, 232, 0.1);
        transform: scale(0.98);
        transition: all 0.1s ease;
    }
}

/* Landscape orientation optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .main-content {
        flex-direction: row;
    }
    
    .sidebar {
        width: 300px;
        min-width: 300px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }
    
    .content {
        flex: 1;
    }
    
    #map {
        height: calc(100vh - 120px);
    }
    
    .restaurant-list {
        max-height: 200px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0066cc;
        --secondary-color: #004499;
        --background-light: #ffffff;
        --text-dark: #000000;
    }
    
    .highlighted {
        outline: 3px solid #ff6600 !important;
        outline-offset: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .loading-spinner {
        animation: none;
    }
    
    .loading-spinner::after {
        content: "Loading...";
        display: block;
        text-align: center;
        font-weight: 600;
    }
}

/* GPU acceleration for smooth animations */
.highlighted,
.restaurant-list li,
.retry-button,
.filter-toggle {
    will-change: transform;
    transform: translateZ(0);
}

/* Optimized transitions */
.restaurant-list li {
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.highlighted {
    background-color: var(--primary-color) !important;
    border-left: 4px solid #ffab00;
    transform: translateX(4px);
    color: var(--text-light);
}

/* Performance monitoring styles */
.performance-indicator {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.performance-indicator.visible {
    opacity: 1;
}

/* Mobile-only utilities */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* Print styles for better printing */
@media print {
    header, footer, 
    #filter-toolbar,
    #search-container,
    .merchant-link {
        display: none !important;
    }
    
    #main-container {
        flex-direction: column;
        height: auto;
    }
    
    #map-container {
        height: 400px;
        page-break-inside: avoid;
    }
    
    #restaurant-list-container {
        max-width: 100%;
        height: auto;
        max-height: none;
        box-shadow: none;
    }
    
    #restaurants li {
        page-break-inside: avoid;
        margin-bottom: 10px;
        padding: 10px;
        border: 1px solid #ccc;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}

/* Content visibility optimization */
.offscreen {
    content-visibility: auto;
    contain-intrinsic-size: 200px;
}

/* Container queries support (future-proofing) */
@supports (container-type: inline-size) {
    .restaurant-list-container {
        container-type: inline-size;
    }
}

/* Memory management hints */
.marker-element {
    will-change: transform;
    contain: layout style paint;
}

/* Grid fallback for older browsers */
@supports not (display: grid) {
    .fallback-flex {
        display: flex;
        flex-wrap: wrap;
    }
}

/* Location Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
    position: relative;
}

.modal-header {
    padding: 2rem 2rem 1rem 2rem;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.modal-header p {
    color: #666;
    font-size: 0.95rem;
}

.modal-body {
    padding: 2rem;
}

.location-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.location-option-btn {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: 1rem;
    width: 100%;
}

.location-option-btn:hover {
    border-color: var(--primary-color);
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.15);
}

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

.location-option-btn.primary:hover {
    background: #1557b0;
    border-color: #1557b0;
}

.location-option-btn svg {
    margin-right: 1rem;
    flex-shrink: 0;
}

.location-option-btn span {
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

.location-option-btn small {
    font-weight: normal;
    opacity: 0.8;
    font-size: 0.85rem;
    display: block;
}

.location-option-btn.primary small {
    opacity: 0.9;
}

.address-form {
    margin-top: 1rem;
    animation: slideDown 0.3s ease-out;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input {
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.btn.primary:hover {
    background: #1557b0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

.btn.secondary {
    background: #f8f9fa;
    color: var(--text-dark);
    border: 1px solid #e1e5e9;
}

.btn.secondary:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

.btn.text {
    background: transparent;
    color: #666;
    text-decoration: underline;
    padding: 0.5rem;
}

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

.modal-footer {
    padding: 1rem 2rem 2rem 2rem;
    text-align: center;
    border-top: 1px solid #eee;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile responsive adjustments for modal */
@media (max-width: 768px) {
    .modal-content {
        margin: 1rem;
        border-radius: 8px;
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    
    .location-option-btn {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
    }
    
    .location-option-btn svg {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

/* Accessibility improvements */
.modal[aria-hidden="true"] {
    display: none;
}

.location-option-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Welcome message styling */
.info-message {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin: 1rem 0;
    list-style: none !important;
}

.info-message h3 {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.info-message p {
    color: #495057;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.info-message strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Location status indicator */
.location-status {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #28a745;
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.location-status.error {
    background-color: #dc3545;
}

.location-status.loading {
    background-color: #ffc107;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Enhanced geolocation button */
#geolocate-button {
    position: relative;
}

#geolocate-button.active {
    background-color: var(--primary-color);
    color: white;
}

#geolocate-button.active svg {
    color: white;
}

#geolocate-button.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Reset menu styles */
.reset-menu {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    padding: 0.5rem;
    min-width: 200px;
    animation: fadeIn 0.2s ease-out;
}

.reset-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.reset-menu-item:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

.reset-menu-item[data-action="clear-cache"]:hover {
    background-color: #fff3e0;
    color: #ff9800;
}

.reset-menu-item[data-action="force-refresh"]:hover {
    background-color: #e8f5e8;
    color: #4caf50;
}

.reset-menu-item svg {
    flex-shrink: 0;
}

/* Directions modal styles */
.directions-modal-content {
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.directions-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.directions-info {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

.directions-info h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.directions-info p {
    color: #666;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.directions-summary {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.directions-summary span {
    padding: 0.25rem 0.5rem;
    background-color: white;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.directions-panel {
    padding: 1rem;
    font-size: 0.9rem;
}

.directions-step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.directions-step:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.directions-step-icon {
    width: 24px;
    height: 24px;
    margin-right: 0.75rem;
    flex-shrink: 0;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}

.directions-step-content {
    flex: 1;
}

.directions-step-instruction {
    font-weight: 500;
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.directions-step-distance {
    font-size: 0.8rem;
    color: #666;
}

.close-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    color: #666;
    transition: all 0.2s ease;
}

.close-button:hover {
    background-color: #f0f0f0;
    color: #333;
}

.close-button svg {
    width: 20px;
    height: 20px;
}

/* Distance display in restaurant list */
.merchant-distance {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
    font-weight: 500;
}

.merchant-distance.nearby {
    color: var(--primary-color);
}

/* Enhanced directions link */
.directions-link {
    background-color: var(--primary-color) !important;
    color: white !important;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.directions-link:hover {
    background-color: #1557b0 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.directions-link svg {
    width: 14px;
    height: 14px;
}

/* Mobile responsiveness for directions modal */
@media (max-width: 768px) {
    .directions-modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        width: calc(100% - 2rem);
    }
    
    .directions-summary {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .directions-step {
        align-items: flex-start;
    }
    
    .directions-step-icon {
        margin-top: 0.1rem;
    }
}