/* --- General & Typography --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700&display=swap');

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f8f9fa;
    color: #212529;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden {
    display: none !important;
}

/* --- Map Page --- */
#map {
    height: 100%;
    width: 100%;
    z-index: 0;
    background-color: #e9ecef; /* Placeholder color while map tiles load */
}

/* UI Panels on Map */
#ui-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse; /* To stack panels upwards from the bottom */
    align-items: flex-start;
    gap: 15px;
    pointer-events: none; /* Allow map interaction through the container */
}

.panel {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    width: 320px; /* Slightly wider */
    box-sizing: border-box;
    border: 1px solid #e9ecef;
    pointer-events: auto; /* Make panels interactive */
}

#add-point-panel {
    /* When the add point panel is shown, it should be above the user panel */
    order: 2;
}

#user-panel {
    order: 1;
}

#logged-in-view {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

#logged-in-view p {
    margin: 0;
    font-size: 0.95em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Form Styling (Global) --- */
form {
    display: flex;
    flex-direction: column;
    gap: 18px; /* Increased gap for better spacing */
}

form label {
    font-weight: 500;
    font-size: 0.9em;
    color: #495057;
}

form input,
form textarea,
form select {
    width: 100%;
    padding: 12px 15px; /* Larger inputs */
    border: 1px solid #ced4da;
    border-radius: 8px; /* Softer radius */
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.2s, box-shadow 0.2s;
}

form input:focus,
form textarea:focus,
form select:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* --- Button Styling (Global) --- */
button {
    cursor: pointer;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 1em;
    color: white;
    background-color: #007bff;
    transition: background-color 0.2s, transform 0.1s;
}

button:hover {
    background-color: #0069d9;
}

button:active {
    transform: scale(0.98);
}

.form-buttons {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.form-buttons button {
    flex-grow: 1;
}

button.cancel-auth-btn,
button[type="button"] {
    background-color: #6c757d;
}
button.cancel-auth-btn:hover,
button[type="button"]:hover {
    background-color: #5a6268;
}

/* --- Landing & Profile Page Specifics --- */
.landing-body {
    overflow-y: auto;
    overflow-x: hidden;
}

.landing-header {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.landing-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    text-decoration: none;
    color: inherit;
}

.logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.7em;
    font-weight: 700;
    color: #0056b3;
    margin: 0;
}

.landing-header nav a {
    margin-left: 30px;
    text-decoration: none;
    color: #495057;
    font-weight: 500;
    transition: color 0.2s;
}

.landing-header nav a:hover {
    color: #007bff;
}

/* Hero Section */
.hero {
    background: linear-gradient(170deg, #e0f7fa 0%, #f0f4f8 100%);
    color: #212529;
    padding: 60px 0;
    overflow: hidden;
}

.hero-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.hero-content {
    flex: 1;
    max-width: 550px;
    text-align: left;
}

.hero-image {
    flex: 1;
    max-width: 600px;
}

.hero-image svg {
    width: 100%;
    height: auto;
}

.hero h2 {
    font-size: 3.2em;
    margin-bottom: 20px;
    font-weight: 700;
    line-height: 1.2;
    color: #1a2533;
}

.hero p {
    font-size: 1.2em;
    max-width: 500px;
    margin: 0 0 40px 0;
    color: #495057;
    line-height: 1.6;
}

.hero .nav-links {
    display: flex;
    gap: 15px;
}


.map-link {
    display: inline-block;
    background: #fff;
    color: #007bff;
    padding: 14px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    margin: 0 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.map-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* Content Sections */
.landing-section, .landing-section-alt {
    padding: 80px 0;
    text-align: center;
}

.landing-section-alt {
    background-color: #fff;
}

.landing-section h3, .landing-section-alt h3 {
    font-size: 2.2em;
    margin-bottom: 25px;
    color: #0056b3;
}

.landing-section p, .landing-section-alt p {
    font-size: 1.15em;
    line-height: 1.7;
    max-width: 700px;
    margin: 0 auto;
    color: #495057;
}

/* Features Section */
.features-grid {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 50px;
    flex-wrap: wrap;
}

.feature-item {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    flex-basis: 280px;
    flex-grow: 1;
    border: 1px solid #e9ecef;
}

.feature-item svg {
    margin-bottom: 20px;
}

.feature-item h4 {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #343a40;
}

.feature-item p {
    font-size: 1em;
    line-height: 1.6;
    color: #495057;
}

/* Auth & Profile Forms */
.auth-container {
    max-width: 450px;
    margin: 0 auto;
}

#auth-forms, #profile-update-forms {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

#auth-forms h3, #profile-update-forms h3 {
    margin-top: 0;
    margin-bottom: 30px;
    text-align: center;
    font-size: 1.8em;
    color: #343a40;
}

.auth-toggle {
    text-align: center;
    margin-top: 20px;
}

.auth-toggle a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

/* Footer */
.landing-footer {
    background: #343a40;
    color: #f8f9fa;
    text-align: center;
    padding: 30px 0;
    margin-top: 60px;
}

/* Message Containers */
.message-container, #message-container-map, #message-container-profile {
    padding: 15px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    text-align: center;
    margin-top: 20px;
}

.message-container.success, #message-container-map.success, #message-container-profile.success {
    background-color: #28a745;
}

.message-container.error, #message-container-map.error, #message-container-profile.error {
    background-color: #dc3545;
}


/* --- Map Enhancements --- */
#loader {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 1001;
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border: 6px solid rgba(0, 123, 255, 0.2);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 1s linear infinite;
}

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

/* Custom Popup Styling */
.custom-popup .leaflet-popup-content-wrapper {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.custom-popup .leaflet-popup-content {
    margin: 18px 24px;
    line-height: 1.6;
    font-size: 1em;
}

.custom-popup .popup-title {
    font-weight: 700;
    font-size: 1.15em;
    margin-bottom: 10px;
    color: #343a40;
}

.custom-popup .popup-description {
    margin-bottom: 12px;
    color: #495057;
}

.custom-popup .popup-meta {
    font-size: 0.8em;
    color: #6c757d;
}

.leaflet-control-attribution {
    display: none !important;
}

/* --- User Points List on Profile Page --- */
#user-points-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: left;
    margin-top: 30px;
}

.user-point-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.user-point-item h4 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    color: #0056b3;
}

.user-point-item p {
    margin: 0 0 15px 0;
    color: #495057;
}

.user-point-item small {
    color: #6c757d;
}

/* Scroll Animation */
.scroll-animation {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-animation.in-view {
    opacity: 1;
    transform: translateY(0);
}


/* --- Responsive Design --- */
@media (max-width: 600px) {
    #ui-container {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 0;
    }

    .panel {
        width: auto;
        margin: 0;
        border-radius: 12px 12px 0 0; /* Rounded corners only at the top */
        box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
        border-bottom: none;
    }

    .hero {
        padding: 60px 20px;
    }

    .hero-container {
        flex-direction: column;
        text-align: center;
    }

    .hero-content {
        text-align: center;
    }
    
    .hero-image {
        display: none; /* Hide image on mobile */
    }

    .hero h2 {
        font-size: 2.2em;
    }

    .hero p {
        font-size: 1.1em;
        margin-left: auto;
        margin-right: auto;
    }

    .hero .nav-links {
        justify-content: center;
        flex-direction: column;
        gap: 15px;
    }

    .hero .map-link {
        margin: 0; /* Remove horizontal margin for vertical stacking */
    }
}