/*
 * StockSphere — Premium TradingView-Style Light Theme
 * v3.0 Clean Rewrite
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================
   CSS CUSTOM PROPERTIES
============================================ */
:root {
    /* Backgrounds */
    --bg: #F0F3FA;
    --surface: #FFFFFF;
    --surface-alt: #FCFCFD;
    --card-bg: #FFFFFF;         /* alias for --surface */
    --bg-hover: #E8ECF4;        /* slightly darker hover state */

    /* Borders */
    --border: #E0E3EB;
    --border-hover: #B2B5BE;

    /* Brand Colors matching Logo */
    --primary: #11A5A5;         /* Sphere Teal */
    --primary-dark: #0E4B75;    /* Stock Navy */
    --primary-bg: rgba(17, 165, 165, 0.08);
    --primary-light: rgba(17, 165, 165, 0.25);
    --primary-hover: #0d8f8f;
    --logo-gradient: linear-gradient(90deg, #E52243 0%, #F76B1C 50%, #FFC80A 100%);

    /* Status Colors */
    --bullish: #089981;
    --bullish-bg: rgba(8, 153, 129, 0.10);
    --bearish: #F23645;
    --bearish-bg: rgba(242, 54, 69, 0.10);
    --alert: #F6A623;
    --alert-bg: rgba(246, 166, 35, 0.10);
    --accent: #F6A623;          /* alias for --alert */

    /* Typography */
    --text: #131722;
    --text-main: #131722;
    --text-secondary: #475569;
    --text-muted: #787B86;
    --text-faint: #B2B5BE;
    --brand-dark: #0E4B75;      /* alias for --primary-dark */

    /* Layout */
    --sidebar-width: 240px;
    --header-height: 60px;

    /* Effects */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --transition: all 0.14s ease;

    /* Font */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ============================================
   RESET & BASE
============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { height: 100%; }

body {
    font-family: var(--font);
    background-color: #F0F3FA;
    background-color: var(--bg);
    color: #131722;
    color: var(--text);
    line-height: 1.5;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: inherit; }
button, input, select, textarea { font-family: var(--font); }

/* ============================================
   APP LAYOUT  — flex row: sidebar | main-wrapper
============================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ============================================
   SIDEBAR NAVIGATION
============================================ */
.sidebar-nav {
    width: 240px;
    width: var(--sidebar-width);
    background: #FFFFFF;
    background: var(--surface);
    border-right: 1px solid #E0E3EB;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 1rem;
    height: 72px;
    height: var(--header-height);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-logo a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 0;
    background: transparent;
    border-radius: 0;
    transition: opacity 0.15s;
    box-shadow: none;
}

.sidebar-logo a:hover {
    opacity: 0.85;
}

/* Sized larger since logo is now a premium horizontal format */
.sidebar-logo-img {
    height: 44px;
    width: auto;
    max-width: 180px;
    display: block;
    object-fit: contain;
}

/* Login page logo — on white card, direct display */
.login-logo { text-align: center; margin-bottom: 2.25rem; }
.login-logo-img {
    height: 64px;
    width: auto;
    max-width: 280px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

.sidebar-logo h1 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
    white-space: nowrap;
}

.sidebar-menu {
    flex: 1;
    padding: 0.875rem 0.75rem;
    overflow-y: auto;
}

.menu-section { margin-bottom: 1.125rem; }

.menu-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 0.625rem;
    margin-bottom: 0.35rem;
    margin-top: 0.25rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.625rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: var(--transition);
    margin-bottom: 0.05rem;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

.menu-item:hover { color: var(--text); background: var(--bg); border-left-color: var(--primary-light); }
.menu-item.active { color: #fff; background: var(--primary); font-weight: 600; border-left: 3px solid var(--primary-dark); }

.menu-item-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity 0.14s;
}

.menu-item.active .menu-item-icon { opacity: 1; }
.menu-item:hover .menu-item-icon  { opacity: 0.9; }

/* Inline SVG nav icons */
.nav-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.7;
    transition: opacity 0.14s;
}

.menu-item:hover .nav-icon  { opacity: 1; }
.menu-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.sidebar-footer a {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.25rem 0.4rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: block;
}

.sidebar-footer a:hover { color: var(--text); background: var(--bg); }

/* ============================================
   MAIN WRAPPER
============================================ */
.main-wrapper {
    flex: 1;
    margin-left: 240px;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    background: var(--bg);
}

/* ============================================
   TOP HEADER
============================================ */
header {
    background: #FFFFFF;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: 60px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 150;
    flex-shrink: 0;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--logo-gradient);
}

