:root {
    --primary: #4A90E2;
    --primary-dark: #357ABD;
    --secondary: #50E3C2;
    --accent: #F5A623;
    --text: #333333;
    --text-light: #FFFFFF;
    --bg-gradient: linear-gradient(135deg, #fffcf5 0%, #fff8e1 100%);
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    font-family: 'Assistant', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Changed from center to allow scrolling */
    position: relative;
    overflow-x: hidden;
}

.background-globes {
    position: fixed;
    /* Fixed so they don't scroll */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite alternate ease-in-out;
}

.globe-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--primary), transparent);
    top: -50px;
    left: -50px;
}

.globe-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--secondary), transparent);
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

.globe-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--accent), transparent);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translateY(0) scale(1);
    }

    100% {
        transform: translateY(-30px) scale(1.1);
    }
}

.hidden {
    display: none !important;
}

/* Header */
header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #fdfbf7 0%, #e6d5b8 100%);
    box-shadow: 0 4px 15px rgba(93, 64, 55, 0.1);
    /* More opaque */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 2px solid #d7ccc8;
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--primary-dark);
}

.logo-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.logo h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.logo .subtitle {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 400;
    opacity: 0.8;
}

.logo-image {
    height: 120px;
    width: auto;
    border-radius: 8px;
    /* Optional: rounds corners slightly */
}

/* Main Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin-top: 240px;
    /* Header height + spacing */
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    padding: 2rem;
    transition: var(--transition);
}

.hero-card {
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.map-card {
    width: 100%;
    padding: 1rem;
    height: 500px;
    /* Fixed height for map container */
    display: flex;
    flex-direction: column;
}

#map {
    width: 100%;
    height: 100%;
    border-radius: 15px;
    z-index: 1;
}

h2 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
}

h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

p {
    color: var(--text);
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-google {
    background: white;
    color: #444;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.pulse-effect {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(74, 144, 226, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(74, 144, 226, 0);
    }
}

/* Dashboard */
#dashboard-section {
    width: 100%;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 2rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid white;
}

/* Modal */
/* Modal - Scrollable Overlay Approach */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Start from top to allow scrolling */
    overflow-y: auto;
    /* The overlay itself scrolls */
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 10000;
    padding: 250px 0 2rem 0;
    /* Add spacing top/bottom */
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    position: relative;
    background: white;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    padding: 2rem;
    margin: auto;
    /* Centers horizontally in flex */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    /* No max-height, let it grow */
}

/* Amenities Checkboxes */
.amenity-group {
    background: rgba(255, 255, 255, 0.6);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.amenity-group h4 {
    margin: 0 0 0.8rem 0;
    font-size: 1rem;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* 2 columns */
    gap: 0.8rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
}

.close-modal {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 600;
}

input,
textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.8);
}

input:focus,
textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.location-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(240, 240, 240, 0.6);
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.2rem;
}

.btn-submit {
    width: 100%;
    background: var(--primary);
    color: white;
    margin-top: 1rem;
}

.spots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    width: 100%;
}

.spot-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.spot-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.spot-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    background-color: #eee;
    flex-shrink: 0;
}

.spot-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.spot-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.spot-location {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.spot-footer {
    margin-top: auto;
    padding-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #888;
}

/* Custom Map Marker */
.custom-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.marker-content {
    width: 60px;
    height: 60px;
    border-radius: 5px;
    background: white;
    padding: 2px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
    top: 5px;
    border: 2px solid white;
    z-index: 2;
}

.marker-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 3px;
}

.marker-pin {
    font-size: 40px;
    color: #EA4335;
    /* Google Red */
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.3));
    margin-top: -10px;
    z-index: 1;
}

/* --- Rating Styles --- */

.spot-rating-badge {
    display: inline-flex;
    align-items: center;
    background: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--accent);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
}

.spot-rating-badge i {
    margin-right: 3px;
    color: var(--accent);
}

.rating-input-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
}

.rating-input-group label {
    margin-bottom: 0;
    width: 30%;
}

.star-rating {
    direction: ltr;
    /* Ensure stars go left-to-right visually */
    font-size: 1.5rem;
    cursor: pointer;
    width: 70%;
    text-align: right;
}

.star-rating i {
    color: #ddd;
    transition: color 0.1s;
    margin: 0 2px;
}

/* JS will handle active classes for precise control */
.star-rating i.filled {
    color: var(--accent);
    font-weight: 900;
    /* Use font-awesome solid style */
}

.averages-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.average-item {
    background: rgba(255, 255, 255, 0.6);
    padding: 0.8rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.average-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.3rem;
    display: block;
}

.average-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--primary-dark);
}

.star-display-static {
    color: var(--accent);
    font-size: 0.9rem;
}

/* Address Autocomplete */
.address-search-container {
    position: relative;
    /* display: flex;  - Already inline style, but good to know context */
}

.suggestions-list {
    position: absolute;
    top: 100%;
    right: 0;
    /* RTL alignment */
    width: 100%;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    list-style: none;
    padding: 0;
    margin: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: right;
}

.suggestions-list li {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
    color: #333;
}

.suggestions-list li:hover {
    background-color: #f0f7ff;
    color: var(--primary);
}

.suggestions-list.hidden {
    display: none;
}

/* --- User Dropdown Menu --- */
.user-dropdown-container {
    position: relative;
    display: inline-block;
}

.user-dropdown-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-dropdown-menu {
    position: absolute;
    top: 120%;
    left: 0;
    width: 280px;
    background: white;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
    text-align: right;
}

[dir="rtl"] .user-dropdown-menu {
    right: auto;
    left: 0;
}

.user-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header-info {
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dropdown-user-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--primary-dark);
}

.dropdown-rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #f0f7ff;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--primary);
    width: fit-content;
}

.dropdown-points {
    font-weight: bold;
    color: var(--accent);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    font-size: 0.95rem;
    text-align: right;
}

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

.menu-item i {
    width: 20px;
    text-align: center;
    color: #888;
}

.menu-item:hover i {
    color: var(--primary);
}

/* Address & Phone Input Group */
.input-with-prefix {
    display: flex;
    gap: 0.5rem;
    direction: ltr;
    /* Force LTR for phone inputs so prefix is on left */
}

.phone-prefix-select {
    width: 110px;
    flex-shrink: 0;
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.95rem;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- New Controls & Map Modal --- */

/* Controls Bar */
.controls-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-container label {
    margin-bottom: 0;
    margin-right: 0.5rem;
    white-space: nowrap;
}

.sort-container select {
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
}

/* Map Modal - Smaller & Centered */
#map-modal.modal {
    padding: 0;
    align-items: center;
    /* Center vertical */
    justify-content: center;
    /* Center horizontal */
    z-index: 10000;
}

#map-modal .modal-content {
    width: 90% !important;
    max-width: 1000px !important;
    height: 80% !important;
    border-radius: 20px !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    background: white;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    /* Ensure rounded corners clip map */
}

.map-modal-header {
    flex: 0 0 auto;
    padding: 1rem 1.5rem;
    background: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    z-index: 1001;
    /* Ensure above map */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Ensure map fills remaining space */
#map {
    flex: 1;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    min-height: 0;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }

    .sort-container {
        justify-content: space-between;
        width: 100%;
    }

    .sort-container select {
        flex: 1;
    }

    #toggle-map-btn {
        width: 100%;
        justify-content: center;
    }
}