/* Basic Reset & Font */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--line);
}

.modal-header h2 {
    margin: 0;
    color: var(--fg);
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

/* Settings Styles */
.settings-section {
    margin-bottom: 1.5rem;
}

.settings-label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: #333;
}

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

.radius-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.radius-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2c3e50;
    cursor: pointer;
}

.radius-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2c3e50;
    cursor: pointer;
    border: none;
}

.radius-number {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-family: inherit;
}

.radius-info {
    font-size: 0.9rem;
    color: #666;
}

.radius-current {
    display: inline-block;
}

/* Button Styles */
.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #2c3e50;
    color: white;
}

.btn-primary:hover {
    background: #34495e;
}

.btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

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

/* Settings trigger button styling */
.settings-trigger {
    background: none !important;
    border: none !important;
    text-align: left;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}

.settings-trigger:hover {
    background-color: #f8f8f8 !important;
    color: #222 !important;
}

/* City display with radius */
.city-display {
    font-size: 0.9rem;
    color: #666;
    margin-left: 0.5rem;
}

.radius-display-inline {
    font-size: 0.8rem;
    color: #888;
    margin-left: 0.25rem;
}

html {
    /* Modern smooth scrolling */
    scroll-behavior: smooth;
    /* Better scroll performance */
    scroll-padding-top: 2rem;
}

html, body {
    /* Removed height: 100% to make footer non-sticky */
    font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
    color: var(--fg);
    background-color: var(--bg);
}

/* Main Layout Container */
body {
    display: flex;
    flex-direction: column; /* Stacks header, main-wrapper, and footer vertically */
    min-height: 100vh; /* Ensures the body takes full viewport height */
}

/* Header Styling */
.header {
    background-color: var(--bg);
    padding: 1rem 2rem;
    color: var(--fg);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    border-bottom: none;
    box-shadow: none;
}

/* Enhanced sticky header when scrolled */
.header.scrolled {
    background-color: var(--bg);
    border-bottom: none;
    box-shadow: none;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Align items at the top instead of center */
}

.header-left {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
}

.header-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Style for the header title link to maintain its appearance */
.header-title-link {
    text-decoration: none; /* Remove underline */
    color: inherit; /* Inherit color from parent (.header) */
    font-size: 1.4rem;
    font-weight: 400;
}

.header-title-link:hover,
.header-title-link:active {
    color: inherit; /* Keep color the same on hover/active */
    text-decoration: none; /* Keep no underline on hover/active */
}

/* City Display */
.city-display {
    display: none;
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.25rem;
    text-align: center;
    width: 100%;
}

/* Style for the username in the header */
.header p {
    font-size: 0.85rem; /* Smaller font size than the title */
    font-weight: 400; /* Normal weight */
    margin-top: 0.2rem; /* Space between title and username */
    color: var(--muted); /* Slightly lighter color than the title */
}

/* Auth links styling */
.harvest-auth-links {
    font-size: 1rem;
    font-weight: 400;
    display: flex;
    gap: 1rem;
    align-items: center;
    padding-top: 0.7rem; /* Match the navbar padding-top for alignment */
}

.harvest-auth-links a {
    text-decoration: none;
    color: var(--fg);
    transition: color 0.1s ease;
}

.harvest-auth-links a:hover {
    color: var(--accent);
    font-weight: 700;
}

/* User menu dropdown moved to common/css/user_menu.css */

/* Style for the auth placeholder to maintain consistent spacing */
.auth-placeholder {
    visibility: hidden;
    width: 0;
    margin-left: auto;
    display: inline-block;
}


/* Main Content Wrapper */
.main-wrapper {
    flex-grow: 1; /* Takes up all available vertical space, pushing footer to bottom */
    min-height: 0; /* Important for flex-grow to work correctly with scrolling content */
    padding-top: 1rem; /* Add some space between header and content */
}

/* Navbar Styling */
.navbar {
    background-color: var(--bg); /* Themed background */
    display: flex;
    align-items: center;
    padding-top: 0.7rem; /* Increased padding to better align with the title */
}

.navbar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 1.5rem;
}

.navbar li {
    margin: 0;
}

.navbar a {
    display: block;
    padding: 0.3rem 0.5rem;
    color: var(--fg);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.1s ease;
}

.navbar a:hover,
.navbar a.active {
    color: var(--accent);
    font-weight: 700;
}

/* Main Content Area */
.content {
    flex-grow: 1; /* Takes up all available horizontal space */
    padding: 2rem;
    overflow-y: auto; /* Allows content to scroll if it overflows */
}

.content h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--fg);
}

.content p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Footer Styling */
.footer {
    background-color: var(--bg);
    color: var(--muted);
    text-align: center;
    padding: 1.5rem 2rem;
    font-size: 0.9rem;
    margin-top: auto;
    position: relative;
    z-index: 1;
    /* Removed border-top and box-shadow for a more minimalist feel */
}