.header-search {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.header-search::before {
    content: '';
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.78rem;
    opacity: 0.5;
    pointer-events: none;
    z-index: 1;
}

.header-search input {
    width: 100%;
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.44rem 0.75rem 0.44rem 2.1rem;
    font-size: 0.875rem;
    color: var(--text);
    outline: none;
    transition: var(--transition);
}

.header-search input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.header-search input::placeholder { color: var(--text-muted); }

.header-right {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-left: auto;
}

.header-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

.header-icon:hover { background: var(--bg); color: var(--text); }

/* Wallet Widget */
.wallet-widget {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.wallet-widget:hover { background: var(--bg); }

/* ============================================
   PROFILE DROPDOWN
============================================ */
.profile-dropdown { position: relative; }

.avatar-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.5rem 0.28rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface);
}

.avatar-badge:hover { background: var(--bg); }

.avatar-hamburger {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1;
}

.avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    flex-shrink: 0;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 272px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 300;
    overflow: hidden;
}

.profile-dropdown.active .dropdown-menu { display: block; }

.user-info-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.user-info-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-info-detail { display: flex; flex-direction: column; gap: 0.1rem; }
.user-info-name { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.user-info-role { font-size: 0.72rem; color: var(--primary); font-weight: 600; }

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.58rem 1.25rem;
    color: var(--text);
    font-size: 0.875rem;
    transition: var(--transition);
    cursor: pointer;
}

.dropdown-item:hover { background: var(--bg); }
.dropdown-item-left { display: flex; align-items: center; gap: 0.7rem; }

.dropdown-item-val {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

/* Toggle Switch */
.switch-control {
    width: 34px;
    height: 19px;
    background: var(--text-faint);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.switch-control::after {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch-control.active { background: var(--primary); }
.switch-control.active::after { left: 17px; }

/* ============================================
   MAIN CONTENT
============================================ */
main {
    flex: 1;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

/* ============================================
   ALERT BANNER
============================================ */
.alert-banner {
    display: none;
    align-items: center;
    gap: 0.5rem;
    background: var(--bearish-bg);
    border: 1px solid var(--bearish);
    color: var(--bearish);
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.alert-banner.show { display: flex; }

/* ============================================
   MARKET TYPE TABS  (Stocks | Crypto | Indices…)
============================================ */
.tabs-container {
    display: flex;
    align-items: center;
    background: #FFFFFF;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    gap: 0;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.tabs-container::-webkit-scrollbar {
    display: none;  /* Chrome, Safari and Opera */
}

.tab-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.82rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    cursor: pointer;
    margin-bottom: -1px;
}

.tab-link:hover { color: var(--text); }
.tab-link.active { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }

.tab-badge {
    font-size: 0.57rem;
    font-weight: 700;
    background: var(--primary);
    color: #fff;
    padding: 1px 5px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

/* ============================================
   INDICES CARDS  (4-column grid)
============================================ */
.indices-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--border);
    border: 1px solid var(--border);
    gap: 1px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex-shrink: 0;
}

.index-card {
    background: #FFFFFF;
    background: var(--surface);
    padding: 0.875rem 1.125rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    cursor: pointer;
    transition: background 0.12s;
}

.index-card:hover { background: #FCFCFD; background: var(--surface-alt); }

.index-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}

.index-title {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

.index-change {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    white-space: nowrap;
}

.index-change.bullish { background: var(--bullish-bg); color: var(--bullish); }
.index-change.bearish { background: var(--bearish-bg); color: var(--bearish); }

.index-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.index-sparkline {
    margin-top: 0.5rem;
    height: 40px;
    width: 100%;
    overflow: hidden;
}

.index-sparkline svg { width: 100%; height: 100%; display: block; }

/* ============================================
   SCREENER GRID  (sidebar + table)
============================================ */
.grid-screener {
    display: grid;
    grid-template-columns: 268px 1fr;
    gap: 1rem;
    align-items: start;
    flex: 1;
}

.screener-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    position: sticky;
    top: calc(60px + 1.25rem);
    top: calc(var(--header-height) + 1.25rem);
    max-height: calc(100vh - 60px - 2.5rem);
    max-height: calc(100vh - var(--header-height) - 2.5rem);
    overflow-y: auto;
}

/* ============================================
   CARD
============================================ */
.card {
    background: #FFFFFF;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.125rem;
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.875rem;
}

/* ============================================
   DASHBOARD CONTENT AREA
============================================ */
.dashboard-content { display: flex; flex-direction: column; gap: 0; }

/* ============================================
   SUB-TABS ROW  (Companies | Sectors | Industries…)
============================================ */
.sub-tabs-section {
    background: #FFFFFF;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    overflow-x: auto;
    flex-wrap: nowrap;
}

/* Backward compat alias */
.sub-tabs { display: flex; gap: 0.25rem; }

.sub-tab-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.38rem 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    outline: none;
    font-family: var(--font);
}

.sub-tab-btn:hover { color: var(--text); border-color: var(--border-hover); background: var(--bg); }
.sub-tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

/* ============================================
   TABLE CARD
============================================ */
.table-card {
    background: #FFFFFF;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
}

/* Standalone table card (without sub-tabs-section above) */
.card.table-card { border-radius: var(--radius-lg); }

.table-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 0.75rem;
    flex-wrap: wrap;
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.845rem;
    text-align: left;
}

th {
    background: #FCFCFD;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.62rem 1rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    user-select: none;
    cursor: pointer;
}

th:hover { color: var(--text); }
th.sorted-asc::after  { content: ' ▲'; font-size: 0.6rem; opacity: 0.7; }
th.sorted-desc::after { content: ' ▼'; font-size: 0.6rem; opacity: 0.7; }

td {
    padding: 0.68rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
    white-space: nowrap;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: #FAFBFD; }

/* ============================================
   TABLE CELL COMPONENTS
============================================ */
.watchlist-star {
    font-size: 1rem;
    color: var(--text-faint);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    display: inline-block;
}

.watchlist-star:hover { color: var(--alert); }
.watchlist-star.active { color: var(--alert); }

.company-badge-container {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 150px;
}

.company-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--primary);
    flex-shrink: 0;
}

