/* ─────────────────────────────────────────────────────────────────────────
   sidebar.css — shared sidebar styles for all DAYO InvestValue pages
   CSS variables use fallback pairs to support both naming conventions:
     index.html / financials.html → --text-1, --bg-card, --bg-page
     watchlist.html / earnings.html → --text1, --card, --bg
   ───────────────────────────────────────────────────────────────────────── */

/* ── Sidebar shell ── */
.sidebar {
    width: 240px; min-height: 100vh;
    background: var(--bg-card, var(--card));
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    overflow-y: auto;
}

/* ── Brand ── */
.sb-brand {
    display: block;
    padding: 14px 14px 12px; text-decoration: none;
    border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sb-logo-img {
    height: 38px; width: auto; flex-shrink: 0;
    display: block; border-radius: 6px;
}

/* ── Nav ── */
.sb-nav { padding: 10px; flex: 1; overflow-y: auto; }
.sb-section {
    font-size: .65rem; font-weight: 700; color: var(--text-3, var(--text3));
    text-transform: uppercase; letter-spacing: .7px; padding: 10px 8px 5px;
}
.sb-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 6px; text-decoration: none;
    font-size: .875rem; font-weight: 600; color: var(--text-2, var(--text2));
    transition: background .15s, color .15s; margin-bottom: 2px;
    border-left: 3px solid transparent;
}
.sb-link:hover  { background: var(--bg-page, var(--bg)); color: var(--text-1, var(--text1)); }
.sb-link.active { background: var(--blue-dim); color: var(--blue); border-left-color: var(--blue); }
.sb-link i      { width: 18px; text-align: center; font-size: .88rem; flex-shrink: 0; }
.sb-lock        { width: auto !important; margin-left: auto; font-size: .65rem !important; opacity: .65; color: var(--text-3, var(--text3)); flex-shrink: 0; }
.sb-premium-badge { margin-left: auto; font-size: .55rem; font-weight: 800; padding: 2px 6px; border-radius: 10px; background: linear-gradient(135deg,#2563eb,#7c3aed); color: #fff; letter-spacing: .04em; flex-shrink: 0; }

/* ── Footer ── */
.sb-footer { padding: 10px; border-top: 1px solid var(--border); flex-shrink: 0; }
.sb-user {
    display: flex; align-items: center; gap: 9px; padding: 9px 10px;
    border-radius: 6px; text-decoration: none; color: var(--text-1, var(--text1));
    transition: background .15s; margin-bottom: 5px;
}
.sb-user:hover   { background: var(--bg-page, var(--bg)); }
.sb-avatar {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
    background: #e2e8f0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; font-weight: 700; color: #fff;
}
.sb-avatar img    { width: 100%; height: 100%; object-fit: cover; }
.sb-user-info     { flex: 1; min-width: 0; }
.sb-user-name     { font-size: .82rem; font-weight: 700; color: var(--text-1, var(--text1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role                { font-size: .68rem; color: var(--text-3, var(--text3)); }
.sb-role-premium             { color: #d97706; font-weight: 700; }
.sb-role-premium .fa-crown   { font-size: .65rem; margin-right: 2px; }
.sb-signout {
    width: 100%; padding: 8px; border-radius: 6px; font-size: .82rem; font-weight: 600;
    border: 1px solid var(--border); background: transparent; color: var(--text-2, var(--text2));
    cursor: pointer; font-family: inherit; transition: .15s;
    display: flex; align-items: center; justify-content: center; gap: 7px;
}
.sb-signout:hover { border-color: var(--red); color: var(--red); background: rgba(220,38,38,.05); }
.sb-auth-btns { display: flex; flex-direction: column; gap: 7px; }
.sb-btn-primary {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px; border-radius: 6px; font-size: .85rem; font-weight: 700;
    text-decoration: none; background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff;
    transition: opacity .15s;
}
.sb-btn-primary:hover   { opacity: .88; }
.sb-btn-secondary {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px; border-radius: 6px; font-size: .85rem; font-weight: 600;
    text-decoration: none; background: transparent;
    border: 1.5px solid var(--border); color: var(--text-2, var(--text2)); transition: .15s;
}
.sb-btn-secondary:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-dim); }

/* ── Auth loading skeleton ── */
.sb-auth-loading { display: flex; flex-direction: column; gap: 7px; }
.sb-skel-btn {
    height: 38px; border-radius: 6px;
    background: linear-gradient(90deg, #e8edf3 25%, #f1f5f9 50%, #e8edf3 75%);
    background-size: 200% 100%;
    animation: sb-skel-pulse 1.4s ease infinite;
}
@keyframes sb-skel-pulse {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Alerts bell in sidebar nav ── */
.sb-alert-btn {
    display: flex; /* always visible; sidebar.js handles lock/badge visibility */
    align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 6px; text-decoration: none;
    font-size: .875rem; font-weight: 600; color: var(--text-2, var(--text2));
    transition: background .15s, color .15s; margin-bottom: 2px;
    border-left: 3px solid transparent; width: 100%; border-top: none;
    border-right: none; border-bottom: none; background: none; cursor: pointer;
    font-family: inherit; text-align: left;
}
.sb-alert-btn:hover { background: var(--bg-page, var(--bg)); color: var(--text-1, var(--text1)); }
.sb-alert-btn.sb-disabled { opacity: .55; cursor: default; pointer-events: none; }
.sb-alert-btn.active { background: var(--blue-dim); color: var(--blue); border-left-color: var(--blue); }
.sb-alert-btn i     { width: 18px; text-align: center; font-size: .88rem; flex-shrink: 0; }
.sb-alert-badge {
    margin-left: auto; min-width: 18px; height: 18px; border-radius: 9px;
    background: #dc2626; color: #fff; font-size: .62rem; font-weight: 800;
    display: none; align-items: center; justify-content: center; padding: 0 5px;
    line-height: 1;
}
.sb-alert-badge.visible { display: flex; }

/* ── Alert dropdown panel ── */
.sb-alert-panel {
    display: none; position: fixed; top: 0; left: 240px; width: 360px; max-height: 100vh;
    background: var(--bg-card, #fff); border-right: 1px solid var(--border);
    border-left: 1px solid var(--border); box-shadow: 4px 0 24px rgba(0,0,0,.12);
    z-index: 101; flex-direction: column; overflow: hidden;
}
.sb-alert-panel.open { display: flex; }
.sb-ap-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 12px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sb-ap-title  { font-size: .9rem; font-weight: 700; color: var(--text-1, #1a2332); }
.sb-ap-actions { display: flex; gap: 8px; align-items: center; }
.sb-ap-mark-all {
    font-size: .75rem; font-weight: 600; color: var(--text-3, #94a3b8);
    background: none; border: none; cursor: pointer; font-family: inherit; padding: 2px 4px;
    transition: color .15s;
}
.sb-ap-mark-all:hover { color: var(--blue, #2563eb); }
.sb-ap-close {
    width: 26px; height: 26px; border-radius: 6px; background: var(--bg-page, #f0f4f9);
    border: none; cursor: pointer; font-size: .85rem; color: var(--text-2, #4a5568);
    display: flex; align-items: center; justify-content: center; transition: .15s;
}
.sb-ap-close:hover { background: var(--border); }
.sb-ap-list  { flex: 1; overflow-y: auto; padding: 8px 0; }
.sb-ap-empty { padding: 32px 16px; text-align: center; color: var(--text-3, #94a3b8); font-size: .82rem; }
.sb-ap-item  {
    display: flex; gap: 10px; padding: 11px 16px; cursor: pointer;
    border-left: 3px solid transparent; transition: background .12s;
}
.sb-ap-item:hover { background: var(--bg-page, #f0f4f9); }
.sb-ap-item.unread { background: rgba(37,99,235,.03); }
.sb-ap-item.unread .sb-ap-ititle { font-weight: 700; }
.sb-ap-sev  { width: 6px; border-radius: 3px; flex-shrink: 0; margin-top: 3px; align-self: stretch; min-height: 36px; }
.sb-ap-sev.info    { background: #2563eb; }
.sb-ap-sev.success { background: #059669; }
.sb-ap-sev.warning { background: #d97706; }
.sb-ap-sev.danger  { background: #dc2626; }
.sb-ap-body { flex: 1; min-width: 0; }
.sb-ap-meta  { font-size: .68rem; color: var(--text-3, #94a3b8); margin-bottom: 2px; }
.sb-ap-ititle { font-size: .8rem; color: var(--text-1, #1a2332); line-height: 1.4; margin-bottom: 2px; }
.sb-ap-signal { font-size: .7rem; color: var(--text-3, #94a3b8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-ap-footer {
    border-top: 1px solid var(--border); padding: 10px 16px; flex-shrink: 0;
}
.sb-ap-view-all {
    display: block; text-align: center; padding: 9px; border-radius: 6px;
    font-size: .8rem; font-weight: 600; color: var(--blue, #2563eb);
    text-decoration: none; background: var(--blue-dim, rgba(37,99,235,.08));
    transition: opacity .15s;
}
.sb-ap-view-all:hover { opacity: .8; }

/* ── Mobile bar bell ── */
.mb-bell {
    margin-left: auto; position: relative; background: none; border: none;
    cursor: pointer; color: var(--text-2, #4a5568); font-size: 1.1rem;
    padding: 4px 6px; line-height: 1;
}
.mb-bell-badge {
    position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px;
    border-radius: 8px; background: #dc2626; color: #fff; font-size: .58rem;
    font-weight: 800; display: none; align-items: center; justify-content: center;
    padding: 0 4px; line-height: 1;
}
.mb-bell-badge.visible { display: flex; }

/* ── Overlay for alert panel ── */
.sb-ap-overlay { display: none; position: fixed; inset: 0; z-index: 100; }
.sb-ap-overlay.open { display: block; }

/* ── Overlay & layout ── */
.sb-overlay {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,.35);
    z-index: 99; backdrop-filter: blur(3px);
}
.sb-overlay.open { display: block; }
.main-wrap { flex: 1; margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }

/* ── Mobile bar ── */
.mobile-bar {
    display: none; align-items: center; gap: 12px; padding: 12px 16px;
    background: var(--bg-card, var(--card)); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 90; box-shadow: 0 1px 8px rgba(0,0,0,.06);
}
.hamburger    { background: none; border: none; cursor: pointer; color: var(--text-1, var(--text1)); font-size: 1.1rem; padding: 4px; line-height: 1; }
.mobile-brand { font-size: .9rem; font-weight: 800; color: var(--text-1, var(--text1)); }

@media (max-width: 768px) {
    .sidebar      { transform: translateX(-100%); transition: transform .25s ease; }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.12); }
    .main-wrap    { margin-left: 0; }
    .mobile-bar   { display: flex; }
}

/* ── Compare crown icon in sidebar nav ── */
.sb-crown-wrap {
    margin-left: auto; display: inline-flex; align-items: center;
    color: #d97706; font-size: .72rem; flex-shrink: 0; cursor: pointer;
}
.sb-crown-tooltip {
    position: fixed; background: #1e293b; color: #fff;
    font-size: .72rem; font-weight: 600; padding: 5px 10px; border-radius: 6px;
    white-space: nowrap; opacity: 0; pointer-events: none;
    transition: opacity .15s; z-index: 500;
}
.sb-crown-tooltip.visible { opacity: 1; }


/* ── Guest wall (shared across compare, future pages) ── */
.guest-wrap {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 60px 20px;
}
.guest-card {
    background: var(--bg-card, var(--card)); border-radius: 18px;
    box-shadow: 0 8px 48px rgba(0,0,0,.09); padding: 52px 44px;
    text-align: center; max-width: 460px; width: 100%;
    border: 1px solid var(--border);
}
.guest-icon   { font-size: 52px; margin-bottom: 20px; display: block; }
.guest-card h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.4px; margin-bottom: 10px; color: var(--text-1, var(--text1)); }
.guest-card p  { color: var(--text-2, var(--text2)); font-size: .88rem; line-height: 1.7; margin-bottom: 26px; }
.guest-btns   { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-primary-lnk {
    padding: 11px 26px; border-radius: 7px; font-size: .88rem; font-weight: 700;
    text-decoration: none; background: linear-gradient(135deg, var(--blue, #2563eb), var(--purple, #7c3aed));
    color: #fff; display: inline-flex; align-items: center; gap: 7px; transition: opacity .15s;
}
.btn-primary-lnk:hover { opacity: .88; }
.btn-secondary-lnk {
    padding: 11px 26px; border-radius: 7px; font-size: .88rem; font-weight: 600;
    text-decoration: none; background: transparent; color: var(--text-1, var(--text1));
    border: 1.5px solid var(--border); display: inline-flex; align-items: center; gap: 7px; transition: .15s;
}
.btn-secondary-lnk:hover { border-color: var(--blue, #2563eb); color: var(--blue, #2563eb); }

/* ── Crown tooltip on dashboard/page buttons ── */
.prem-tip-btn { position: relative; }
.prem-tip-btn::after {
    content: attr(data-tip);
    position: absolute; bottom: calc(100% + 7px); left: 50%;
    transform: translateX(-50%); background: #1e293b; color: #fff;
    font-size: .7rem; font-weight: 600; padding: 5px 10px;
    border-radius: 6px; white-space: nowrap; opacity: 0;
    pointer-events: none; transition: opacity .15s; z-index: 300;
}
.prem-tip-btn:hover::after { opacity: 1; }
