/* ════════════════════════════════════════════════════════════════════
   TravelZona — Layout CSS (chrome + navigation)
   Loaded on every page via @import in style.css.
   Header, sidebar, profile-menu, bottom-nav, .main-content wrapper,
   .side-menu-nav + #notifList (deduped — was 3 definitions, now 1).
   ════════════════════════════════════════════════════════════════════ */

/* ─── 3. Layout ────────────────────────────── */

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: #ffffff;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
html.dark .header {
    background: rgba(24, 24, 27, 0.8);
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: transparent;
    color: var(--foreground);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}
.header-btn:hover {
    background: var(--muted);
}
.header-btn.active {
    background: var(--brand-50, #ede9fe);
    color: var(--brand-500, #7c3aed);
}

/* ─── Elevated header buttons (Members, Groups) ─── */
/* Gradient-background icon buttons that stand out from regular header buttons.
   Inspired by the footer's .nav-item-elevated but sized for the header. */
.header-btn-elevated {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 0.75rem;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
    position: relative;
    flex-shrink: 0;
}
.header-btn-elevated i {
    font-size: 1rem;
}
.header-btn-elevated.elevated-active {
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.35), 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}
.header-btn-elevated.elevated-inactive {
    opacity: 0.55;
}
@media (hover: hover) {
    .header-btn-elevated.elevated-inactive:hover {
        opacity: 0.9;
        transform: scale(1.05);
    }
}

.badge {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.25rem;
    background: var(--danger);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--background);
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.logo-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-400), #8b5cf6, #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
    box-shadow: var(--shadow-md);
}
.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--brand-500), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
@media (max-width: 640px) {
    .logo-text { display: none; }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
@media (min-width: 768px) {
    .header-actions { gap: 0.5rem; }
}

/* Search bar */
.search-bar {
    display: none;
    align-items: center;
    background: var(--muted);
    border-radius: 9999px;
    padding: 0.375rem 0.75rem;
    width: 16rem;
    transition: width 0.3s;
}
.search-bar:focus-within {
    width: 20rem;
    box-shadow: var(--shadow-md);
}
.search-bar i {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin-right: 0.5rem;
}
.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--foreground);
    font-size: 0.875rem;
    flex: 1;
}
@media (min-width: 768px) {
    .search-bar { display: flex; }
}

/* Avatar button */
.avatar-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 2px solid rgba(56, 189, 248, 0.3);
    overflow: hidden;
    cursor: pointer;
    background: transparent;
    margin-left: 0.25rem;
    transition: border-color 0.2s;
}
.avatar-btn:hover {
    border-color: var(--brand-400);
}
.avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--brand-400), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
}

/* Sign In button */
.signin-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    background: linear-gradient(135deg, var(--brand-500), #8b5cf6);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.75rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.2s;
}
.signin-btn:hover {
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.4);
}

/* Dark mode icons */
.light-icon-only { display: none; }
html.dark .light-icon-only { display: inline; }
html.dark .dark-icon-only { display: none; }

/* Main content */
.main-content {
    min-height: calc(100vh - 130px);
    padding: 60px 10px 80px; /* top padding for fixed header, bottom for fixed nav */
    max-width: 672px;
    margin: 0 auto;
}

/* ─── Desktop: fix .main-content vertical spacing ─────────────────── */
@media (min-width: 768px) {
    .main-content {
        padding: 56px 16px 76px;
        min-height: auto;
    }
}

/* ─── Side Menu & Profile Menu ─────────────── */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 55; /* higher than bottom-nav (50), lower than menus (60) */
    opacity: 0;
    transition: opacity 0.3s;
}
.overlay.hidden {
    display: none;
}
.overlay:not(.hidden) {
    opacity: 1;
}

.side-menu,
.profile-menu {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 60;
    width: 20rem;
    max-width: 85vw;
    background: #ffffff;  /* solid white in light mode */
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-xl); /* strong shadow for slide-in menus */
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-out;
    overflow: hidden;
}
html.dark .side-menu,
html.dark .profile-menu {
    background: rgba(24, 24, 27, 0.95);
}

.side-menu {
    left: 0;
    transform: translateX(-100%);
    border-right: 1px solid var(--border);
}
.side-menu.open {
    transform: translateX(0);
}

.profile-menu {
    right: 0;
    transform: translateX(100%);
    border-right: none;
    border-left: 1px solid var(--border);
}
.profile-menu.open {
    transform: translateX(0);
}

