/* ═══════════════════════════════════════════════════════════════
   AXION TERMINAL — Sector Rotation Command Center CSS
   ═══════════════════════════════════════════════════════════════
   3-panel layout: Activity Chart (top) + RRG / Treemap (bottom)
   Strict institutional dark mode typography.
   ═══════════════════════════════════════════════════════════════ */

/* ── Master Container ──────────────────────────────────────── */
.sector-command-center {
    width: 100%;
    height: 100%;
    background: #0D0D0D;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    font-family: 'Inter', -apple-system, sans-serif;
    color: #E0E0E0;
    position: relative;
}

/* ── Header Bar ────────────────────────────────────────────── */
.sector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 8px;
    border-bottom: 1px solid #1A1A1A;
    flex-shrink: 0;
    background: linear-gradient(180deg, #111111 0%, #0D0D0D 100%);
}

.sector-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sector-header-title h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #FFFFFF;
    margin: 0;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sector-header-diamond {
    color: #C6E310;
    font-size: 12px;
}

.sector-header-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #555;
    padding: 2px 8px;
    border: 1px solid #222;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

.sector-header-meta {
    display: flex;
    align-items: center;
    gap: 14px;
}

.sector-ws-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #555;
}

.sector-ws-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #333;
    transition: background 0.3s;
}

.sector-ws-dot.connected {
    background: #C6E310;
    box-shadow: 0 0 8px rgba(198, 227, 16, 0.5);
}

.sector-last-update {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #444;
}

/* ── Legend Bar ─────────────────────────────────────────────── */
.sector-legend-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 16px;
    border-bottom: 1px solid #1A1A1A;
    flex-shrink: 0;
    overflow-x: auto;
    background: #0D0D0D;
}

.sector-legend-bar::-webkit-scrollbar {
    height: 0;
}

.sector-legend-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: 1px solid transparent;
    background: transparent;
}

.sector-legend-pill:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.sector-legend-pill.focused {
    border-color: var(--pill-color, #C6E310);
    background: rgba(198, 227, 16, 0.06);
}

.sector-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.sector-legend-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #888;
    transition: color 0.2s;
}

.sector-legend-pill:hover .sector-legend-label,
.sector-legend-pill.focused .sector-legend-label {
    color: #E0E0E0;
}

.sector-legend-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    color: #AAAAAA;
    margin-left: 2px;
}

/* ── Top Panel: Main Activity Chart ────────────────────────── */
.sector-activity-panel {
    width: 100%;
    height: 55vh;
    min-height: 350px;
    position: relative;
    flex-shrink: 0;
    border-bottom: 1px solid #1A1A1A;
}

.sector-activity-chart {
    width: 100%;
    height: 100%;
}

/* Chart glow effect for focused line */
.sector-activity-panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(198, 227, 16, 0.3) 20%,
        rgba(198, 227, 16, 0.5) 50%,
        rgba(198, 227, 16, 0.3) 80%,
        transparent 100%
    );
    opacity: 0;
    transition: opacity 0.3s;
}

.sector-activity-panel.chart-focused::after {
    opacity: 1;
}

/* ── Bottom Grid: RRG + Treemap ────────────────────────────── */
.sector-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    flex: 1;
    min-height: 380px;
    background: #111;
}

/* ── RRG Quadrant Charter ──────────────────────────────────── */
.sector-rrg-panel {
    background: #0D0D0D;
    position: relative;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #1A1A1A;
}

.sector-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-bottom: 1px solid #151515;
    flex-shrink: 0;
}

.sector-panel-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sector-panel-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: #444;
}

.sector-rrg-chart {
    flex: 1;
    min-height: 0;
}

/* RRG Quadrant Labels */
.sector-rrg-quadrant-label {
    position: absolute;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.25;
    pointer-events: none;
    z-index: 5;
}

.sector-rrg-quadrant-label.leading {
    top: 40px;
    right: 20px;
    color: #2ecc71;
}

.sector-rrg-quadrant-label.weakening {
    bottom: 20px;
    right: 20px;
    color: #f1c40f;
}

.sector-rrg-quadrant-label.lagging {
    bottom: 20px;
    left: 20px;
    color: #e74c3c;
}

.sector-rrg-quadrant-label.improving {
    top: 40px;
    left: 20px;
    color: #3498db;
}

/* ── Treemap Panel ─────────────────────────────────────────── */
.sector-treemap-panel {
    background: #0D0D0D;
    position: relative;
    display: flex;
    flex-direction: column;
}

.sector-treemap-container {
    flex: 1;
    padding: 6px;
    min-height: 0;
    display: grid;
    gap: 2px;
    overflow: hidden;
}

/* Treemap cell */
.sector-treemap-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    padding: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    border: 1px solid transparent;
}

.sector-treemap-cell:hover {
    transform: scale(1.02);
    z-index: 2;
    border-color: rgba(255, 255, 255, 0.15);
}

.sector-treemap-cell .cell-symbol {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    line-height: 1;
}

.sector-treemap-cell .cell-flow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 500;
    margin-top: 2px;
    line-height: 1;
}

.sector-treemap-cell .cell-flow.positive {
    color: #C6E310;
}

.sector-treemap-cell .cell-flow.negative {
    color: #EF476F;
}

.sector-treemap-cell .cell-flow.neutral {
    color: #555;
}

/* ── Buy Flash Animation ──────────────────────────────────── */
@keyframes buyFlash {
    0% {
        box-shadow: inset 0 0 0 1px rgba(198, 227, 16, 0.8),
                    0 0 15px rgba(198, 227, 16, 0.4);
    }
    50% {
        box-shadow: inset 0 0 0 2px rgba(198, 227, 16, 0.6),
                    0 0 25px rgba(198, 227, 16, 0.3);
    }
    100% {
        box-shadow: none;
    }
}

@keyframes sellFlash {
    0% {
        box-shadow: inset 0 0 0 1px rgba(239, 71, 111, 0.8),
                    0 0 15px rgba(239, 71, 111, 0.4);
    }
    50% {
        box-shadow: inset 0 0 0 2px rgba(239, 71, 111, 0.6),
                    0 0 25px rgba(239, 71, 111, 0.3);
    }
    100% {
        box-shadow: none;
    }
}

.sector-treemap-cell.flash-buy {
    animation: buyFlash 600ms ease-out;
}

.sector-treemap-cell.flash-sell {
    animation: sellFlash 600ms ease-out;
}

/* ── Treemap Sector Label ──────────────────────────────────── */
.sector-treemap-focus-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sector-treemap-focus-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.sector-treemap-focus-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #AAA;
}

/* ── Quadrant Count Badges ─────────────────────────────────── */
.sector-rrg-counts {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sector-rrg-count-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
}

.sector-rrg-count-badge .badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

.sector-rrg-count-badge .badge-num {
    color: #666;
    font-weight: 600;
}

/* ── Loading / Error States ────────────────────────────────── */
.sector-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #444;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
}

.sector-loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #222;
    border-top-color: #C6E310;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Tooltip Overrides ─────────────────────────────────────── */
.sector-tooltip {
    background: rgba(13, 13, 13, 0.95) !important;
    border: 1px solid #222 !important;
    border-radius: 4px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6) !important;
    padding: 10px 14px !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    color: #E0E0E0 !important;
    backdrop-filter: blur(8px);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .sector-bottom-grid {
        grid-template-columns: 1fr;
    }

    .sector-rrg-panel {
        border-right: none;
        border-bottom: 1px solid #1A1A1A;
    }
}