.company-info { display: flex; flex-direction: column; gap: 0.05rem; }

.company-symbol {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
}

.company-symbol:hover { color: var(--primary); }
.company-name { font-size: 0.68rem; color: var(--text-muted); }

.text-bullish { color: var(--bullish) !important; font-weight: 600; }
.text-bearish { color: var(--bearish) !important; font-weight: 600; }
.text-alert { color: var(--alert) !important; }

.table-sparkline-cell { padding: 0.3rem 1rem; min-width: 100px; }

.table-sparkline-svg {
    width: 80px;
    height: 24px;
    overflow: visible;
    display: block;
}

/* ============================================
   STATUS BAR
============================================ */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0.45rem 0.65rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 0.45rem;
    border: 1px solid var(--border);
}

.status-label {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 0.32rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-faint);
    flex-shrink: 0;
}

.status-pill.live .status-indicator {
    background: var(--bullish);
    box-shadow: 0 0 0 3px rgba(8, 153, 129, 0.2);
}

.status-pill.stale .status-indicator {
    background: var(--alert);
    box-shadow: 0 0 0 3px rgba(246, 166, 35, 0.2);
}

.status-pill.closed .status-indicator { background: var(--text-faint); }

/* ============================================
   SCREENING STRATEGY ITEMS
============================================ */
.strategy-list { display: flex; flex-direction: column; gap: 0.375rem; }

.strategy-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.strategy-item:hover { border-color: var(--primary); }
.strategy-item.active { border-color: var(--primary); background: rgba(41, 98, 255, 0.02); }

