/* ==========================================================================
   shared.css — Shared styles for yessahblessah.cc
   Sidebar, variables, reset, scrollbar, hamburger, overlay, responsive
   ========================================================================== */

/* RESET */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* DESIGN TOKENS — DARK (default) */
:root {
    --bg: #08080c;
    --surface: #111116;
    --surface2: #18181e;
    --surface3: #1f1f26;
    --border: #222228;
    --border-subtle: #1a1a1f;
    --gold: #c9a227;
    --gold-dim: #a38420;
    --gold-glow: rgba(201, 162, 39, 0.08);
    --text: #e8e8ec;
    --text-dim: #6b6b78;
    --text-muted: #4a4a55;
    --accent: #22c55e;
    --accent-dim: rgba(34, 197, 94, 0.1);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.1);
}
/* DESIGN TOKENS — LIGHT */
[data-theme="light"] {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --surface2: #f0f0f0;
    --surface3: #e8e8e8;
    --border: #d4d4d4;
    --border-subtle: #e5e5e5;
    --gold: #b8960f;
    --gold-dim: #9a7d0d;
    --gold-glow: rgba(184, 150, 15, 0.08);
    --text: #1a1a1a;
    --text-dim: #666666;
    --text-muted: #999999;
    --accent: #16a34a;
    --accent-dim: rgba(22, 163, 74, 0.08);
    --red: #dc2626;
    --red-dim: rgba(220, 38, 38, 0.08);
}

/* BODY */
html {
    background: var(--surface);
    height: 100%;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-weight: 300;
    max-width: 100vw;
    margin: 0;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}
/* Grain texture overlay — gives depth, removes AI-clean look */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.035;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-size: 180px 180px;
}
/* Selection color */
::selection {
    background: var(--gold);
    color: #000;
}
/* Scroll container for mobile (Android WebView fix) — only when bottom-nav exists */
@media (max-width: 768px) {
    body.has-bottomnav {
        height: 100%;
    }
    #app-scroll {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        min-height: 100dvh;
    }
    #app-scroll > .main-content,
    #app-scroll > main {
        flex: 1;
    }
}
#app-scroll {
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}
.mono { font-family: 'JetBrains Mono', monospace; }

/* SERIF HEADINGS — Playfair Display */
.serif { font-family: 'Playfair Display', Georgia, serif; font-weight: 400; }

/* DISPLAY / ACCENT — Bebas Neue */
.display { font-family: 'Bebas Neue', Impact, sans-serif; font-weight: 400; letter-spacing: 0.04em; text-transform: uppercase; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* SIDEBAR */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 200;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px 20px;
    text-decoration: none;
    color: var(--text);
}

.sidebar-logo img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.sidebar-logo-text {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.3px;
}

.sidebar-logo-sub {
    font-size: 10px;
    color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-price {
    padding: 0 16px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-price-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.sidebar-price-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 400;
    color: var(--text);
    letter-spacing: -0.5px;
    margin-bottom: 2px;
}

.sidebar-price-change {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    margin-bottom: 8px;
}

.sidebar-price-change.up { color: var(--accent); }
.sidebar-price-change.down { color: var(--red); }

.sidebar-sparkline {
    display: flex;
    align-items: flex-end;
    gap: 1px;
    height: 32px;
}

.sidebar-sparkline .bar {
    width: 2px;
    background: var(--gold);
    border-radius: 1px;
    min-height: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-nav > a,
.sidebar-nav > a,
.sidebar-submenu > a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.1s, background 0.1s;
    cursor: pointer;
    letter-spacing: 0.01em;
}

.sidebar-nav > a:hover,
.sidebar-submenu > a:hover {
    color: var(--text);
    background: var(--gold-glow);
}

.sidebar-nav > a.active {
    color: var(--gold);
    background: var(--gold-glow);
    border-left: 2px solid var(--gold);
    padding-left: 14px;
}

.sidebar-nav > a svg,
.sidebar-submenu > a svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.sidebar-nav > a:hover svg,
.sidebar-nav > a.active svg,
.sidebar-submenu > a:hover svg {
    opacity: 1;
}

.submenu-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s;
}

.sidebar-submenu.open .submenu-arrow {
    transform: rotate(90deg);
}

.submenu-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.sidebar-submenu.open .submenu-items {
    max-height: 100px;
}

.submenu-items a {
    display: block;
    padding-top: 4px;
    padding-bottom: 4px;
    padding-left: 42px !important;
    font-size: 12px !important;
    color: var(--text-dim) !important;
    text-decoration: none;
}

.submenu-items a:hover {
    color: var(--text) !important;
}
.submenu-items a.active {
    color: var(--gold) !important;
}

.sidebar-bottom {
    padding: 16px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.sidebar-bottom a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.15s;
}

.sidebar-bottom a:first-child {
    color: var(--gold);
    font-weight: 500;
    font-size: 13px;
    padding: 8px 0;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

/* THEME TOGGLE */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    margin-top: 8px;
    border-top: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-dim);
    font-size: 12px;
    transition: color 0.1s;
}
.theme-toggle:hover {
    color: var(--text);
}
.theme-toggle-btn {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}
.theme-toggle-btn::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: var(--gold);
    border-radius: 50%;
    transition: transform 0.2s;
}
[data-theme="light"] .theme-toggle-btn::after {
    transform: translateX(16px);
}

.sidebar-bottom a:hover {
    color: var(--text);
}

.sidebar-bottom a svg {
    flex-shrink: 0;
}

/* TOP BAR (fixed container for login button) */
.top-bar {
    display: none;
    position: absolute;
    top: 12px;
    right: 16px;
    z-index: 250;
}

