@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Premium Palette - Dark Mode Optimized */
    --primary: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    /* Indigo 600 */
    --primary-glow: rgba(99, 102, 241, 0.4);

    --secondary: #ec4899;
    /* Pink 500 */
    --secondary-hover: #db2777;
    /* Pink 600 */

    --accent: #8b5cf6;
    /* Violet 500 */

    --success: #10b981;
    /* Emerald 500 */
    --warning: #f59e0b;
    /* Amber 500 */
    --danger: #ef4444;
    /* Red 500 */

    /* Backgrounds */
    --bg-body: #030712;
    /* Gray 950 - Deeper dark */
    --bg-surface: #111827;
    /* Gray 900 */
    --bg-glass: rgba(17, 24, 39, 0.7);
    --bg-glass-border: rgba(255, 255, 255, 0.08);

    /* Text */
    --text-main: #f9fafb;
    /* Gray 50 */
    --text-secondary: #9ca3af;
    /* Gray 400 */
    --text-muted: #6b7280;
    /* Gray 500 */

    /* UI Elements */
    --border: rgba(255, 255, 255, 0.1);

    /* Shadows */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);

    /* Layout */
    --radius-xl: 1.5rem;
    --radius-lg: 1rem;
    --radius-md: 0.75rem;
    --radius-sm: 0.5rem;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-surface) var(--bg-body);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background-color: var(--bg-surface);
    border-radius: 4px;
    border: 1px solid var(--border);
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    /* Dynamic premium gradient */
    background-image:
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 100% 0%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #fff;
    line-height: 1.2;
}

h1 {
    font-size: 3rem;
    background: linear-gradient(to right, #fff, #c7d2fe);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
    text-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* Glass Design System */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--bg-glass-border);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    /* Top highlight */
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    opacity: 0.5;
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Form Elements */
input,
select,
textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(17, 24, 39, 0.4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    margin-bottom: 1rem;
}



input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(17, 24, 39, 0.8);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(79, 70, 229, 0.3);
}

.btn:hover::after {
    opacity: 1;
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Toolbar Container for Horizontal Scroll */
/* Toolbar Container for Horizontal Scroll */
.toolbar-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 0;
    margin-top: 10px;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}

.toolbar-container::-webkit-scrollbar {
    display: none;
}

/* Fix for buttons inside toolbar */
/* Fix for buttons inside toolbar */
.toolbar-container .btn,
.toolbar-container .btn-secondary {
    flex-grow: 1;
    flex-basis: auto;
    white-space: nowrap;
    /* Prevent squashing */
    border-radius: 50px;
    /* Pill shape */
    padding: 10px 20px;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    /* Minimum touch target size */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    /* Lifted look */
}

/* Make icons distinct */
.toolbar-container .btn-secondary {
    background: rgba(30, 41, 59, 0.8);
    /* Darker sleek background */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

/* Navigation - Sidebar */
/* Navigation - Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 280px;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    z-index: 1000;
    /* High z-index to sit above content */
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: 60px;
    /* Space for top bar if needed, or just padding */
    padding-bottom: 100px;
    /* Space for bottom nav on mobile */
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar.open {
    transform: translateX(0);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    /* Below sidebar, above content */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    backdrop-filter: blur(4px);
}

.overlay.visible {
    opacity: 1;
    visibility: visible;
}


.nav-item {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover,
.nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), transparent);
    color: var(--primary);
    transform: translateX(4px);
    border-left: 3px solid var(--primary);
}