.strategy-header { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.strategy-name { font-size: 0.835rem; font-weight: 600; color: var(--text); }

.strategy-checkbox {
    width: 15px;
    height: 15px;
    border-radius: 4px;
    border: 1.5px solid var(--border-hover);
    display: inline-block;
    flex-shrink: 0;
    transition: var(--transition);
    background: var(--surface);
}

.strategy-item.active .strategy-checkbox { background: var(--primary); border-color: var(--primary); }

.strategy-desc { font-size: 0.73rem; color: var(--text-muted); line-height: 1.4; margin-top: 0.2rem; }

.strategy-params { display: none; margin-top: 0.45rem; padding-top: 0.45rem; border-top: 1px dashed var(--border); }
.strategy-item.active .strategy-params { display: block; }

.param-slider { width: 100%; accent-color: var(--primary); cursor: pointer; margin-top: 0.25rem; }
.param-label { font-size: 0.72rem; color: var(--text-muted); }
.param-group { margin-top: 0.25rem; }

/* ============================================
   SECTOR ROLLUP
============================================ */
.sector-rollup-list { display: flex; flex-direction: column; gap: 0.25rem; }

.sector-rollup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sector-rollup-item:hover { background: var(--bg); }
.sector-name { color: var(--text); font-weight: 500; }
.sector-gap { font-weight: 600; }

/* ============================================
   FORM ELEMENTS
============================================ */
.form-group { margin-bottom: 1rem; }

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.form-control {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.58rem 0.85rem;
    font-size: 0.875rem;
    color: var(--text);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

select.form-control { cursor: pointer; }

/* ============================================
   BUTTONS
============================================ */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    border: none;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: block;
    width: 100%;
    text-align: center;
    font-family: var(--font);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #093c61, #0e8f8f);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}

.btn-secondary:hover { color: var(--text); background: var(--surface); border-color: var(--border-hover); }

/* ============================================
   LOGIN PAGE
============================================ */
.login-wrapper {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 1.5rem;
}

.login-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}

.login-title { text-align: center; font-size: 1.5rem; font-weight: 700; color: var(--text); margin-bottom: 0.35rem; }
.login-subtitle { text-align: center; font-size: 0.875rem; color: var(--text-muted); margin-bottom: 2rem; }

.error-alert {
    background: var(--bearish-bg);
    border: 1px solid var(--bearish);
    color: var(--bearish);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

/* ============================================
   DRAWER
============================================ */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2px);
    z-index: 400;
    display: none;
}

.drawer-backdrop.active { display: block; }

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 90vw;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 401;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.drawer-backdrop.active .drawer { transform: translateX(0); }

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.drawer-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    outline: none;
    line-height: 1;
    font-family: var(--font);
}

.drawer-close:hover { background: var(--bg); color: var(--text); }

/* ============================================
   MODAL
============================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.active { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 460px;
    max-width: 90vw;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.14);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-body { padding: 1.5rem; }

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ============================================
   ADMIN STYLES
============================================ */
.page-heading { font-size: 1.5rem; font-weight: 700; color: var(--text); margin-bottom: 1.5rem; }

/* Page layout helpers (used in account.php, admin pages) */
.page-content {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.header-page-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    border-left: 1px solid var(--border);
    padding-left: 0.75rem;
    margin-left: 0.25rem;
    white-space: nowrap;
}

.page-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

/* Inline (non-full-width) primary button */
.btn-primary-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.58rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: var(--font);
}
.btn-primary-inline:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.admin-card-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.admin-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.25rem;
}

.admin-table-badge {
    display: inline-block;
    padding: 0.18rem 0.5rem;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.admin-table-badge.active { background: var(--bullish-bg); color: var(--bullish); }
.admin-table-badge.expired { background: var(--bearish-bg); color: var(--bearish); }
.admin-table-badge.inactive { background: var(--bg); color: var(--text-muted); }

.admin-btn-action {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}

.admin-btn-action:hover { background: var(--bg); color: var(--text); border-color: var(--border-hover); }

.alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.alert-success { background: var(--bullish-bg); border: 1px solid var(--bullish); color: var(--bullish); }
.alert-danger { background: var(--bearish-bg); border: 1px solid var(--bearish); color: var(--bearish); }

.setting-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-radio-group { display: flex; gap: 1.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.form-radio-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; color: var(--text); }
.form-radio-input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ============================================
   CHART ELEMENTS
============================================ */
.chart-container { overflow: hidden; }

/* ============================================
   FOOTER
============================================ */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.7;
    flex-shrink: 0;
}

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 1280px) {
    .indices-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-screener { grid-template-columns: 240px 1fr; }
}

#btn-toggle-strategies { display: none !important; }