/* Shared footer social icons (DRY across all pages) */
.footer .social {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 0 0 6px;
}

.footer .social-link {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-decoration: none;
}

.footer .social-link:hover,
.footer .social-link:focus-visible {
    border-color: var(--accent);
    background: rgba(110,231,183,0.08);
    outline: none;
}

.footer .social-link img {
    width: 18px;
    height: 18px;
    display: block;
    /* Ensure icons remain visible against dark footer backgrounds */
    filter: invert(1) brightness(1.2);
}

/* Responsive Design - Media Queries */
@media (max-width: 768px) {
    .header {
        padding: 1rem 1.5rem;
    }
    
    .header-container {
        flex-direction: column;
        gap: 1rem;
        align-items: center; /* Center align items in mobile view */
    }
    
    .header-left {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
        align-items: center;
    }
    
    .navbar {
        padding-top: 0; /* Reset padding for mobile view */
    }
    
    .harvest-auth-links {
        padding-top: 0; /* Reset padding for mobile view */
    }
    
    
    .header-title-link {
        font-size: 1.25rem;
    }
    
    .header p {
        font-size: 0.75rem;
        margin-top: 0.2rem;
    }
    
    .navbar {
        width: 100%;
        justify-content: center;
    }
    
    .navbar ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
    
    .navbar a {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .harvest-auth-links {
        justify-content: center;
    }
    
    /* Mobile adjustments for user menu moved */
    
    .content {
        padding: 1.5rem;
    }
    
    .content h1 {
        font-size: 2rem;
    }
    
    .footer {
        padding: 1rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .navbar ul {
        gap: 0.5rem;
    }
    
    .header p {
        font-size: 0.7rem;
        margin-top: 0.2rem;
    }
    
    .harvest-auth-links {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        padding-top: 0; /* Ensure padding is reset for very small screens */
    }
    
    /* Stack user menu and logout vertically on small screens */
    .harvest-auth-links {
        align-items: stretch;
    }
    
    /* user menu trigger mobile moved */
    
    /* For mobile view, we don't need the placeholder to affect layout */
    .auth-placeholder {
        display: none;
    }
}

/* Cookie Notice Styles - New Design */
.cookie-notice {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1001;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s ease;
    pointer-events: none;
}

.cookie-notice.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.cookie-card {
    max-width: 320px;
    padding: 1rem;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 20px 20px 30px rgba(0, 0, 0, .05);
}

.title {
    font-weight: 600;
    color: rgb(31 41 55);
}

.description {
    margin-top: 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: rgb(75 85 99);
}

.description a {
    --tw-text-opacity: 1;
    color: rgb(59 130 246);
}

.description a:hover {
    -webkit-text-decoration-line: underline;
    text-decoration-line: underline;
}

.actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    -moz-column-gap: 1rem;
    column-gap: 1rem;
    flex-shrink: 0;
}

.pref {
    font-size: 0.75rem;
    line-height: 1rem;
    color: rgb(31 41 55 );
    -webkit-text-decoration-line: underline;
    text-decoration-line: underline;
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    background-color: transparent;
}

.pref:hover {
    color: rgb(156 163 175);
}

.pref:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.accept {
    font-size: 0.75rem;
    line-height: 1rem;
    background-color: rgb(17 24 39);
    font-weight: 500;
    border-radius: 0.5rem;
    color: #fff;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    border: none;
    transition: all .15s cubic-bezier(0.4, 0, 0.2, 1);
}

.accept:hover {
    background-color: rgb(55 65 81);
}

.accept:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* Responsive Cookie Notice */
@media (max-width: 480px) {
    .cookie-notice {
        left: 15px;
        right: 15px;
        bottom: 15px;
    }
    
    .cookie-card {
        max-width: none;
        padding: 0.85rem;
    }
    
    .description {
        font-size: 0.75rem;
    }
    
    .actions {
        flex-direction: column;
        gap: 0.4rem;
    }
    
    .pref, .accept {
        width: 100%;
        text-align: center;
    }
}

/* Non-Sticky Header Alternative */
.header.non-sticky {
    position: static;
    background-color: #f8f8f8;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    box-shadow: none;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    pointer-events: none;
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.back-to-top:hover {
    background-color: #34495e;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.4);
}

/* Improved scroll container hierarchy */
.main-wrapper {
    flex-grow: 1;
    min-height: 0;
    padding-top: 1rem;
    /* Remove any conflicting scroll properties */
}

.content {
    flex-grow: 1;
    padding: 2rem;
    /* Let the browser handle the scrolling naturally */
    overflow-y: visible;
}

/* Scroll performance improvements */
* {
    /* Better scroll performance on mobile */
    -webkit-overflow-scrolling: touch;
}

/* Focus management for accessibility */
:focus {
    outline: 2px solid #2c3e50;
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid #2c3e50;
    outline-offset: 2px;
}

/* Responsive adjustments for back to top */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 90px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
}
