/* ============================================================
   GoPlaces.ai - site.css  (05 v2)
   ============================================================ */

/* User avatar circle — sidebar / mobile nav / mobile sheet.
   When `has-avatar` is added by layout-auth.js, the SVG fallback hides
   and the background-image (set inline) shows. */
.user-avatar-circle.has-avatar .user-avatar-fallback { display: none; }
.user-avatar-circle.has-avatar { background-color: transparent; border-color: rgba(255,255,255,0.15); }

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

/* ---- HERO BACKGROUND (local asset) ----
   Mobile gets a portrait-cropped variant so the focal point stays
   centered on narrow viewports; desktop uses the wide landscape.
   `background-attachment: fixed` is also dropped on mobile because
   iOS Safari treats it as `scroll` and breaks the cover sizing. */
.hero-bg {
    background-image: url('../img/bg_mobile.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

@media (min-width: 768px) {
    .hero-bg {
        background-image: url('../img/bg1.png');
        background-attachment: fixed;
    }
}

/* ================================================================
   SIDEBAR  (glassmorphism - frosted dark glass)
   overflow-x:clip lets absolute tooltips escape without scroll
   ================================================================ */
#sidebar {
    background: rgba(22, 27, 45, 0.55);
    backdrop-filter: blur(40px) saturate(1.6);
    -webkit-backdrop-filter: blur(40px) saturate(1.6);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.35);
    /* Use clip instead of hidden so JS tooltips can escape */
    overflow-x: clip;
    overflow-y: auto;
    will-change: width;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Labels shrink to zero when sidebar is collapsed */
.sidebar-label {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease, max-width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 200px;
}

.sidebar-collapsed .sidebar-label {
    opacity: 0 !important;
    max-width: 0 !important;
    pointer-events: none;
}

/* Show full wordmark when expanded, icon-only when collapsed */
.sidebar-logo-full { display: block; }
.sidebar-logo-icon { display: none; }
.sidebar-collapsed .sidebar-logo-full { display: none; }
.sidebar-collapsed .sidebar-logo-icon { display: block; }

/* ── Sidebar badges: inline when expanded, overlay when collapsed ── */
/* Nav items need relative positioning so badges can anchor to the icon */
.sidebar-nav-item { position: relative; }

/* Expanded: badges flow inline at the right edge (ml-auto in Tailwind) */
.sidebar-badge {
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

/* Collapsed: reposition badges as small overlays on the icon's top-right */
.sidebar-collapsed .sidebar-badge {
    position: absolute !important;
    top: 4px;
    left: 50%;
    margin-left: 6px; /* offset right from the icon center */
    margin-right: 0 !important;
    /* Shrink to a compact dot-style badge */
    padding: 1px 4px !important;
    min-width: 16px !important;
    font-size: 9px !important;
    line-height: 1.2;
    border-radius: 9999px !important;
    z-index: 1;
}

/* Center everything in the collapsed rail */
.sidebar-collapsed .sidebar-nav-item,
.sidebar-collapsed .theme-toggle-btn,
.sidebar-collapsed .relative.group > a,
.sidebar-collapsed #sidebarUserFooter,
.sidebar-collapsed #sidebarUserAvatar,
.sidebar-collapsed #sidebarGuestFooter,
.sidebar-collapsed #sidebarFooterInfo {
    justify-content: center !important;
    gap: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
/* Navigation icon centering */
.sidebar-collapsed .sidebar-nav-item svg {
    margin: 0 !important;
}
/* Ensure the logo is also centered if it has padding */
.sidebar-collapsed .sidebar-logo-icon {
    margin: 0 auto;
}

/* Footer info icon visibility */
#sidebarFooterInfo { display: none; }
.sidebar-collapsed #sidebarFooterInfo { display: flex; }

/* Footer Popover (Floating bubble) */
.footer-popover-floating {
    position: fixed;
    z-index: 9999;
    background: rgba(22, 27, 45, 0.98);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    padding: 14px 18px;
    width: 260px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(-50%) translateX(10px);
}
.footer-popover-floating.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

/* User dropdown: when the sidebar is collapsed, JS detaches the dropdown
   from the sidebar (which has backdrop-filter + overflow:clip and would
   otherwise trap fixed descendants) and re-parents it to <body> with the
   .user-dropdown-floating class. Style the floating variant here. */
.user-dropdown-floating {
    background: rgba(22, 27, 45, 0.97) !important;
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* ================================================================
   JS TOOLTIP  (appended to <body> by layout script)
   Position is set inline via JS - no overflow clipping issues
   ================================================================ */
#gpSidebarTooltip {
    position: fixed;
    z-index: 9999;
    background: rgba(10, 16, 28, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.92);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 9px;
    pointer-events: none;
    opacity: 0;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    transition: opacity 0.12s ease;
    transform: translateY(-50%);
}

#gpSidebarTooltip.visible {
    opacity: 1;
}

/* ================================================================
   DESKTOP NAV ITEMS
   ================================================================ */
.sidebar-nav-item {
    position: relative;
    display: flex;
    align-items: center;
}

/* ================================================================
   DESKTOP CONTENT OFFSET  (JS overrides inline, these are fallback)
   ================================================================ */
@media (min-width: 768px) {
    .md-main-content {
        margin-left: 256px;
        transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

@media (max-width: 767px) {
    .md-main-content {
        margin-left: 0 !important;
    }
}

/* ================================================================
   MOBILE HEADER
   Initially fully transparent; JS adds .mobile-header-scrolled on scroll
   ================================================================ */
#mobileHeader {
    height: 52px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid transparent;
    transition: background 0.3s ease, backdrop-filter 0.3s ease,
        -webkit-backdrop-filter 0.3s ease, border-color 0.3s ease;
}

#mobileHeader.mobile-header-scrolled {
    background: rgba(22, 27, 45, 0.55);
    backdrop-filter: blur(40px) saturate(1.6);
    -webkit-backdrop-filter: blur(40px) saturate(1.6);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* ================================================================
   DESKTOP TOP HEADER (glass on scroll - frosted dark glass)
   ================================================================ */
/* ================================================================
   MOBILE BOTTOM NAV  (frosted dark glass)
   ================================================================ */
#mobileNav {
    background: rgba(22, 27, 45, 0.55) !important;
    backdrop-filter: blur(40px) saturate(1.6) !important;
    -webkit-backdrop-filter: blur(40px) saturate(1.6) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.3) !important;
}


