/* Trading-Dashboard (Yii3) - schlichtes, helles Layout.
   Optik-Referenz: static/strategies.html + strategy.html des Alt-Dashboards. */

:root {
    --bg-body: #f5f5f7;
    --bg-card: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --text-main: #1d1d1f;
    --text-muted: #86868b;
    --accent: #0071e3;
    --green: #248a3d;
    --red: #d70015;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg-body);
    color: var(--text-main);
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

/* ── Navigation ──────────────────────────────────────────── */
.top-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.6rem 1.25rem;
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    backdrop-filter: blur(12px);
    z-index: 10;
}
.top-nav .brand { font-weight: 700; margin-right: 1rem; font-size: 0.95rem; }
.top-nav a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    font-size: 0.87rem;
    font-weight: 600;
}
.top-nav a:hover { color: var(--text-main); background: rgba(0, 0, 0, 0.04); }
.top-nav a.active { color: var(--accent); background: rgba(0, 113, 227, 0.08); }

.container-main { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
.footer { text-align: center; color: var(--text-muted); font-size: 0.72rem; padding: 1rem 0 1.5rem; }

/* ── Seitenkopf ──────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head > div:first-child { flex: 1; min-width: 220px; }
.page-head h1 { margin: 0; font-size: 1.35rem; font-weight: 700; }
.page-head .sub { margin: 0.15rem 0 0; font-size: 0.8rem; color: var(--text-muted); }
.inline-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.btn-primary {
    background: var(--accent); border: none; color: #fff; border-radius: 8px; cursor: pointer;
    padding: 0.5rem 1rem; font-size: 0.85rem; font-weight: 600;
}
.btn-primary:hover { background: #0077ed; }
.btn-secondary {
    color: var(--text-muted); text-decoration: none; border: 1px solid var(--border-color);
    border-radius: 8px; padding: 0.4rem 0.75rem; font-size: 0.8rem; background: var(--bg-card);
}

/* ── Sektionen ───────────────────────────────────────────── */
.section-head { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1rem; margin: 1.4rem 0 0.8rem; }
.section-head.muted, .section-head .muted { color: var(--text-muted); }
details.archive > summary { cursor: pointer; list-style: none; }
details.archive > summary::-webkit-details-marker { display: none; }
details.archive > summary .chev { transition: transform 0.15s; display: inline-block; font-weight: 700; }
details.archive[open] > summary .chev { transform: rotate(90deg); }
.section-head .chev { color: var(--text-muted); }
details.archive .section-head { color: var(--text-muted); }

/* ── Strategie-Karten (Grid) ─────────────────────────────── */
.strat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.strat-card {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 14px;
    padding: 1rem 1.1rem; display: block; color: inherit; text-decoration: none;
    transition: transform 0.12s, box-shadow 0.12s;
}
a.strat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08); }
.strat-card.placeholder { color: var(--text-muted); }
.sc-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.7rem; }
.sc-icon {
    width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center;
    justify-content: center; font-size: 0.95rem; font-weight: 700; flex-shrink: 0;
}
.sc-name { font-weight: 700; font-size: 0.95rem; line-height: 1.2; }
.sc-sub { font-size: 0.7rem; color: var(--text-muted); }
.mode-badge {
    padding: 0.12rem 0.5rem; border-radius: 6px; font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px; flex-shrink: 0;
}
.mode-paper { background: rgba(0, 113, 227, 0.1); color: #0071e3; }
.mode-demo { background: rgba(255, 149, 0, 0.12); color: #c93400; }
.mode-live { background: rgba(255, 59, 48, 0.12); color: #ff3b30; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-left: auto; }
.dot-fresh { background: #34c759; box-shadow: 0 0 5px rgba(52, 199, 89, 0.6); }
.dot-stale { background: #ff9f0a; box-shadow: 0 0 5px rgba(255, 159, 10, 0.6); }
.dot-off { background: #86868b; }
.sc-equity { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.sc-pnl { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.7rem; }
.sc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; border-top: 1px solid var(--border-color); padding-top: 0.6rem; }
.sc-stat-label { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.sc-stat-value { font-size: 0.85rem; font-weight: 600; }
.sc-note { margin-top: 0.55rem; font-size: 0.7rem; color: var(--text-muted); }
.sc-note.warn { color: #c93400; font-weight: 600; }
.strat-card.stopped { opacity: 0.72; background: rgba(0, 0, 0, 0.015); }
.strat-card.stopped .sc-equity { font-size: 1.15rem; }

/* ── KPI-Zeile ───────────────────────────────────────────── */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.kpi-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 0.7rem 0.85rem; }
.kpi-card.placeholder { color: var(--text-muted); font-size: 0.8rem; }
.kpi-label { font-size: 0.66rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.kpi-value { font-size: 1.05rem; font-weight: 700; margin-top: 0.15rem; }

/* ── Karten + Tabellen ───────────────────────────────────── */
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 14px; margin-bottom: 1rem; overflow: hidden; }
.card.placeholder-card { padding: 1rem; color: var(--text-muted); }
.card-header { padding: 0.7rem 1rem; font-weight: 700; font-size: 0.9rem; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.card-header .spacer { flex: 1; }
.card-body { padding: 0.85rem 1rem; }
.card-body.table-scroll { padding: 0; max-height: 520px; overflow-y: auto; }
.chart-container { position: relative; height: 300px; }
.chart-container.small { height: 200px; }
.empty-note { color: var(--text-muted); text-align: center; padding: 1rem; font-size: 0.85rem; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.data-table th {
    text-align: left; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--text-muted); padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0; background: var(--bg-card);
}
.data-table td { padding: 0.45rem 0.75rem; border-bottom: 1px solid rgba(0, 0, 0, 0.04); }
.data-table .num, .data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Status/Farben ───────────────────────────────────────── */
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }
.status-pill { padding: 0.15rem 0.55rem; border-radius: 6px; font-size: 0.72rem; font-weight: 700; }
.status-active { background: rgba(52, 199, 89, 0.12); color: #248a3d; }
.status-stopped { background: rgba(134, 134, 139, 0.12); color: #86868b; }

.hint-box {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px;
    padding: 0.8rem 1rem; font-size: 0.75rem; color: var(--text-muted); line-height: 1.6; margin-top: 1rem;
}

/* ── Bell-Marktblöcke ────────────────────────────────────── */
.market-block { margin-bottom: 1.25rem; }
.market-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .market-grid { grid-template-columns: 1fr; } }

/* ── Login-Seite ─────────────────────────────────────────── */
.auth-body { margin: 0; }
.auth-main {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.auth-card {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 14px;
    padding: 2rem; width: 100%; max-width: 360px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.06);
}
.auth-card h1 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.auth-sub { margin: 0.25rem 0 1.25rem; font-size: 0.85rem; color: var(--text-muted); }
.auth-form { display: flex; flex-direction: column; gap: 0.35rem; }
.auth-form label { font-size: 0.8rem; font-weight: 600; margin-top: 0.6rem; }
.auth-form input {
    padding: 0.55rem 0.7rem; border: 1px solid var(--border-color); border-radius: 8px;
    font-size: 0.9rem; background: #fff; color: var(--text-main);
}
.auth-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-form .btn-primary { margin-top: 1.1rem; padding: 0.6rem 1rem; }
.auth-error {
    background: rgba(215, 0, 21, 0.08); border: 1px solid rgba(215, 0, 21, 0.25); color: var(--red);
    border-radius: 8px; padding: 0.6rem 0.75rem; font-size: 0.82rem; margin-bottom: 0.5rem;
}

/* ── Abmelden-Button in der Navigation ───────────────────── */
.nav-logout { margin-left: auto; margin-bottom: 0; }
.btn-logout {
    background: none; border: 1px solid var(--border-color); color: var(--text-muted);
    border-radius: 8px; padding: 0.35rem 0.8rem; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.btn-logout:hover { color: var(--text-main); border-color: var(--text-muted); }