/* ─── Side menu body — scrollable area ─────────────────────────── */
/* Uses position: absolute to constrain height, making overflow-y work */
.side-menu-body {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.side-menu-header {
    flex-shrink: 0; /* never shrink the header */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.side-menu-nav {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 1rem 5rem; /* 5rem bottom padding so last items clear the bottom-nav */
    -webkit-overflow-scrolling: touch;
}

#notifList {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 5rem; /* 5rem bottom padding so last items clear the bottom-nav */
    -webkit-overflow-scrolling: touch;
}

/* ─── Custom scrollbar ─────────────────────────────────────────── */
.side-menu-nav::-webkit-scrollbar,
#notifList::-webkit-scrollbar {
    width: 6px;
}
.side-menu-nav::-webkit-scrollbar-track,
#notifList::-webkit-scrollbar-track {
    background: transparent;
}
.side-menu-nav::-webkit-scrollbar-thumb,
#notifList::-webkit-scrollbar-thumb {
    background-color: rgba(139, 92, 246, 0.3);
    border-radius: 3px;
}
.side-menu-nav::-webkit-scrollbar-thumb:hover,
#notifList::-webkit-scrollbar-thumb:hover {
    background-color: rgba(139, 92, 246, 0.5);
}
.side-menu-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
}
#notifList {
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
}
.side-menu-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
}

.side-menu-search {
    padding: 1rem;
    display: flex;
    align-items: center;
    background: var(--muted);
    border-radius: 0.75rem;
    flex-shrink: 0;
    margin: 1rem;
}
.side-menu-search i {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin-right: 0.5rem;
}
.side-menu-search input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--foreground);
    font-size: 0.875rem;
    flex: 1;
}

.side-menu-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 1rem 1rem;
    min-height: 0; /* critical for flex overflow scrolling */
    -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
}

#notifList {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* critical for flex overflow scrolling */
    -webkit-overflow-scrolling: touch;
}

.side-menu-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    margin: 1.25rem 0 0.5rem;
}
.side-menu-nav a,
.nav-item-full {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.75rem;
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
    border: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
}
.side-menu-nav a:hover,
.nav-item-full:hover {
    background: var(--muted);
}
.side-menu-nav a i {
    width: 1.25rem;
    text-align: center;
    color: var(--muted-foreground);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin: 0 1rem 1rem;
    flex-shrink: 0;
    background: var(--muted);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}
.user-card:hover {
    background: var(--border);
}

.avatar-sm {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(56, 189, 248, 0.3);
    flex-shrink: 0;
}
.avatar-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.toggle-switch {
    margin-left: auto;
    width: 2.25rem;
    height: 1.25rem;
    background: var(--muted-foreground);
    border-radius: 9999px;
    position: relative;
    transition: background 0.2s;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 0.125rem;
    left: 0.125rem;
    width: 1rem;
    height: 1rem;
    background: var(--card); /* use CSS variable instead of hardcoded white */
    border-radius: 50%;
    transition: transform 0.2s;
}
html.dark .toggle-switch {
    background: var(--brand-500);
}
html.dark .toggle-switch::after {
    transform: translateX(1rem);
}

.signin-btn-full {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem;
    margin: 1rem 0;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.75rem;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}
.signin-btn-full:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* ─── Bottom Navigation ────────────────────── */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: #ffffff;
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgb(0 0 0 / 0.05);
}
html.dark .bottom-nav {
    background: rgba(24, 24, 27, 0.95);
}

.bottom-nav-inner {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding: 0.375rem 0.25rem;
    max-width: 32rem;
    margin: 0 auto;
}
@media (min-width: 768px) {
    .bottom-nav-inner { padding: 0.5rem 0.25rem; }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--muted-foreground);
    transition: color 0.2s;
}
.nav-item.active {
    color: var(--brand-500);
}
.nav-item i {
    font-size: 1.125rem;
}
.nav-item span {
    font-size: 0.625rem;
    font-weight: 500;
    margin-top: 0.125rem;
}

.nav-item-elevated {
    margin-top: -0.5rem;
    width: 3rem;
    height: 3rem;
    border: none;
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s;
}
.nav-item-elevated:hover {
    transform: scale(1.05);
}
.nav-item-elevated i {
    font-size: 1.125rem;
}
.nav-item-elevated span {
    font-size: 0.625rem;
    font-weight: 500;
    margin-top: 0.125rem;
}

/* ─── Elevated nav active/inactive states ─── */
/* Ensures only the CURRENT page's elevated button looks "active".
   Inactive elevated buttons are dimmed so they don't compete visually
   with the active one. Active gets a glowing ring. */
.nav-item-elevated.nav-elevated-inactive {
    opacity: 0.5;
    box-shadow: none;
    transform: scale(0.92);
}
.nav-item-elevated.nav-elevated-inactive span {
    opacity: 0.85;
}
.nav-item-elevated.nav-elevated-active {
    opacity: 1;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.35), var(--shadow-lg);
}
@media (hover: hover) {
    .nav-item-elevated.nav-elevated-inactive:hover {
        opacity: 0.85;
        transform: scale(1);
    }
}

.nav-icon-wrapper {
    position: relative;
}
.nav-dot {
    position: absolute;
    top: -0.25rem;
    right: -0.375rem;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    border: 2px solid var(--background);
}
.nav-dot-red { background: var(--danger); }
.nav-dot-green { background: var(--success); }

.nav-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--muted-foreground);
}
.nav-avatar-active {
    border-color: var(--brand-500);
}
.nav-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
