/* OPUAS // ANALYST DASHBOARD CONSOLIDATED CSS V1.5 - LAYOUT FIX */

:root {
    --bg: #ffffff;
    --bg-alt: #f8f9fa;
    --text: #1a1a1a;
    --muted: #6c757d;
    --line: #e9ecef;
    --line-strong: #000000;
    --home: #d20222;
    --away: #00529b;
    --accent: #ff0055;
    
    --font-ui: "Outfit", -apple-system, sans-serif;
    --font-data: "JetBrains Mono", monospace;
    
    --sidebar-collapsed: 48px;
    --sidebar-expanded: 320px;
    --topbar-height: 56px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg);
    font-family: var(--font-ui);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

.dashboard-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header & Navigation Fixes */
.topbar {
    min-height: var(--topbar-height);
    border-bottom: 2px solid var(--line-strong);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    gap: 16px;
    background: #fff;
    z-index: 1100;
}

.topbar-intro { flex: 1; min-width: 200px; }
.topbar h2 { font-size: 13px; font-weight: 900; letter-spacing: 0.05em; text-transform: uppercase; margin: 4px 0; }
.topbar .kicker { font-size: 10px; color: var(--muted); text-transform: uppercase; font-weight: 700; }

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

#dashboard-meta { display: none; }

/* Main Shell */
.app-shell {
    display: flex;
    flex: 1;
    height: calc(100vh - var(--topbar-height));
    overflow: hidden;
    position: relative;
}

/* Sidebar: OVERLAY Drawer Logic */
.app-sidebar {
    width: var(--sidebar-collapsed);
    background: var(--bg-alt);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    transition: width var(--transition), box-shadow var(--transition);
    overflow: hidden;
    flex-shrink: 0;
    position: absolute; /* Default absolute to ensure it overlays */
    top: 0;
    left: 0;
    height: 100%;
    z-index: 2000;
}

.app-sidebar:hover {
    width: var(--sidebar-expanded);
    box-shadow: 10px 0 40px rgba(0,0,0,0.15);
}

/* Placeholder for sidebar so main content doesn't jump */
.sidebar-placeholder {
    width: var(--sidebar-collapsed);
    flex-shrink: 0;
}

.sidebar-top, .sidebar-nav, .sidebar-header, .match-list, .sidebar-foot {
    min-width: calc(var(--sidebar-expanded) - 1px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s;
}

.app-sidebar:hover .sidebar-top,
.app-sidebar:hover .sidebar-nav,
.app-sidebar:hover .sidebar-header,
.app-sidebar:hover .match-list,
.app-sidebar:hover .sidebar-foot {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Indicators */
.app-sidebar::before {
    content: "INTEL";
    position: absolute;
    top: 50%;
    left: 24px;
    transform: translate(-50%, -50%) rotate(-90deg);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--muted);
    transition: opacity 0.1s;
}
.app-sidebar:hover::before { opacity: 0; }

.sidebar-top { padding: 16px; border-bottom: 1px solid var(--line); }
.sidebar-nav { padding: 8px; }
.sidebar-header { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.match-list { flex: 1; overflow-y: auto; padding: 0; }

/* Main Content Area */
.app-main {
    flex: 1;
    min-width: 560px; /* Mandatory min-width */
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: #fff;
    padding: 0;
}

/* Toolbar De-overlapping */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 16px 32px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-alt);
    align-items: flex-end;
}

.search-box, .filter-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 200px;
}

.search-box span, .filter-box span { font-size: 10px; font-weight: 900; text-transform: uppercase; color: var(--muted); }
input, select {
    padding: 8px 12px;
    border: 1px solid var(--line-strong);
    font-family: var(--font-ui);
    font-size: 12px;
}

/* Content Grid Responsiveness */
.content-grid {
    display: flex;
    flex-wrap: wrap;
    padding: 32px;
    gap: 32px;
}

.main-column {
    flex: 1 1 560px;
    min-width: 0;
}

/* Metrics Panel Fixes */
.app-metrics {
    width: 400px;
    background: var(--bg-alt);
    border-left: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    flex-shrink: 0;
}

/* Responsive Metrics Panel - Move below if width < 1200 */
@media (max-width: 1100px) {
    .app-shell {
        overflow-y: auto;
        display: block; /* Stack sidebar placeholder, main and metrics */
    }
    .app-main {
        min-width: 100%;
        overflow-y: visible; /* Let shell handle scroll */
    }
    .app-metrics {
        width: 100%;
        height: auto;
        border-left: none;
        border-top: 2px solid var(--line-strong);
        overflow-y: visible;
    }
    .sidebar-placeholder {
        display: none; /* In mobile/narrow view, we use full absolute sidebar overlay */
    }
    .app-sidebar {
        height: 100vh;
        position: fixed;
    }
}

/* Match Card & Grid Density */
.intel-card {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    background: #fff;
}
.intel-card:hover { background: var(--bg-alt); }
.intel-card.active { border-left: 4px solid var(--line-strong); }

.intel-status { display: flex; justify-content: space-between; font-size: 9px; font-weight: 700; margin-bottom: 4px; }
.intel-card strong { display: block; font-size: 13px; font-weight: 700; }

/* Components */
#scoreboard { margin-bottom: 40px; }
.sb-score { font-family: var(--font-data); font-size: 40px; font-weight: 700; }

.panel-head { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: baseline; }
.panel-head strong { font-size: 14px; text-transform: uppercase; }

.visuals-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.visuals-panel > div { border: 1px solid var(--line); aspect-ratio: 16/9; background: #fff; }

.metric-row { display: grid; grid-template-columns: 60px 1fr 60px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.val-h { color: var(--home); font-family: var(--font-data); font-weight: 700; }
.val-a { color: var(--away); font-family: var(--font-data); font-weight: 700; text-align: right; }
.val-l { font-size: 10px; font-weight: 900; color: var(--muted); text-align: center; }

button {
    background: #fff;
    border: 1px solid var(--line-strong);
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
}
button:hover { background: var(--bg-alt); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.hidden { display: none !important; }
