:root {
    --primary-color: #3b82f6;
    /* Pleasing Blue */
    --accent-color: #3b82f6;
    --surface-color: #ffffff;
    --background-color: #f3f4f6;
    /* Light Grey Base */
    --text-primary: #1f2937;
    /* Dark Grey Text */
    --text-secondary: #6b7280;

    --dark-surface: #ffffff;
    --dark-text: #1f2937;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 1rem;
    --radius-full: 9999px;
    --font-heading: 'Google Sans', sans-serif;
    --font-body: 'Google Sans', sans-serif;
    --transition-fast: 0.2s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--background-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#map {
    height: 100vh;
    width: 100%;
    z-index: 1;
    background-color: #f3f4f6;
    /* Match light base */
}

/* Lighten Map Tiles - Removed for Positron */
.leaflet-tile {
    filter: none;
}

/* UI Overlay */
.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    /* Reduced top padding */
}

/* Top Header */
.top-header {
    pointer-events: auto;
    width: 100%;
    max-width: 600px;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    padding-top: calc(env(safe-area-inset-top) + 0.5rem);
}

.logo-container {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary-color);
    letter-spacing: -0.5px;
    line-height: 1;
    padding-bottom: 8px;
}

/* Search Bar - Floating Style */
.search-container {
    pointer-events: auto;
    flex-grow: 1;
    background: var(--surface-color);
    border-radius: 2rem;
    /* Fully rounded */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    padding: 0.8rem 1.25rem;
    transition: var(--transition-fast);
    position: relative;
}

.search-icon {
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-right: 1rem;
}

.search-input {
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--text-primary);
    width: 100%;
    background: transparent;
    font-family: var(--font-body);
    font-weight: 500;
}

.filter-btn-icon {
    background: none;
    border: none;
    margin-left: 0.5rem;
    font-size: 1.25rem;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
}

.filter-btn-icon:hover {
    background: #f3f4f6;
}

/* Filter Chips */
.filters-container {
    pointer-events: auto;
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    width: 100%;
    max-width: 600px;
    justify-content: center;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}

.filters-container::-webkit-scrollbar {
    display: none;
}

.chip {
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-primary);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    /* Softer floating shadow */
    border: 2px solid rgba(0, 0, 0, 0.05);
    /* Match active border width */
    white-space: nowrap;
    transition: all 0.2s ease;
}

.chip.active {
    background: var(--dark-text);
    /* White */
    color: var(--primary-color);
    /* Blue text */
    border: 2px solid var(--primary-color);
    /* Blue border */
    /* font-weight change removed to prevent width shift */
}

/* Sub-filter Chips */
.sub-filters-container {
    pointer-events: auto;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    width: 100%;
    max-width: 600px;
    justify-content: center;
    padding-bottom: 0.5rem;
    margin-top: 0.25rem;
    scrollbar-width: none;
}

.sub-filters-container::-webkit-scrollbar {
    display: none;
}

.sub-chip {
    background: rgba(32, 44, 57, 0.8);
    /* Dark semi-transparent */
    color: white;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.sub-chip:hover {
    background: rgba(32, 44, 57, 1);
}

.sub-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}


/* FABs (Floating Action Buttons) */
.fab-container {
    position: absolute;
    bottom: 120px;
    /* Above Bottom Nav */
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 1000;
}

.fab-btn {
    width: 3.5rem;
    height: 3.5rem;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.fab-btn:hover {
    transform: scale(1.05);
}

.main-fab {
    background: #2b3b4d;
    /* Dark */
    color: white;
}

/* Bottom Navigation */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 2rem;
    border-top-right-radius: 2rem;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    /* Above map and FABs */
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #9ca3af;
    gap: 0.25rem;
    flex: 1;
}

