/* ============================================================
   GE-AS CHROME — Logged-in layout (appbar + drawer + mobile tabs)
   Sliced from dashboard.css mockup. Loaded globally in user.blade.php.

   Scope rules:
   - Does NOT redefine --orange / --purple / --ease (already in user.blade.php inline)
   - Does NOT touch <body> background, font-size, or global resets
   - Uses --chrome-card-border (light) since user.blade.php's --card-border
     is the dark footer variant — different visual context
   - Only chrome selectors (.appbar, .mobile-*, .user-menu, .apply-menu, .kyc-chip)

   Maintained by: The Brick Dev Studios
   ============================================================ */

:root {
    /* Chrome-only tokens — additive, no collision with user.blade.php inline */
    --chrome-card-border: rgba(0, 0, 0, 0.06);
    --ink:        #0f172a;
    --ink-2:      #1e293b;
    --ink-4:      #64748b;
    --text-muted: #94a3b8;
    --green:      #10b981;
    --red:        #ec595a;
    --orange-2:   #ea580c;
    --transition-fast: 0.15s cubic-bezier(.4, 0, .2, 1);
}

/* ── live dot (used in appbar drawer + pilot cards) ──────────── */
@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.55; transform: scale(0.82); }
}
.live-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
    animation: livePulse 1.6s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

/* ── KYC chip (used in drawer header) ────────────────────────── */
.kyc-chip {
    display: inline-flex; align-items: center; gap: 0.3rem;
    margin-top: 0.5rem;
    padding: 0.2rem 0.65rem;
    border-radius: 99px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--green);
    font-size: 0.68rem;
    font-weight: 700;
}

/* ============================================================
   APPBAR — sharp logged-in topbar
   Full logo + nav + wallet pill + Apply dropdown + user menu
   ============================================================ */

.appbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: #fff;
    border-bottom: 1px solid var(--chrome-card-border);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 10px 14px;
    height: 64px;
    box-sizing: border-box;
}

/* Logo ---------------------------------------------------------- */
.appbar__logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    height: 40px;
}
.appbar__logo img {
    height: 40px;
    width: auto;
    display: block;
    object-fit: contain;
}

/* Nav ----------------------------------------------------------- */
.appbar__nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    justify-content: center;
    min-width: 0;
}
.appbar__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: transparent;
    border: 0;
    padding: 8px 14px;
    border-radius: 999px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
    transition: color var(--transition-fast), background var(--transition-fast);
}
.appbar__link:hover {
    color: var(--orange);
    background: #fff8f0;
}
.appbar__link.is-active {
    color: var(--orange);
    font-weight: 600;
    background: rgba(249, 115, 22, 0.1);
}
.appbar__link.is-active:hover {
    background: rgba(249, 115, 22, 0.16);
}
.appbar__link--has-menu svg {
    opacity: 0.55;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.appbar__link--has-menu[aria-expanded="true"] svg {
    transform: rotate(180deg);
    opacity: 1;
}

/* Apply dropdown ----------------------------------------------- */
.appbar__dropdown { position: relative; }
.apply-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    width: 200px;
    background: #fff;
    border: 1px solid var(--chrome-card-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.05);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), visibility var(--transition-fast), transform var(--transition-fast);
    overflow: hidden;
    z-index: 45;
    padding: 6px 0;
}
.apply-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
.apply-menu__link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 10px 14px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    color: var(--ink);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.apply-menu__link:hover {
    background: #f9fafb;
    color: var(--orange);
}
.apply-menu__link svg { color: var(--text-muted); flex-shrink: 0; }
.apply-menu__link:hover svg { color: var(--orange); }

/* Right cluster ------------------------------------------------ */
.appbar__right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    position: relative;
}

/* Wallet pill -------------------------------------------------- */
.appbar__wallet {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #f9fafb;
    border: 1px solid var(--chrome-card-border);
    border-radius: 999px;
    padding: 6px 14px 6px 10px;
    text-decoration: none;
    color: var(--ink);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.appbar__wallet:hover {
    border-color: rgba(249, 115, 22, 0.5);
    background: #fff8f0;
    color: var(--orange);
}
.appbar__wallet-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
    flex-shrink: 0;
}

/* User pill ---------------------------------------------------- */
.appbar__user {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #f9fafb;
    border: 1px solid var(--chrome-card-border);
    border-radius: 999px;
    padding: 4px 12px 4px 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.appbar__user:hover {
    border-color: rgba(249, 115, 22, 0.5);
    background: #fff8f0;
}
.appbar__user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--orange), var(--orange-2));
    color: #fff;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    display: grid;
    place-items: center;
}
.appbar__user-chev {
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}
.appbar__user[aria-expanded="true"] .appbar__user-chev {
    transform: rotate(180deg);
}