/* iOS safe-area padding — applied to bottom nav since it sits at the very bottom */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    #mobileNav {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ================================================================
   MOBILE "MORE" POPOVER
   ================================================================ */
.mobile-more-popover {
    background: rgba(22, 27, 45, 0.92);
    backdrop-filter: blur(40px) saturate(1.6);
    -webkit-backdrop-filter: blur(40px) saturate(1.6);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.mobile-more-arrow {
    position: absolute;
    bottom: -6px;
    right: 24px;
    width: 12px;
    height: 12px;
    background: rgba(22, 27, 45, 0.92);
    border-right: 1px solid rgba(255, 255, 255, 0.10);
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    transform: rotate(45deg);
}

/* Light mode overrides */
.light .mobile-more-popover,
:root:not(.dark) .mobile-more-popover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}
.light .mobile-more-arrow,
:root:not(.dark) .mobile-more-arrow {
    background: rgba(255, 255, 255, 0.95);
    border-right-color: rgba(0, 0, 0, 0.08);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

/* Body padding on mobile so content clears the fixed bottom nav */
@media (max-width: 767px) {
    body {
        padding-top: 52px;
        padding-bottom: 64px;
    }
}

/* GDPR sits above mobile bottom nav */
@media (max-width: 767px) {
    #gdprModal {
        bottom: 64px;
    }
}

/* ================================================================
   CHAT STREAM
   ================================================================ */
.chat-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.chat-scroll::-webkit-scrollbar {
    width: 3px;
}

