/* AI Investment Lab: Designsystem
   Nachtblau mit elektrischem Blau → Violett für alles Intelligente (KI), Smaragd für Gewinne, Koralle für Verluste. */

:root {
    --ail-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --ail-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
    --ail-blue: #4c8dff;
    --ail-violet: #8b5cf6;
    --ail-cyan: #22d3ee;
    --ail-up: #2dd4a3;
    --ail-down: #ff5c7a;
    --ail-warn: #f5b84c;
    --ail-gradient: linear-gradient(135deg, #4c8dff 0%, #8b5cf6 100%);
}

/* ---------- Farben (nur Dunkel) ---------- */
.ail-root {
    --ail-bg: #060a14;
    --ail-surface: rgba(16, 24, 43, 0.72);
    --ail-surface-solid: #101830;
    --ail-border: rgba(130, 160, 255, 0.14);
    --ail-border-strong: rgba(130, 160, 255, 0.28);
    --ail-text: #e8edf9;
    --ail-muted: #8d9ab8;
    --ail-glow: 0 0 0 1px rgba(139, 92, 246, 0.35), 0 8px 40px -12px rgba(76, 141, 255, 0.45);
    background:
        radial-gradient(900px 520px at 8% -8%, rgba(76, 141, 255, 0.20), transparent 60%),
        radial-gradient(800px 480px at 100% 0%, rgba(139, 92, 246, 0.16), transparent 55%),
        radial-gradient(900px 600px at 70% 110%, rgba(34, 211, 238, 0.08), transparent 60%),
        var(--ail-bg);
}

html, body { margin: 0; font-family: var(--ail-font); }
.ail-root { min-height: 100vh; font-family: var(--ail-font); color: var(--ail-text); background-attachment: fixed; }

/* MudBlazor transparent machen, damit der Verlauf durchscheint */
.ail-root .mud-layout, .ail-root .mud-main-content { background: transparent !important; }

/* ---------- Karten ---------- */
.ail-root .mud-paper {
    background: var(--ail-surface);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-radius: 14px;
    color: var(--ail-text);
}
.ail-root .mud-paper-outlined { border: 1px solid var(--ail-border); transition: border-color .2s ease, box-shadow .2s ease; }
.ail-root .mud-paper-outlined:hover { border-color: var(--ail-border-strong); }

/* KI-Karten: Verlaufsrand und Leuchten */
.ail-root .ail-ai { position: relative; border: 1px solid transparent !important;
    background:
        linear-gradient(var(--ail-surface-solid), var(--ail-surface-solid)) padding-box,
        var(--ail-gradient) border-box !important;
    box-shadow: var(--ail-glow); }
.ail-root .ail-ai {
    background:
        linear-gradient(rgba(14, 21, 40, 0.94), rgba(14, 21, 40, 0.94)) padding-box,
        var(--ail-gradient) border-box !important;
}

/* ---------- Typografie ---------- */
.ail-root .mud-typography-h4, .ail-root .mud-typography-h5, .ail-root .mud-typography-h6 { letter-spacing: -0.02em; font-weight: 600; }
.ail-root .mud-typography-overline { letter-spacing: 0.12em; font-size: 0.68rem; font-weight: 600; color: var(--ail-muted); }
.ail-root .mud-typography-caption { color: var(--ail-muted); }
.ail-num { font-family: var(--ail-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ail-up { color: var(--ail-up) !important; }
.ail-down { color: var(--ail-down) !important; }
.ail-muted { color: var(--ail-muted) !important; }
.ail-gradient-text { background: var(--ail-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- App-Leiste und Navigation ---------- */
.ail-root .mud-appbar {
    background: var(--ail-surface) !important;
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--ail-border);
    color: var(--ail-text);
}
.ail-root .mud-appbar::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(76, 141, 255, 0.6), rgba(139, 92, 246, 0.6), transparent);
}
.ail-root .mud-drawer { background: var(--ail-surface) !important; border-right: 1px solid var(--ail-border); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }

.ail-root .mud-drawer .mud-navmenu { padding-top: 18px; }
.ail-nav-section { font-size: 0.65rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ail-muted);
    font-weight: 600; padding: 14px 20px 4px; }
.ail-root .mud-nav-link { border-radius: 10px; margin: 2px 10px; color: var(--ail-muted); position: relative; }
.ail-root .mud-nav-link:hover { background: rgba(76, 141, 255, 0.08); color: var(--ail-text); }
.ail-root .mud-nav-link.active { background: linear-gradient(90deg, rgba(76, 141, 255, 0.18), rgba(139, 92, 246, 0.06)); color: var(--ail-text) !important; }
.ail-root .mud-nav-link.active::before {
    content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--ail-gradient);
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.8);
}
.ail-root .mud-nav-link.active .mud-icon-root { color: var(--ail-blue); }

/* ---------- KI-Kennzeichnung ---------- */
.ail-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px;
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; color: #dcd0ff;
    background: rgba(139, 92, 246, 0.16); border: 1px solid rgba(139, 92, 246, 0.45); }
.ail-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--ail-violet); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7); animation: ail-pulse 2s infinite; }
.ail-pulse.off { background: #6b7694; animation: none; box-shadow: none; }
@keyframes ail-pulse { 0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.6); } 70% { box-shadow: 0 0 0 8px rgba(139, 92, 246, 0); } 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); } }
@media (prefers-reduced-motion: reduce) { .ail-pulse { animation: none; } }