/* Leaflet Maps */
.leaflet-container {
    background: #0f172a !important;
    font-family: inherit;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: var(--bg-surface) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border);
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-content {
    margin: 12px !important;
    line-height: 1.5 !important;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

.animate-enter {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Badge System */
.badge-pill {
    padding: 0.35em 0.8em;
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Detail Page Specific - Restored from Backup 05/01/2026 */
.trip-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: auto;
    /* Allow scrolling */
    min-height: calc(100vh - 4rem);
}

.itinerary-panel {
    order: 2;
    /* List below map */
    overflow: visible;
    /* Let the page scroll */
}

.map-panel {
    order: 1;
    /* Map on top */
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
    box-shadow: var(--shadow-lg);
    width: 100%;
    height: 400px;
    /* Fixed height for map strip */
    flex-shrink: 0;
}

#map {
    width: 100%;
    height: 100%;
}

/* Timeline Items */
.timeline-item {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 2rem;
    bottom: -2rem;
    width: 2px;
    background: var(--border);
    z-index: 0;
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-marker {
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    background: var(--bg-surface);
    border: 2px solid var(--primary);
    border-radius: 50%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
    cursor: grab;
    /* Drag handle cursor */
}

.timeline-marker:active {
    cursor: grabbing;
}

.sortable-ghost {
    opacity: 0.5;
    background: rgba(99, 102, 241, 0.1);
    border: 2px dashed var(--primary);
}

.item-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: var(--transition);
}

.item-card:hover {
    background: rgba(30, 41, 59, 1);
    border-color: var(--primary);
    transform: translateX(4px);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.badges {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

/* Filters */
.filters-bar {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.filter-chip {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.filter-chip.active,
.filter-chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Leaflet Dark Mode Overrides */
/* Note: .leaflet-container already exists but ensuring popup styles match */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: var(--bg-surface) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border);
}

.leaflet-popup-content a {
    color: var(--primary) !important;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-enter {
    animation: slideIn 0.4s ease-out forwards;
}


/* Restoring Top Bar Layout - Fix for Hamburger Menu */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    height: 60px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 1001;
    gap: 1rem;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    flex: 1;
}

.icon-btn {
    background-color: transparent !important;
    border: none !important;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}


/* Sidebar Internals Restoration */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    /* Ensuring flex layout for icon+text */
}

.user-profile {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: auto;

}

/* --- Mobile Optimization (Phase 13) --- */

/* Bottom Navigation */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    /* Safe area included */
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    z-index: 2000;
    padding-bottom: env(safe-area-inset-bottom, 20px);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.bottom-nav a.nav-item-mobile {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    gap: 4px;
    transition: all 0.2s;
}

.bottom-nav a.nav-item-mobile.active {
    color: var(--primary);
}

.bottom-nav a.nav-item-mobile .nav-icon {
    font-size: 1.5rem;
}

.bottom-nav a.nav-item-mobile.highlight .nav-icon-circle {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
    transform: translateY(-12px);
    /* Pop out effect */
    border: 4px solid var(--bg-body);
    font-size: 1.5rem;
}

/* Buy Me a Coffee Widget */
.buy-coffee-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9990;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.buy-coffee-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFDD00, #FBB03B);
    border: none;
    box-shadow: 0 4px 15px rgba(251, 176, 59, 0.4);
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.buy-coffee-fab:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 6px 20px rgba(251, 176, 59, 0.6);
}

.buy-coffee-popup {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 300px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom right;
    z-index: 1;
}

.buy-coffee-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.buy-coffee-popup .popup-content {
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 221, 0, 0.2);
    padding: 1.5rem;
    text-align: center;
    position: relative;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
}

.buy-coffee-popup h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #FFDD00, #FBB03B);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.buy-coffee-popup p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
}

.buy-coffee-popup .coffee-btn {
    background: linear-gradient(135deg, #FFDD00, #FBB03B);
    color: #1a1a1a;
    width: 100%;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px;
}

.buy-coffee-popup .coffee-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 176, 59, 0.3);
}

.popup-content .close-popup {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.popup-content .close-popup:hover {
    color: var(--text-main);
}

/* Mobile Media Queries */
@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
    }

    /* Adjust Content for Bottom Nav spacing */
    .app-container {
        padding-bottom: 90px !important;
    }

    /* Hide Desktop Sidebar Trigger? No, keeping it for secondary items. */

    /* Mobile Modals (Bottom Sheet) */
    .buy-coffee-container {
        bottom: 90px;
        /* Move up above bottom nav on mobile */
    }

    .modal {
        align-items: flex-end !important;
        /* Align to bottom */
        padding: 0 !important;
    }

    .modal-content,
    .fork-modal-content,
    .review-modal-content,
    .collection-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 20px 20px 0 0 !important;
        animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
        max-height: 85vh;
        overflow-y: auto;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    /* Grids to Single Column */
    .trips-grid,
    .user-stats-grid {
        grid-template-columns: 1fr !important;
    }

    /* Adjust padding */
    .container {
        padding: 1rem !important;
    }

    /* Bigger Buttons */
    .btn,
    button,
    input,
    select {
        min-height: 48px;
    }
}