.chat-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes msgAppear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-appear {
    animation: msgAppear 0.22s ease forwards;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.gdpr-slide-up {
    animation: slideUp 0.4s ease 0.5s both;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card-anim {
    animation: authFadeIn 0.32s ease both;
}

/* ================================================================
   AUTH
   ================================================================ */
.auth-input:focus {
    box-shadow: 0 0 0 2px rgba(224, 90, 43, 0.25);
}

.strength-seg {
    transition: background-color 0.25s ease;
}

.auth-btn-google {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.auth-btn-google:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* ================================================================
   CHAT SIDEBAR ACCORDION
   ================================================================ */
#navChatAccordion { display: flex; flex-direction: column; }

/* Collapsed: zero height, no overflow */
.nav-chat-collapsed { max-height: 0; overflow: hidden; transition: max-height 0.28s ease; }

/* Expanded: auto height via large max-height cap */
.nav-chat-expanded  { max-height: 400px; overflow-y: auto; transition: max-height 0.28s ease; }
.nav-chat-expanded::-webkit-scrollbar { width: 3px; }
.nav-chat-expanded::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Floating chat panel variant (for collapsed sidebar) */
.chat-dropdown-floating {
    width: 280px !important;
    flex-direction: column;
    max-height: 500px;
}
.chat-dropdown-floating:not(.hidden) {
    display: flex !important;
}
.chat-dropdown-floating #navSessionsList {
    max-height: 460px;
    overflow-y: auto;
    padding-bottom: 8px;
}
/* Custom scrollbars for chat dropdown */
.chat-dropdown-floating #navSessionsList::-webkit-scrollbar { width: 4px; }
.chat-dropdown-floating #navSessionsList::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 10px; }
html:not(.dark) .chat-dropdown-floating #navSessionsList::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); }

/* Show floating header only when floating */
.chat-dropdown-floating #navChatFloatingHeader { display: flex !important; }
html:not(.dark) .chat-dropdown-floating #navChatFloatingHeader { border-bottom-color: rgba(0,0,0,0.06); }
html:not(.dark) .chat-dropdown-floating #navChatFloatingHeader span { color: #111827 !important; }
html:not(.dark) .chat-dropdown-floating #navChatFloatingHeader button { color: rgba(0,0,0,0.4) !important; }
html:not(.dark) .chat-dropdown-floating #navChatFloatingHeader button:hover { color: #111827 !important; }

.nav-session-new {
    display: block;
    padding: 5px 10px;
    margin: 4px 0 2px;
    font-size: 12px;
    font-weight: 600;
    color: #E05A2B;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.15s;
}
.nav-session-new:hover { background: rgba(224,90,43,0.1); }

.nav-session-row {
    display: flex;
    align-items: center;
    border-radius: 8px;
    transition: background 0.12s;
}
.nav-session-row:hover { background: rgba(255,255,255,0.06); }
.nav-session-row.active { background: rgba(224,90,43,0.1); }

.nav-session-link {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    text-decoration: none;
}

.nav-session-title {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.nav-session-row.active .nav-session-title { color: rgba(255,255,255,0.85); font-weight: 500; }

.nav-session-date {
    font-size: 10px;
    color: rgba(255,255,255,0.2);
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-session-del {
    flex-shrink: 0;
    padding: 4px 6px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.25);
    cursor: pointer;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.nav-session-row:hover .nav-session-del { opacity: 1; }
.nav-session-del:hover { color: #f87171; }

.nav-sessions-empty {
    padding: 10px 10px 8px;
    font-size: 11px;
    color: rgba(255,255,255,0.25);
    text-align: center;
}

/* Mobile chat sheet session rows */
.mobile-session-row {
    transition: background 0.12s;
}
.mobile-session-row:hover { background: rgba(255,255,255,0.05); }

/* ── Global confirm dialog ──────────────────────────────────── */
.gp-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: gpConfirmFadeIn 0.15s ease-out;
}
@keyframes gpConfirmFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.gp-confirm-dialog {
    background: #1a2535;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 1.25rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: gpConfirmSlideUp 0.18s cubic-bezier(0.32,0.72,0,1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
@keyframes gpConfirmSlideUp {
    from { transform: translateY(12px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}
.gp-confirm-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}
.gp-confirm-msg {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.55);
    margin: 0 0 0.5rem;
    line-height: 1.5;
}
.gp-confirm-actions {
    display: flex;
    gap: 0.625rem;
    justify-content: flex-end;
    margin-top: 0.25rem;
}
.gp-confirm-cancel {
    padding: 0.5rem 1.1rem;
    border-radius: 0.75rem;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.65);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.gp-confirm-cancel:hover { background: rgba(255,255,255,0.12); color: #fff; }
.gp-confirm-ok {
    padding: 0.5rem 1.1rem;
    border-radius: 0.75rem;
    background: #E05A2B;
    border: none;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.gp-confirm-ok:hover  { background: #c44d22; }
.gp-confirm-ok:active { transform: scale(0.96); }
.gp-confirm-ok.danger { background: #dc2626; }
.gp-confirm-ok.danger:hover { background: #b91c1c; }

