/* =============================================================================
   DASHBOARD.CSS — Page-Specific Styles: Supply Chain Map
   AI Supply Chain Dashboard
   Created: 2025-02-27

   PURPOSE: The 134-company supply chain map has its own design language —
   slightly different background tones and card colour themes that are unique
   to this page. Extracted here from the inline <style> block.

   NOTE: Dashboard uses slightly darker bg (#0a0a0a vs #050507) intentionally
   — the dense card grid reads better on a true near-black background.

   SHARED MODULES IMPORTED:
   - base.css (tokens, body, grid)
   - admin.css (admin console UI)

   REVERT: Paste rules back into dashboard.html <style>.
   ============================================================================= */

/* Override base tokens for dashboard's darker palette */
:root {
    --bg:           #0a0a0a;
    --card:         #111111;
    --border:       #262626;
    --ambient-colour: rgba(59,130,246,0.03);
}

body {
    font-family: var(--font-body);
    font-size: 11px;
}

/* =============================================================================
   SECTOR LAYOUT
   Two-column grid: 45px sidebar label + full-width card area
   ============================================================================= */
.macro-container {
    display: grid;
    grid-template-columns: 45px 1fr;
    gap: 16px;
    margin-bottom: 40px;
    border: 1px solid var(--border);
    background: #0f0f0f;
    border-radius: 12px;
    overflow: hidden;
}

/* Rotated vertical sector label on the left */
.macro-sidebar {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: center;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    padding: 20px 4px;
    font-size: 0.75rem;
    font-family: var(--font-data);
    border-right: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
}

/* Grid of company cards within each sector */
.sub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1px;
    background-color: var(--border);
}

/* Layer label row (e.g. "Layer 01: Copper Mining") */
.category-header {
    grid-column: 1 / -1;
    background: #000;
    color: #737373;
    padding: 8px 16px;
    font-family: var(--font-data);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

/* =============================================================================
   COMPANY CARD
   ============================================================================= */
.card {
    position: relative;
    background-color: var(--card);
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 105px;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-left: 3px solid transparent;
}

.card:hover {
    background-color: #1a1a1a;
    z-index: 10;
    transform: scale(1.02);
}

/* Card colour themes */
.gain-high { border-left-color: #10b981; background: linear-gradient(135deg, #111, #064e3b 100%); box-shadow: inset 0 0 20px rgba(16,185,129,0.15); }
.gain-mid  { border-left-color: #059669; background: linear-gradient(135deg, #111, #06201a 100%); }
.loss-mid  { border-left-color: #991b1b; background: linear-gradient(135deg, #111, #2a0a0a 100%); }
.loss-high { border-left-color: #ef4444; background: linear-gradient(135deg, #111, #450a0a 100%); box-shadow: inset 0 0 20px rgba(239,68,68,0.15); }
.sim-gain  { border-left-color: #3b82f6; background: linear-gradient(135deg, #111, #1e3a8a 100%); opacity: 0.9; }
.sim-loss  { border-left-color: #4b5563; background: linear-gradient(135deg, #111, #1f2937 100%); opacity: 0.8; }

/* Card typography */
.ticker      { font-family: var(--font-data); color: #737373; font-weight: 700; font-size: 0.75rem; }
.cap         { font-family: var(--font-data); color: #fff; background: rgba(255,255,255,0.05); padding: 1px 5px; border-radius: 3px; font-size: 0.65rem; }
.comp-name   { font-weight: 800; font-size: 0.85rem; color: #f5f5f5; margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.func        { font-size: 0.65rem; color: #525252; line-height: 1.2; }
.percent-tag { font-family: var(--font-data); font-size: 0.65rem; font-weight: 800; }

/* =============================================================================
   MODAL (TradingView chart popup)
   ============================================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-overlay.active { display: flex; opacity: 1; }

.modal-content {
    background: #0a0a0a;
    border: 1px solid #262626;
    width: 95%;
    max-width: 950px;
    border-radius: 16px;
    padding: 24px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

#tv_chart_container {
    width: 100%;
    height: 500px;
    background: #000;
    border-radius: 8px;
    margin-top: 16px;
    border: 1px solid #262626;
}
