/* Scanner Dashboard — Terminal Theme
   Background: #000000  Accent: #00FF41  Font: monospace */

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

:root {
    --bg: #000000;
    --accent: #00FF41;
    --accent-dim: #008020;
    --red: #FF4444;
    --yellow: #FFCC00;
    --white: #FFFFFF;
    --gray: #808080;
    --gray-dark: #1a1a2e;
    --font: 'Courier New', 'Consolas', 'Monaco', monospace;
}

body {
    background: var(--bg);
    color: var(--accent);
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.4;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-dim); }

/* ── Header ─────────────────────────── */
.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--accent-dim);
    background: var(--bg);
    min-height: 64px;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid rgba(176, 96, 255, 0.3);
    object-fit: cover;
}

.logo-titles {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: nowrap;
}

.logo-text {
    font-family: var(--font);
    font-size: 20px;
    font-weight: bold;
    color: var(--accent);
    letter-spacing: 3px;
    text-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
}

/* ShiRoSam brand — gradient like ninja dashboard */
.brand-name {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    background: linear-gradient(130deg, #b060ff 0%, #60a5fa 35%, #ffb800 65%, #00ff88 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-slogan {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    white-space: nowrap;
    background: linear-gradient(130deg, #b060ff 0%, #60a5fa 35%, #ffb800 65%, #00ff88 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right { display: flex; align-items: center; gap: 14px; font-size: 11px; }
.market-session { color: var(--accent); font-weight: bold; }
.market-session[data-session="CLOSED"] { color: var(--gray); }
.market-session[data-session="PRE-MARKET"] { color: var(--yellow); }
.market-session[data-session="AFTER-HOURS"] { color: var(--yellow); }
.time-display { color: var(--gray); }
.user-badge { color: var(--white); }
.logout-link { color: var(--gray); font-size: 10px; }
.logout-link:hover { color: var(--red); }

/* ── Footer ─────────────────────────── */
.terminal-footer {
    display: flex;
    justify-content: space-between;
    padding: 6px 16px;
    border-top: 1px solid var(--accent-dim);
    font-size: 11px;
    color: var(--accent-dim);
    margin-top: auto;
}

/* ── Main content ───────────────────── */
main {
    flex: 1;
    overflow: hidden;
}

/* ── Dashboard Grid ─────────────────── */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 90px);
    padding: 6px;
    gap: 6px;
}

.portfolios-block {
    flex: 0 0 auto;
    max-height: 70%;
    overflow-y: auto;
}

.bottom-row {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    min-height: 0;
}

/* ── Blocks ─────────────────────────── */
.block {
    border: 1px solid var(--accent-dim);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.block-header {
    padding: 6px 10px;
    border-bottom: 1px solid var(--accent-dim);
    background: #001000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: bold;
}

.block-title { color: #00FF41; letter-spacing: 1px; }
.block-body { padding: 6px 8px; overflow-y: auto; flex: 1; }

/* ── Tables ─────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: fixed;
}

/* Column width hints for portfolio tables */
.portfolio-panel .data-table th:nth-child(1) { width: 10%; } /* TICKER */
.portfolio-panel .data-table th:nth-child(2) { width: 9%; }  /* QTY */
.portfolio-panel .data-table th:nth-child(3) { width: 9%; }  /* AVG */
.portfolio-panel .data-table th:nth-child(4) { width: 9%; }  /* CURRENT */
.portfolio-panel .data-table th:nth-child(5) { width: 10%; } /* P&L $ */
.portfolio-panel .data-table th:nth-child(6) { width: 9%; }  /* P&L % */
.portfolio-panel .data-table th:nth-child(7) { width: 12%; } /* VALUE */
.portfolio-panel .data-table th:nth-child(8) { width: 32%; } /* NAME */

.data-table th {
    text-align: left;
    color: var(--accent);
    font-weight: bold;
    font-size: 10px;
    padding: 5px 8px;
    border-bottom: 2px solid var(--accent-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 5px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Row separator lines */
.data-table tbody tr {
    border-bottom: 1px solid var(--gray-dark);
}

/* Zebra striping */
.data-table tbody tr:nth-child(even) td {
    background: rgba(0, 255, 65, 0.02);
}

.data-table tr:hover td { background: rgba(0, 255, 65, 0.06); }

/* P&L colors */
.up { color: #00FF41; font-weight: bold; }
.down { color: #FF4444; font-weight: bold; }

.ticker-link {
    color: var(--accent);
    font-weight: bold;
}
.ticker-link:hover { color: var(--white); }

/* ── Portfolio panels (stacked, no tabs) ── */
.portfolio-panel {
    display: block;
    margin-bottom: 10px;
    border: 1px solid var(--gray-dark);
    border-radius: 2px;
    overflow: hidden;
}
.portfolio-panel:last-child { margin-bottom: 0; }

.portfolio-panel-header {
    padding: 4px 8px;
    background: #001000;
    border-bottom: 1px solid var(--accent-dim);
    color: var(--accent);
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
}

/* ── Alerts ─────────────────────────── */
.alert-list { display: flex; flex-direction: column; gap: 4px; }
.alert-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 2px 0;
    border-bottom: 1px solid var(--gray-dark);
}
.signal-strength { color: var(--yellow); font-size: 10px; }
.signal-strength[data-strength="5"] { color: var(--accent); }
.signal-strength[data-strength="4"] { color: var(--yellow); }
.signal-strength[data-strength="3"] { color: var(--yellow); }
.signal-strength[data-strength="1"],
.signal-strength[data-strength="2"] { color: var(--gray); }

.alert-reason { color: var(--gray); font-size: 10px; }

/* ── No data ────────────────────────── */
.no-data { color: var(--gray); font-size: 11px; padding: 8px; }

/* ── Login ──────────────────────────── */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: calc(100vh - 90px);
    gap: 20px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 1px solid rgba(176, 96, 255, 0.3);
    object-fit: cover;
}

.login-brand-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.login-brand-name {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.login-brand-scanner {
    font-family: var(--font);
    font-size: 28px;
    font-weight: bold;
    color: var(--accent);
    letter-spacing: 4px;
    text-shadow: 0 0 12px rgba(0, 255, 65, 0.3);
}

.login-brand-shirosam {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(130deg, #b060ff 0%, #60a5fa 35%, #ffb800 65%, #00ff88 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-brand-slogan {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.01em;
    background: linear-gradient(130deg, #b060ff 0%, #60a5fa 35%, #ffb800 65%, #00ff88 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-card {
    border: 1px solid var(--accent-dim);
    border-radius: 2px;
    padding: 32px 44px;
    min-width: 340px;
    background: #000500;
    position: relative;
    overflow: hidden;
}

.login-title { display: none; }
.login-subtitle { display: none; }

.login-form { display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 10px; color: var(--gray); letter-spacing: 1px; }

.terminal-input {
    background: var(--bg);
    border: 1px solid var(--accent-dim);
    color: var(--accent);
    font-family: var(--font);
    font-size: 14px;
    padding: 8px 12px;
    outline: none;
}
.terminal-input:focus { border-color: var(--accent); box-shadow: 0 0 6px rgba(0, 255, 65, 0.15); }

.terminal-button {
    background: var(--accent);
    color: var(--bg);
    border: none;
    font-family: var(--font);
    font-size: 14px;
    font-weight: bold;
    padding: 10px 0;
    cursor: pointer;
    letter-spacing: 2px;
    transition: background 0.2s;
}
.terminal-button:hover { background: var(--accent-dim); }

.login-error {
    color: var(--red);
    font-size: 11px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.login-error.show { opacity: 1; }

/* Scan-line animation overlay */
.scan-line {
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: rgba(0, 255, 65, 0.08);
    animation: scanDown 3s linear infinite;
    pointer-events: none;
}

@keyframes scanDown {
    0% { top: 0; }
    100% { top: 100%; }
}

/* ── Detail Page ────────────────────── */
.detail-container {
    padding: 12px 16px;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--accent-dim);
}

.back-link {
    color: var(--gray);
    font-size: 11px;
}
.back-link:hover { color: var(--accent); }

.detail-ticker {
    font-size: 22px;
    letter-spacing: 3px;
    color: var(--accent);
}

.detail-price {
    font-size: 16px;
    color: var(--white);
    margin-left: auto;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 10px;
}

.detail-block {
    border: 1px solid var(--accent-dim);
    border-radius: 2px;
    padding: 10px;
}

.detail-block h2 {
    font-size: 11px;
    color: var(--gray);
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--gray-dark);
}

.position-block { grid-column: 1; grid-row: 1; }
.chart-block { grid-column: 1; grid-row: 2; }
.signals-block { grid-column: 2; grid-row: 1; }
.news-block { grid-column: 2; grid-row: 2; }

.chart-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    background: #000300;
}

.chart-svg { max-width: 100%; max-height: 200px; }

.signal-history { display: flex; flex-direction: column; gap: 6px; }
.signal-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    padding: 4px 0;
    border-bottom: 1px solid var(--gray-dark);
}
.signal-date { color: var(--gray); font-size: 10px; min-width: 70px; }
.signal-reason { color: var(--gray); font-size: 10px; }

.news-list { display: flex; flex-direction: column; gap: 6px; }
.news-item {
    display: flex;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--gray-dark);
    font-size: 11px;
}
.news-date { color: var(--gray); font-size: 10px; min-width: 70px; }
.news-title { color: var(--white); }


/* ── Account summary ────────────────── */
.account-summary {
    display: flex;
    gap: 24px;
    padding: 5px 8px 8px;
    font-size: 12px;
    color: var(--gray);
    border-bottom: 1px solid var(--gray-dark);
    margin-bottom: 4px;
}
.account-summary strong { color: #00FF41;
    color: var(--accent);
}

/* ── Market status ──────────────────── */
.market-status-display {
    padding: 6px 0;
    margin-bottom: 6px;
}
.market-status-badge {
    display: inline-block;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    border: 1px solid var(--accent-dim);
    border-radius: 2px;
}
.market-status-badge.status-open {
    color: var(--accent);
    border-color: var(--accent);
    background: #001000;
}
.market-status-badge.status-closed {
    color: var(--gray);
    border-color: var(--gray-dark);
}
.market-status-badge.status-pre-market,
.market-status-badge.status-tech {
    color: var(--yellow);
    border-color: var(--yellow);
}

/* ── Cell name ──────────────────────── */
.cell-name {
    color: var(--gray);
    font-size: 11px;
}

/* ── Data source label ──────────────── */
.data-source {
    color: var(--gray-dark);
    font-size: 10px;
    font-weight: normal;
    margin-left: auto;
    padding-right: 8px;
}

/* ── Signals block ──────────────────── */
.signals-block {
    border: 1px solid var(--accent-dim);
}
.signals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    padding: 8px;
}
.signal-card {
    background: var(--bg-darker, #000);
    border: 1px solid var(--gray-dark);
    border-radius: 2px;
    padding: 8px 10px;
    text-align: center;
}
.signal-label {
    color: var(--gray);
    font-size: 10px;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.signal-value {
    color: var(--accent);
    font-size: 18px;
    font-weight: bold;
    line-height: 1.2;
}
.signal-sub {
    color: var(--gray);
    font-size: 10px;
    margin-top: 2px;
}
.signals-trends {
    margin: 8px;
}
.signals-trends th {
    color: var(--gray);
    font-size: 11px;
    text-align: center;
}
.signals-trends td {
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    padding: 6px;
}

/* ── Leaders block ─────────────────── */
.leaders-block .data-table td:first-child {
    color: var(--gray);
    text-align: center;
    width: 30px;
}