.nav-item i {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.nav-item span {
    font-size: 0.75rem;
    font-weight: 500;
}

.nav-item.active {
    color: var(--primary-color);
}

/* Map Markers CSS */
.custom-div-icon {
    background: var(--primary-color);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    display: flex !important;
    /* Leaflet override */
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    font-size: 14px;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(59, 130, 246, 0.6);
}

.marker-cluster div {
    background-color: rgba(59, 130, 246, 0.9);
    /* Blue */
    color: white;
    font-weight: bold;
    font-family: var(--font-body);
}

/* Popup */
.custom-popup .leaflet-popup-content-wrapper {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    padding: 0;
}

.custom-popup .leaflet-popup-content {
    margin: 0;
    width: 300px !important;
}

.popup-header {
    display: none;
}

/* Simplified popup */

.popup-body {
    padding: 1.5rem;
}

.popup-category {
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.popup-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.popup-desc {
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 640px) {

    .top-header {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .top-header {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .filters-container,
    .sub-filters-container {
        justify-content: flex-start;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    /* Compact Mobile View */
    .search-container {
        padding: 0.7rem 1.2rem;
        /* Reduced padding */
        border-radius: 1.5rem;
        /* Slightly tighter radius */
        margin-bottom: 0.5rem;
        /* Closer to chips */
    }

    .bottom-nav {
        padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom)) 1rem;
        /* Ultra compact + safe area */
    }

    .nav-item i {
        font-size: 1.2rem;
        /* Compact icons */
        margin-bottom: 2px;
    }

    .nav-item span {
        font-size: 0.65rem;
        /* Compact text */
    }

    .fab-container {
        bottom: 80px;
        /* Adjusted for new nav height */
        right: 1rem;
    }

    .fab-btn {
        width: 3rem;
        /* Smaller buttons */
        height: 3rem;
        font-size: 1rem;
    }

    /* Hide Zoom Control on Mobile */
    .leaflet-control-zoom {
        display: none;
    }
}

/* List View Overlay */
.list-view-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    margin: 0;
    width: 100%;
    /* max-width: 600px; Removed for full screen */
    bottom: 0;
    height: 100%;
    background: #f3f4f6;
    z-index: 900;
    /* Behind Header, Above Map */
    padding: 0;
    padding-top: 80px;
    /* Clear Header */
    padding-bottom: 85px;
    /* Clear Nav */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-header {
    display: none !important;
}

.list-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-icon-btn:hover {
    background: #f3f4f6;
    color: var(--text-primary);
}

.list-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    /* gap: 1rem; Removed to rely on margin-bottom of items */
    align-items: center;
}

.list-view-container.hidden {
    display: none;
}



.list-item,
.trip-item {
    background: white;
    padding: 1rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    /* Restore standard shadow */
    border: none;
    /* Remove border */
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    max-width: 600px;
    margin-bottom: 1rem;
    /* Consistent spacing */
}

.list-item:hover,
.trip-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    /* Elevate on hover */
}

.item-info {
    flex: 1;
}

.item-category {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.item-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.item-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.item-rating {
    background: #fef3c7;
    color: #d97706;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Auth Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.trip-select-item {
    padding: 1rem;
    background: #f3f4f6;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.trip-select-item:hover {
    background: #e5e7eb;
}



.modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.close-modal-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #666;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
    color: #1a1a1a;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #4a4a4a;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.btn-primary-block {
    width: 100%;
    padding: 0.8rem;
    background: #4285F4;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
}

.btn-primary-block:hover {
    background: #3367d6;
}

.modal-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

.modal-footer a {
    color: #4285F4;
    text-decoration: none;
    font-weight: 600;
}

.alert {
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-danger {
    background: #ffebee;
    color: #c62828;
}

.hidden {
    display: none !important;
}


/* Account Info Styles */
.account-info {
    text-align: center;
    margin-bottom: 2rem;
}

.user-avatar-placeholder {
    width: 80px;
    height: 80px;
    background: #e0e7ff;
    color: #4285F4;
    font-size: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.user-greeting {
    font-size: 1.2rem;
    color: #1a1a1a;
    font-weight: 500;
}

.btn-secondary-block {
    width: 100%;
    padding: 0.8rem;
    background: #f3f4f6;
    color: #424242;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: block;
    box-sizing: border-box;
}

.btn-secondary-block:hover {
    background: #e5e7eb;
}


/* Filter Modal Specifics */
.filter-section {
    margin-bottom: 1.5rem;
}

.filter-label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.rating-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.rating-option {
    cursor: pointer;
}

.rating-option input {
    display: none;
}

.rating-option span {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.rating-option input:checked+span {
    background: #eef2ff;
    color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 600;
}

/* Trips Overlay (reusing list view base) */
.trips-view-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    margin: 0;
    width: 100%;
    /* max-width: 600px; Removed for full screen */
    bottom: 0;
    height: 100%;
    background: #f3f4f6;
    z-index: 900;
    /* Behind Header, Above Map */
    padding: 0;
    padding-top: 80px;
    padding-bottom: 85px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.trips-view-header {
    display: none !important;
}

.trips-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.trips-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0;
    /* Inner padding managed by states */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.trips-content>div {
    width: 100%;
    max-width: 600px;
}

.trips-view-container.hidden {
    display: none;
}

/* .trip-item styles merged with .list-item above */

.trip-item h4 {
    margin: 0 0 0.25rem 0;
    color: var(--text-primary);
}

.trip-item .trip-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}



/* Duplicate trip-item block removed */

.trip-meta {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.day-header {
    background: #f3f4f6;
    /* Lighter grey */
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 5;
    margin-bottom: 0.5rem;
    border-radius: 0.75rem;
    margin-top: 1rem;
}

/* Prominent Delete Button */
.btn-icon-danger {
    background-color: transparent;
    /* Ghost style */
    color: #9ca3af;
    /* Muted grey initially */
    border: none;
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 1rem;
}

.btn-icon-danger:hover {
    background-color: #fee2e2;
    transform: scale(1.1);
    color: #ef4444;
}

/* Drag Handle */
.drag-handle {
    width: 24px;
    display: flex;
    justify-content: center;
    color: #d1d5db !important;
    /* Force lighter grey */
    transition: color 0.2s;
}

.list-item:hover .drag-handle {
    color: var(--text-secondary) !important;
}

/* .list-item:hover .btn-icon-danger Removed to only highlight on direct hover */

/* Action Button (Edit/Calendar) - Ghost to Blue */
.btn-icon-action {
    background-color: transparent;
    color: #9ca3af;
    border: none;
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 1rem;
}

.btn-icon-action:hover {
    background-color: #e0e7ff;
    /* Light indigo */
    transform: scale(1.1);
    color: #4f46e5;
    /* Indigo */
}

/* .list-item:hover .btn-icon-action Removed to only highlight on direct hover */