/* Hamburger ---------------------------------------------------- */
.appbar__menu {
    background: transparent;
    border: 0;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: none;
    place-items: center;
    color: var(--ink);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.appbar__menu:hover { background: #f1f5f9; }

/* User menu (account dropdown panel) --------------------------- */
.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: #fff;
    border: 1px solid var(--chrome-card-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--transition-fast), visibility var(--transition-fast), transform var(--transition-fast);
    overflow: hidden;
    z-index: 50;
}
.user-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.user-menu__head {
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--chrome-card-border);
}
.user-menu__welcome {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0 0 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}
.user-menu__name {
    font-family: 'Geist', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--ink);
    margin: 0 0 0.75rem;
}
.user-menu__wallet {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(249, 115, 22, 0.1);
    color: var(--orange);
    padding: 6px 12px;
    border-radius: 999px;
    text-decoration: none;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    transition: background var(--transition-fast);
}
.user-menu__wallet strong { font-weight: 700; color: var(--orange); }
.user-menu__wallet:hover { background: rgba(249, 115, 22, 0.18); }
.user-menu__body { padding: 6px 0; }
.user-menu__link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 9px 16px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    color: var(--ink);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.user-menu__link:hover { background: #f9fafb; color: var(--orange); }
.user-menu__link svg { color: var(--text-muted); flex-shrink: 0; }
.user-menu__link:hover svg { color: var(--orange); }
.user-menu__link--danger:hover { color: #dc2626; }
.user-menu__link--danger:hover svg { color: #dc2626; }

/* ============================================================
   MOBILE DRAWER (slide-in from left, hamburger-triggered)
   ============================================================ */

.mobile-drawer-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 70;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
}
.mobile-drawer-overlay.is-open { opacity: 1; pointer-events: auto; }

.mobile-drawer {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 86%; max-width: 340px;
    background: #fff;
    z-index: 71;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}
.mobile-drawer.is-open { transform: translateX(0); }

.mobile-drawer__head {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--chrome-card-border);
    position: relative;
}
.mobile-drawer__close {
    position: absolute;
    top: 0.85rem; right: 0.85rem;
    background: transparent; border: 0;
    padding: 0.4rem;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    display: grid; place-items: center;
}
.mobile-drawer__close:hover { background: #f1f5f9; color: var(--ink); }
.mobile-drawer__avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(135deg, var(--orange), var(--purple));
    display: inline-block;
    margin-bottom: 0.7rem;
}
.mobile-drawer__avatar-inner {
    width: 100%; height: 100%;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #f1f5f9;
    display: grid; place-items: center;
    font-family: 'Geist', sans-serif;
    font-weight: 700;
    color: var(--orange);
    font-size: 16px;
}
.mobile-drawer__name {
    font-family: 'Geist', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    margin: 0;
    color: var(--ink);
}
.mobile-drawer__email {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0.55rem;
}
.mobile-drawer__body {
    flex: 1;
    padding: 0.5rem 0.5rem 0.75rem;
    overflow-y: auto;
}
.mobile-drawer__group { margin-bottom: 0.5rem; }
.mobile-drawer__group-label {
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    padding: 0.65rem 0.85rem 0.3rem;
}
.mobile-drawer__link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--ink);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    transition: background var(--transition-fast);
}
.mobile-drawer__link:hover { background: #f9fafb; }
.mobile-drawer__link.is-current {
    background: rgba(249, 115, 22, 0.08);
    color: var(--orange);
    font-weight: 600;
}
.mobile-drawer__foot {
    padding: 0.85rem 1rem 1rem;
    border-top: 1px solid var(--chrome-card-border);
}
.mobile-drawer__signout {
    width: 100%;
    background: transparent;
    border: 1px solid var(--chrome-card-border);
    color: var(--ink);
    padding: 0.7rem;
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.mobile-drawer__signout:hover { border-color: var(--red); color: var(--red); }

/* Drawer NEW badge */
.drawer-new {
    display: inline-flex;
    align-items: center;
    background: var(--orange);
    color: #fff;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: 9px;
    letter-spacing: 0.06em;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 0.5rem;
}

/* ============================================================
   MOBILE BOTTOM TAB BAR (under 900px)
   Sidebar replaced by bottom tabs on mobile
   ============================================================ */

.mobile-tabs { display: none; }

@media (max-width: 899px) {
    .mobile-tabs {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: #fff;
        border-top: 1px solid var(--chrome-card-border);
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
        z-index: 50;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    }
    .mobile-tabs__btn {
        position: relative;
        flex: 1;
        background: transparent;
        border: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 10px 4px;
        color: var(--text-muted);
        text-decoration: none;
        font-family: 'DM Sans', sans-serif;
        font-size: 11px;
        font-weight: 600;
        cursor: pointer;
        border-radius: 10px;
        transition: color var(--transition-fast);
    }
    .mobile-tabs__btn svg { width: 24px; height: 24px; stroke-width: 2; }
    .mobile-tabs__btn.is-active { color: var(--orange); }
    .mobile-tabs__btn.is-active::before {
        content: '';
        position: absolute;
        top: 0;
        width: 32px;
        height: 3px;
        background: var(--orange);
        border-radius: 0 0 3px 3px;
    }

    /* Body padding so bottom tab bar doesn't overlap content */
    body { padding-bottom: 76px; }
}

/* ============================================================
   APPBAR RESPONSIVE BREAKPOINTS
   ============================================================ */

@media (max-width: 1180px) {
    .appbar { gap: 0.85rem; padding: 10px 12px; }
    .appbar__nav { gap: 0.15rem; }
    .appbar__link { font-size: 0.9rem; padding: 7px 12px; }
}
@media (max-width: 1020px) {
    .appbar__nav { gap: 0.1rem; }
    .appbar__link { font-size: 0.85rem; padding: 7px 10px; }
    .appbar__wallet { font-size: 0.78rem; padding: 5px 12px 5px 9px; }
}

@media (max-width: 899px) {
    .appbar {
        padding: 10px 12px;
        gap: 0.5rem;
        height: 56px;
    }
    .appbar__logo { height: 32px; }
    .appbar__logo img { height: 32px; }
    /* Nav + user pill live in drawer on mobile */
    .appbar__nav { display: none; }
    .appbar__user { display: none; }
    /* Push wallet + hamburger to right edge */
    .appbar__right { margin-left: auto; }
    .appbar__wallet {
        padding: 5px 10px 5px 9px;
        font-size: 0.78rem;
        margin-left: 0;
    }
    .appbar__menu { display: grid; }
}

/* ============================================================
   LEGACY PAGE SPACING FIX
   30+ blades have `md:mt-[84px] mt-[70px]` on the first <section>
   to clear the OLD position:fixed #topnav. The new .appbar is
   in-flow (sticky), so these arbitrary-value Tailwind classes now
   create unwanted top gap.

   These arbitrary-value classes were used ONLY for topnav
   clearance — no other element on the platform uses 84px or 70px
   margin-top. Safe to zero globally.
   ============================================================ */
.mt-\[70px\] { margin-top: 0 !important; }
@media (min-width: 768px) {
    .md\:mt-\[84px\] { margin-top: 0 !important; }
}

/* ============================================================
   SIDEBAR — desktop-only
   The .sidebar-card (profile/avatar block in home.blade.php and
   any other dashboard page that uses it) is replaced on mobile
   by the hamburger drawer + bottom tab bar. Hide on small
   screens so it doesn't consume the entire first viewport.
   ============================================================ */
@media (max-width: 899px) {
    .sidebar-card { display: none !important; }
}

/* ============================================================
   GOOGLE TRANSLATE WIDGET (gt-fab)
   Floating language picker. Desktop: bottom-left as before.
   Mobile: lifted above the bottom tab bar with breathing room.
   Tighter padding on mobile so it reads as a compact pill.
   ============================================================ */
.gt-fab {
    position: fixed;
    left: 10px;
    bottom: 1.25rem;
    z-index: 50;
}
.gt-fab__inner {
    position: relative;
    display: inline-block;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--chrome-card-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.05);
}

@media (max-width: 899px) {
    .gt-fab {
        /* Clear the bottom tab bar (76px) + safe-area + 12px breathing room */
        bottom: calc(76px + env(safe-area-inset-bottom) + 12px);
        left: 8px;
    }
    .gt-fab__inner {
        padding: 0.5rem 0.7rem;
        border-radius: 10px;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.15);
    }
    /* Shrink Google's injected select to fit the compact pill */
    .gt-fab__inner .goog-te-gadget-simple {
        font-size: 0.78rem !important;
        padding: 2px 6px !important;
        border: 0 !important;
        background: transparent !important;
    }
    .gt-fab__inner .goog-te-gadget {
        font-size: 0.72rem !important;
    }
}

