/* Tyche Market Dashboard — Light Theme */

:root {
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --border: #e2e6ed;
    --text: #1a1d29;
    --text-dim: #6b7280;
    --green: #16a34a;
    --green-bg: #dcfce7;
    --red: #dc2626;
    --red-bg: #fee2e2;
    --yellow: #b45309;
    --yellow-bg: #fef3c7;
    --cyan: #0369a1;
    --accent: #4f46e5;
    --stat-bg: #f0f2f6;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 20px;
}

.container {
    max-width: 780px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

header h1 {
    font-size: 1.3rem;
    letter-spacing: 0.08em;
    color: var(--cyan);
    font-weight: 800;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-top: 0.3rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-badge {
    font-size: 0.85rem;
    color: var(--text-dim);
    background: var(--stat-bg);
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.logout-btn {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-decoration: none;
}
.logout-btn:hover { color: var(--red); }

/* Verdict Box */
.verdict-box {
    text-align: center;
    padding: 2rem 1.25rem;
    border-radius: 14px;
    margin-bottom: 0.75rem;
}

.verdict-bullish {
    background: var(--green-bg);
    border: 2px solid var(--green);
}
.verdict-bearish {
    background: var(--red-bg);
    border: 2px solid var(--red);
}
.verdict-neutral {
    background: var(--yellow-bg);
    border: 2px solid var(--yellow);
}

.verdict-bias {
    font-size: 2.6rem;
    font-weight: 900;
    letter-spacing: 0.04em;
}
.verdict-bullish .verdict-bias { color: var(--green); }
.verdict-bearish .verdict-bias { color: var(--red); }
.verdict-neutral .verdict-bias { color: var(--yellow); }

.verdict-score {
    font-size: 1.5rem;
    color: var(--text);
    margin-top: 0.3rem;
    font-weight: 600;
}

.verdict-posture {
    font-size: 1.05rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.scored-date {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 1.5rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.card-header h2 {
    font-size: 1.1rem;
    color: var(--cyan);
    letter-spacing: 0.04em;
    margin: 0;
    font-weight: 700;
}

/* Help button (?) */
.help-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--stat-bg);
    color: var(--text-dim);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.help-btn:hover {
    background: var(--cyan);
    color: white;
    border-color: var(--cyan);
}

.help-content {
    display: none;
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.7;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    background: var(--stat-bg);
    border-radius: 10px;
    border-left: 3px solid var(--cyan);
}

.help-content.show { display: block; }
.help-content strong { color: var(--text); }
.help-content em { color: var(--yellow); font-style: normal; font-weight: 700; }
.help-content p { margin-bottom: 0.5rem; }
.help-content p:last-child { margin-bottom: 0; }

.accuracy-badge {
    font-size: 0.8rem;
    color: var(--green);
    background: var(--green-bg);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    margin-left: auto;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.05rem;
}

th {
    text-align: left;
    color: var(--text-dim);
    font-weight: 600;
    padding: 0.7rem 0.5rem;
    border-bottom: 2px solid var(--border);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.factors-table th:nth-child(1), .factors-table td:nth-child(1) { width: 35%; }
.factors-table th:nth-child(2), .factors-table td:nth-child(2) { text-align: right; width: 15%; }
.factors-table th:nth-child(3), .factors-table td:nth-child(3) { text-align: center; width: 10%; }
.factors-table th:nth-child(4), .factors-table td:nth-child(4) { text-align: center; width: 10%; }
.factors-table th:nth-child(5), .factors-table td:nth-child(5) { text-align: center; width: 15%; }
.factors-table th:nth-child(6), .factors-table td:nth-child(6) { text-align: right; width: 15%; }

.val { text-align: right; font-variant-numeric: tabular-nums; }
.score { text-align: center; font-weight: 700; }
.weight { text-align: center; color: var(--text-dim); }
.total { text-align: right; font-weight: 700; }

.positive { color: var(--green); }
.negative { color: var(--red); }
.dim { color: var(--text-dim); }
.row-dim td { color: var(--text-dim); opacity: 0.4; }

.sources-note {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 0.75rem;
    text-align: right;
}

/* Score bars */
.bar-container { display: flex; gap: 3px; justify-content: center; }
.bar-fill, .bar-empty { width: 22px; height: 16px; border-radius: 4px; }
.bar-fill.bar-green { background: var(--green); }
.bar-fill.bar-red { background: var(--red); }
.bar-empty { background: var(--border); }

/* Market Grid */
.market-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.market-stat {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1rem;
    background: var(--stat-bg);
    border-radius: 12px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.stat-zone {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* PCR zone guide */
.pcr-guide {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.pcr-zone {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
}

.pcr-bullish { background: var(--green-bg); color: var(--green); }
.pcr-neutral { background: var(--yellow-bg); color: var(--yellow); }
.pcr-bearish { background: var(--red-bg); color: var(--red); }
.pcr-bar-label { font-weight: 500; font-size: 0.8rem; }

/* Factor guide */
.factor-guide { display: flex; flex-direction: column; gap: 0.75rem; }

.guide-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
}
.guide-item:last-child { border-bottom: none; }

.guide-name { font-weight: 700; font-size: 1rem; color: var(--cyan); }
.guide-desc { font-size: 0.9rem; color: var(--text-dim); line-height: 1.6; }
.guide-desc em { color: var(--yellow); font-style: normal; font-weight: 700; }

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.refresh-btn {
    margin-top: 0.75rem;
    background: var(--card-bg);
    color: var(--cyan);
    border: 2px solid var(--border);
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
}
.refresh-btn:hover { background: var(--stat-bg); border-color: var(--cyan); }

.footer-link {
    color: var(--cyan);
    text-decoration: none;
    font-size: 0.85rem;
}
.footer-link:hover { text-decoration: underline; }

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--bg);
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.login-card h1 {
    font-size: 2rem;
    letter-spacing: 0.15em;
    color: var(--cyan);
    margin-bottom: 0.25rem;
    font-weight: 900;
}

.login-subtitle {
    font-size: 0.95rem;
    color: var(--text-dim);
    margin-bottom: 2rem;
}

.form-group { text-align: left; margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 0.85rem;
    background: var(--stat-bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 1.3rem;
    text-align: center;
    letter-spacing: 0.3em;
}

.form-group input:focus { outline: none; border-color: var(--cyan); }

.login-btn {
    width: 100%;
    padding: 0.85rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}
.login-btn:hover { opacity: 0.9; }

.error-msg {
    background: var(--red-bg);
    color: var(--red);
    padding: 0.6rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border: 1px solid var(--red);
    font-weight: 600;
}

/* Mobile responsive */
@media (max-width: 600px) {
    body { font-size: 18px; }
    .container { padding: 0.75rem; }
    header { flex-direction: column; gap: 0.5rem; }
    header h1 { font-size: 1.1rem; }
    .verdict-bias { font-size: 2rem; }
    .verdict-score { font-size: 1.2rem; }
    .factors-table { font-size: 0.95rem; }
    .factors-table th:nth-child(4), .factors-table td:nth-child(4) { display: none; }
    .bar-fill, .bar-empty { width: 16px; height: 12px; }
    .stat-value { font-size: 1.3rem; }
    .card { padding: 1rem; }
    .market-grid { gap: 0.6rem; }
    .market-stat { padding: 0.75rem; }
}

@media (max-width: 400px) {
    .factors-table th:nth-child(5), .factors-table td:nth-child(5) { display: none; }
}