/* Slide in animation for mobile strategies drawer */
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@media (max-width: 1024px) {
    .sidebar-nav {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        width: 240px;
    }

    .sidebar-nav.is-open { transform: translateX(0); }

    .main-wrapper { margin-left: 0 !important; }

    .grid-screener { grid-template-columns: 1fr; }
    .screener-sidebar { display: none; }

    /* Mobile strategies drawer styles */
    .screener-sidebar.show-mobile {
        display: flex !important;
        position: fixed;
        top: 0;
        right: 0;
        width: 320px;
        height: 100vh;
        z-index: 1050;
        background: var(--surface);
        border-left: 1px solid var(--border);
        box-shadow: -5px 0 25px rgba(0,0,0,0.3);
        padding: 1.25rem;
        margin: 0;
        max-height: 100vh;
        overflow-y: auto;
        animation: slideInRight 0.25s ease-out;
    }
    
    .screener-sidebar.show-mobile .mobile-close-sidebar {
        display: flex !important;
    }
    
    #btn-toggle-strategies {
        display: inline-flex !important;
        align-items: center;
        gap: 0.35rem;
        background: var(--primary-bg);
        color: var(--primary);
        border: 1px solid var(--primary-light);
        font-weight: 600;
    }
}

@media (max-width: 768px) {
    main { padding: 0.875rem 1rem; gap: 0.75rem; }
    header { padding: 0 1rem; gap: 0.4rem; }
    .header-search { max-width: 180px; }
    .wallet-widget { display: none; }
    .indices-stats-grid { grid-template-columns: 1fr 1fr; }
    .sub-tab-btn { font-size: 0.75rem; padding: 0.32rem 0.65rem; }
}

@media (max-width: 520px) {
    .indices-stats-grid { grid-template-columns: 1fr; }
    .header-search { display: none; }
    main { padding: 0.75rem; gap: 0.625rem; }
}

/* Sidebar mobile toggle button */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.35rem;
    color: var(--text);
    cursor: pointer;
    padding: 0.35rem;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.sidebar-toggle:hover {
    background: var(--bg);
}

@media (max-width: 1024px) {
    .sidebar-toggle {
        display: flex;
        margin-right: 0.5rem;
    }
}

/* ==========================================================================
   PREMIUM STRATEGY ADVISOR & ORDER EXECUTION DESK MODAL
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease-out;
}
.modal-overlay.active {
    display: flex;
    opacity: 1;
}
.modal-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s ease-out;
}
.modal-overlay.active .modal-wrapper {
    transform: scale(1);
}
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
}
.modal-title-area {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.modal-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.modal-close:hover {
    color: var(--text);
}
.modal-body {
    display: block;
    overflow: hidden;
}
.modal-left {
    padding: 1.5rem;
    overflow-y: auto;
}

/* Stock Snapshot Header Info */
.stock-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.stock-badge-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.stock-badge-label {
    color: var(--text-muted);
}
.stock-badge-val {
    font-weight: 700;
    color: var(--text);
}

/* Strategy Items styling */
.strategy-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.strategy-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    overflow: hidden;
    transition: var(--transition);
}
.strategy-item:hover {
    border-color: var(--primary-light);
}
.strategy-item.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}
.strategy-item-header {
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.strategy-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}
.strategy-item-status {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.18rem 0.5rem;
    border-radius: 20px;
    text-transform: uppercase;
}
.strategy-item-status.suitable {
    background: var(--bullish-bg);
    color: var(--bullish);
    border: 1px solid var(--bullish);
}
.strategy-item-status.not-suitable {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.strategy-item-body {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.005);
    display: none;
    font-size: 0.8rem;
    line-height: 1.5;
}
.strategy-item.active .strategy-item-body {
    display: block;
}

/* Order Execution Desk */
.order-desk-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.order-tx-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.25rem;
    margin-bottom: 1.25rem;
}
.order-tx-btn {
    border: none;
    background: transparent;
    padding: 0.55rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-align: center;
}
.order-tx-btn:hover {
    color: var(--text);
}
.order-tx-btn.active.buy {
    background: #00d09c; /* emerald green */
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 208, 156, 0.2);
}
.order-tx-btn.active.sell {
    background: #ff5252; /* bold trading red */
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 82, 82, 0.2);
}

.order-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* Custom Trading Input Fields & Wrappers */
.order-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    height: 40px;
    transition: var(--transition);
}
.order-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}
.order-input-wrapper.disabled {
    opacity: 0.5;
    background: rgba(0, 0, 0, 0.04);
    cursor: not-allowed;
}
.order-num-input {
    flex: 1;
    border: none;
    background: transparent;
    height: 100%;
    width: 100%;
    padding: 0 4px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    outline: none;
    -moz-appearance: textfield;
}
.order-num-input::-webkit-outer-spin-button,
.order-num-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.order-num-input:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}
.order-input-adj {
    width: 32px;
    height: 100%;
    border: none;
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    user-select: none;
}
.order-input-adj:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
}
.order-input-adj:active:not(:disabled) {
    background: rgba(0, 0, 0, 0.1);
}
.order-input-adj:disabled {
    cursor: not-allowed;
    color: var(--text-faint);
}
.input-currency-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
}
.currency-symbol {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    margin-left: 10px;
    margin-right: -4px;
    user-select: none;
}