/* USER MENU */
.user-menu {
    position: relative;
}
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 6px 10px;
    cursor: pointer;
    transition: border-color 0.1s;
}
.user-menu-btn:hover {
    border-color: var(--gold);
}
.user-avatar-sm {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gold);
    color: #000;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 160px;
    padding: 4px 0;
    z-index: 300;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.user-dropdown.open {
    display: block;
}
.user-dropdown a,
.user-dropdown button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-family: 'Inter', -apple-system, sans-serif;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
}
.user-dropdown a:hover,
.user-dropdown button:hover {
    background: rgba(255,255,255,0.05);
}
.user-dropdown a svg,
.user-dropdown button svg {
    opacity: 0.6;
}
/* TOP LOGIN BUTTON (when not logged in) */
.top-login-btn {
    display: block;
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: 8px;
    color: var(--gold);
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', -apple-system, sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
}
.top-login-btn:hover {
    background: var(--gold);
    color: #000;
}

/* HAMBURGER BUTTON */
.sidebar-hamburger {
    display: none;
    position: fixed;
    top: 14px;
    right: 14px;
    left: auto;
    z-index: 250;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.1s;
}

.sidebar-hamburger:hover {
    border-color: var(--gold-dim);
}

/* CLOSE BUTTON */
.sidebar-close {
    display: none;
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 260;
}
.sidebar.open .sidebar-close {
    display: flex;
}

/* SIDEBAR OVERLAY */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 190;
}

.sidebar-overlay.active {
    display: block;
}

/* MAIN CONTENT SHIFT */
.main-content {
    margin-left: 220px;
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .sidebar {
        display: none !important;
    }
    .sidebar-hamburger {
        display: none !important;
    }
    .top-bar {
        display: block !important;
        top: 8px;
        right: 12px;
    }
    .top-login-btn {
        font-size: 12px;
        padding: 6px 14px;
    }
    .main-content {
        margin-left: 0;
        padding-bottom: 72px;
    }
    /* Mobile theme toggle */
    .mobile-theme-toggle {
        display: flex !important;
        position: fixed;
        top: 8px;
        left: 12px;
        z-index: 250;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 6px 10px;
        cursor: pointer;
        align-items: center;
        gap: 6px;
        font-size: 11px;
        color: var(--text-dim);
        transition: border-color 0.1s;
    }
    .mobile-theme-toggle:hover {
        border-color: var(--gold);
    }
}

/* MOBILE BOTTOM BAR */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 200;
    justify-content: space-around;
    align-items: center;
    padding: 0 4px;
}
.bottom-nav::after {
    display: none;
}
.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    font-family: 'Inter', -apple-system, sans-serif;
    padding: 6px 10px;
    border-radius: 8px;
    transition: color 0.1s;
    -webkit-tap-highlight-color: transparent;
    min-width: 0;
    flex: 1;
}
.bottom-nav a.active {
    color: var(--gold);
}
.bottom-nav a:hover {
    color: var(--text);
}
.bottom-nav a svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.bottom-nav a span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
    }
}

/* MOBILE SIDEBAR (slide-in from left, CCTools style) */
.mobile-sidebar {
    display: none;
}
.mobile-sidebar.open {
    display: block;
}
.ms-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 300;
}
.ms-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 82%;
    max-width: 300px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 301;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.ms-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.ms-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ms-brand img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}
.ms-brand-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    display: block;
    line-height: 1.2;
}
.ms-brand-sub {
    font-size: 9px;
    letter-spacing: 1.2px;
    color: var(--text-dim);
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
    display: block;
}
.ms-close {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 16px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.ms-close:active { color: var(--text); }
.ms-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.ms-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    overflow: hidden;
    flex-shrink: 0;
}
.ms-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ms-uname {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    display: block;
}
.ms-ulevel {
    font-size: 11px;
    color: var(--text-dim);
    display: block;
}
.ms-price {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.ms-price-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.ms-price-amount {
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 400;
    color: var(--text);
    display: block;
    margin-bottom: 4px;
}
.ms-price-change {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    margin-bottom: 6px;
}
.ms-price-change.up { color: var(--accent); }
.ms-price-change.down { color: var(--red); }
.ms-sparkline {
    width: 100%;
    height: 28px;
}
.ms-sparkline svg {
    width: 100%;
    height: 100%;
}
.ms-nav {
    padding: 8px 0;
    flex: 1;
}
.ms-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}
.ms-nav a:active {
    background: rgba(255,255,255,0.04);
}
.ms-nav a.active {
    background: rgba(255,255,255,0.06);
    border-left-color: var(--gold);
    color: var(--text);
}
.ms-nav a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.6;
}
.ms-nav a.active svg { opacity: 1; }
/* Mobile sidebar submenu */
.ms-submenu {
    /* container */
}
.ms-submenu > a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}
.ms-submenu > a:active {
    background: rgba(255,255,255,0.04);
}
.ms-submenu > a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.6;
}
.ms-arrow {
    margin-left: auto;
    font-size: 13px;
    transition: transform 0.2s;
}
.ms-submenu.open .ms-arrow {
    transform: rotate(90deg);
}
.ms-submenu-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.ms-submenu.open .ms-submenu-items {
    max-height: 120px;
}
.ms-submenu-items a {
    display: block;
    padding: 8px 16px 8px 44px;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 12px;
    transition: color 0.15s;
}
.ms-submenu-items a:active {
    color: var(--text);
}
.ms-submenu-items a.active {
    color: var(--gold);
}
.ms-social {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}
.ms-social a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-dim);
    font-size: 12px;
}
.ms-social a svg {
    width: 14px;
    height: 14px;
}
.ms-login {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}
.ms-login a {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--gold);
    font-size: 13px;
    font-weight: 500;
}
.ms-login a svg {
    width: 18px;
    height: 18px;
}