/* ---------- Hero (Dashboard-Kopf) ---------- */
.ail-hero { position: relative; overflow: hidden; }
.ail-hero::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(600px 220px at 0% 0%, rgba(76, 141, 255, 0.18), transparent 70%),
                radial-gradient(500px 220px at 100% 100%, rgba(139, 92, 246, 0.16), transparent 70%);
}
.ail-hero-value { font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1.1; font-weight: 600; }
.ail-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem;
    border: 1px solid var(--ail-border); background: rgba(130, 160, 255, 0.06); color: var(--ail-muted); }
.ail-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ail-up); }
.ail-pill .dot.off { background: #6b7694; }

/* ---------- Chips, Tabellen, Eingaben ---------- */
.ail-root .mud-chip { font-weight: 600; }
.ail-root .mud-table-head .mud-table-cell, .ail-root .mud-simple-table th { color: var(--ail-muted); font-weight: 600; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }
.ail-root .mud-simple-table, .ail-root .mud-table { background: transparent; }
.ail-root .mud-table-container, .ail-root .mud-simple-table .mud-table-container { background: transparent; }
.ail-root .mud-table-row:hover { background: rgba(76, 141, 255, 0.06) !important; }
.ail-root .mud-button-filled.mud-button-filled-primary { background: var(--ail-gradient); box-shadow: 0 6px 22px -8px rgba(76, 141, 255, 0.8); border: 0; }
.ail-root .mud-button-filled.mud-button-filled-primary:hover { filter: brightness(1.1); }

/* ---------- Anmeldung ---------- */
.ail-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.ail-login-card { width: 100%; max-width: 420px; padding: 32px !important; }

/* ---------- Ladezustand und Fehler ---------- */
.loading-progress { display: none; }
.loading-progress-text::after { content: "Lade AI Investment Lab …"; }
.loading-progress-text { text-align: center; padding-top: 30vh; color: #8d9ab8; }
body { background: #060a14; }

#blazor-error-ui { background: #b32121; color: #fff; bottom: 0; display: none; left: 0; padding: 0.6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
#blazor-error-ui a { color: #fff; }

/* Tabellen (Beobachtungslisten) */
.ail-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.ail-table th { text-align: left; font-weight: 600; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ail-muted); padding: 10px 12px; border-bottom: 1px solid var(--ail-border); white-space: nowrap; }
.ail-table td { padding: 10px 12px; border-bottom: 1px solid var(--ail-border); white-space: nowrap; }
.ail-table tbody tr { cursor: pointer; transition: background .15s ease; }
.ail-table tbody tr:hover { background: rgba(76, 141, 255, 0.06); }
.ail-table tbody tr:focus-visible { outline: 2px solid var(--ail-blue); outline-offset: -2px; }
.ail-table tbody tr.selected { background: rgba(139, 92, 246, 0.12); box-shadow: inset 3px 0 0 var(--ail-violet); }
.ail-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ail-table .up { color: var(--ail-up); }
.ail-table .down { color: var(--ail-down); }
.ail-table .sym { font-weight: 600; }
.ail-table .sub { font-size: 0.75rem; color: var(--ail-muted); }

/* Aufteilungsbalken (Risiko) */
.ail-split { display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 2px; background: rgba(130,160,255,.08); }

/* Chat */
.ail-chat { display: flex; flex-direction: column; gap: 12px; max-height: 60vh; overflow-y: auto; padding: 4px 2px 12px; margin-bottom: 8px; }
.ail-chat .msg { display: flex; flex-direction: column; max-width: 85%; }
.ail-chat .msg.user { align-self: flex-end; align-items: flex-end; }
.ail-chat .msg.assistant { align-self: flex-start; }
.ail-chat .bubble { white-space: pre-line; padding: 10px 14px; border-radius: 14px; font-size: .9rem; line-height: 1.5; }
.ail-chat .msg.user .bubble { background: var(--ail-gradient); color: #fff; border-bottom-right-radius: 4px; }
.ail-chat .msg.assistant .bubble { background: rgba(130,160,255,.08); border: 1px solid var(--ail-border); border-bottom-left-radius: 4px; }
.ail-chat .meta { font-size: .7rem; color: var(--ail-muted); margin-top: 4px; }
.ail-chat-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.ail-chat-item:hover { background: rgba(76,141,255,.06); }
.ail-chat-item.active { background: rgba(139,92,246,.14); }
.ail-chat-item .t { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ail-chat-item .sub { font-size: .7rem; color: var(--ail-muted); }

/* News */
.ail-news { display: flex; flex-direction: column; }
.ail-news .item { padding: 10px 0; border-bottom: 1px solid var(--ail-border); }
.ail-news .item:last-child { border-bottom: none; }
.ail-news .title { color: var(--ail-text); text-decoration: none; font-weight: 500; line-height: 1.35; }
.ail-news .title:hover { color: var(--ail-blue); text-decoration: underline; }
.ail-news .meta { font-size: .72rem; color: var(--ail-muted); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ail-news .tag { border: 1px solid var(--ail-border-strong); border-radius: 6px; padding: 0 6px; color: var(--ail-text); }
.ail-news .text { font-size: .82rem; color: var(--ail-muted); margin-top: 4px; }
.ail-file { color: var(--ail-muted); font-size: .85rem; }
.ail-file::file-selector-button { background: transparent; color: var(--ail-text); border: 1px solid var(--ail-border-strong); border-radius: 8px; padding: 6px 12px; margin-right: 10px; cursor: pointer; }