/* Custom Trading Select Boxes */
.order-select {
    width: 100%;
    height: 40px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23787B86' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0 32px 0 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    outline: none;
    cursor: pointer;
    appearance: none;
    transition: var(--transition);
}
.order-select:hover {
    border-color: var(--border-hover);
}
.order-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

/* Quantity Presets styling */
.qty-presets {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.qty-preset-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}
.qty-preset-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

/* Broker Selector & Logo Container */
.order-broker-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
@media (max-width: 900px) {
    .modal-body {
        display: block;
    }
    .modal-left {
        max-height: 70vh;
    }
    .modal-wrapper {
        max-height: 95vh;
    }
}

/* ============================================
   CPR SCREENER & MARKET TREND STYLES
============================================ */
.cpr-badge {
    display: inline-block;
    padding: 0.22rem 0.55rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 0.6px;
    text-align: center;
    min-width: 95px;
    border: 1px solid transparent;
}

.cpr-badge.cpr-up {
    background: var(--bullish-bg);
    color: var(--bullish);
    border-color: rgba(8, 153, 129, 0.15);
}

.cpr-badge.cpr-down {
    background: var(--bearish-bg);
    color: var(--bearish);
    border-color: rgba(242, 54, 69, 0.15);
}

.cpr-badge.cpr-sideways {
    background: var(--alert-bg);
    color: var(--alert);
    border-color: rgba(246, 166, 35, 0.15);
}

.market-trend-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.market-trend-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.market-trend-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.market-trend-icon-wrapper.trend-up {
    background: var(--bullish-bg);
    color: var(--bullish);
    box-shadow: 0 0 16px rgba(8, 153, 129, 0.2);
}

.market-trend-icon-wrapper.trend-down {
    background: var(--bearish-bg);
    color: var(--bearish);
    box-shadow: 0 0 16px rgba(242, 54, 69, 0.2);
}

.market-trend-icon-wrapper.trend-sideways {
    background: var(--alert-bg);
    color: var(--alert);
    box-shadow: 0 0 16px rgba(246, 166, 35, 0.2);
}

.market-trend-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.market-trend-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.market-trend-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.market-trend-strength {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.market-trend-strength.strength-up {
    color: var(--bullish);
    background: var(--bullish-bg);
    border-color: rgba(8, 153, 129, 0.1);
}

.market-trend-strength.strength-down {
    color: var(--bearish);
    background: var(--bearish-bg);
    border-color: rgba(242, 54, 69, 0.1);
}

.market-trend-right {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 320px;
}

.market-distribution-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.market-distribution-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--bg);
    display: flex;
    overflow: hidden;
    width: 100%;
}

.dist-bar-item {
    height: 100%;
    transition: width 0.4s ease;
}

.dist-bar-item.dist-up       { background: var(--bullish); }
.dist-bar-item.dist-down     { background: var(--bearish); }
.dist-bar-item.dist-sideways { background: var(--alert); }

.market-distribution-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.legend-dot.dot-up       { background: var(--bullish); }
.legend-dot.dot-down     { background: var(--bearish); }
.legend-dot.dot-sideways { background: var(--alert); }

@media (max-width: 768px) {
    .market-trend-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .market-trend-right {
        max-width: 100%;
    }
}

/* Sidebar Dropdown & Submenu Styles */
.menu-item-dropdown {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.dropdown-submenu {
    display: none; /* Toggled via JS */
    flex-direction: column;
    padding-left: 0.75rem;
    margin-top: 0.1rem;
    border-left: 1px solid var(--border);
    margin-left: 1.1rem;
    gap: 0.1rem;
}
.dropdown-submenu .menu-item {
    padding: 0.4rem 0.625rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.dropdown-submenu .menu-item:hover,
.dropdown-submenu .menu-item.active {
    color: var(--text);
    background: var(--bg);
}
.menu-item .chevron {
    margin-left: auto;
    font-size: 0.65rem;
    transition: transform 0.2s;
}