/* Always hide Google's powered-by branding rail (already hidden inline,
   re-asserted here so chrome.css owns the full widget styling) */
.gt-fab .VIpgJd-ZVi9od-l4eHX-hSRGPd,
.gt-fab .skiptranslate iframe { display: none !important; }

/* ============================================================
   SIDE-NAV ACTIVE STATE
   Pairs with `is-current` class added by route check in
   resources/views/components/side-nav.blade.php
   Replaces text-slate-400 on the current page's anchor so
   there's no Tailwind specificity war.
   ============================================================ */
.sidebar-nav li a.navbar-link {
    transition: background 0.15s ease, color 0.15s ease;
    padding-left: 10px;
    padding-right: 10px;
}
.sidebar-nav li a.navbar-link:hover:not(.is-current) {
    background: rgba(0, 0, 0, 0.03);
}
.sidebar-nav li a.navbar-link.is-current {
    background: rgba(249, 115, 22, 0.12);
    color: #f97316;
    font-weight: 600;
}
.sidebar-nav li a.navbar-link.is-current h6 {
    color: #f97316;
    font-weight: 600;
}
.sidebar-nav li a.navbar-link.is-current svg,
.sidebar-nav li a.navbar-link.is-current i[data-feather] {
    color: #f97316;
    stroke: #f97316;
}

/* Drawer icons (added by senior-frontend pass) */
.mobile-drawer__link {
    display: flex;
    align-items: center;
    gap: 14px;
}
.drawer-ico {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}
.mobile-drawer__link:hover .drawer-ico,
.mobile-drawer__link.is-current .drawer-ico {
    color: var(--orange);
}
.drawer-label {
    flex: 1;
}
