/* 
Filename: wwwroot/css/site.css
Purpose: Dark UI styling for the dashboard layout, dismissible banner, info modal, table and QR overlay (includes draggable splitter + resizable table columns).
Inputs: HTML structure from index.html.
Outputs: Styled UI.
Dependencies: index.html.
Processes: Full-viewport flex layout, banner strip, info modal, table and chart panels, draggable divider, overlay QR display, column resizing handles, 24h "new" highlighting with fade, tablet-optimised stacked layout (chart top, table bottom).
AI-Instructions:
  - When editing this file, always output drop-in code (no diff markers, no +/- lines).
  - Always include the filename and full updated declarations in the response.
  - Keep this code as simple as possible. Comment everything perfectly understandible
  - Prefer Config-Class values over literals; ask if a new constant is needed.
*/

:root {
    color-scheme: dark;
    /* Core theme */
    --bg: #0b0f14;
    --panel: #0f1722;
    --panel2: #0c131d;
    --text: #e6edf3;
    --muted: #9fb0c0;
    --border: #1f2a3a;
    /* Rating colours (semantic, no trading language) */
    --rating-neutral: #d29922;
    --rating-positive: #2ea043;
    --rating-negative: #f85149;
    --rating-open: #8b949e;
    /* New highlight (orange glow) */
    --new-accent: #ff8a00;
    --new-row-bg: rgba(255,138,0,0.16);
    --new-shadow: rgba(255,138,0,0.35);
    /* Split defaults (desktop) */
    --split-left: 70%;
    /* QR button sizing */
    --uri-btn-pad-y: 5px;
    --uri-btn-pad-x: 9px;
    --uri-btn-radius: 10px;
    --uri-btn-font: 11px;
    --uri-btn-domain-font: 11px;
    --uri-btn-gap: 8px;
    /* Responsive breakpoint */
    --bp-tablet: 900px;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}

    /* Hide app content until JS decides token is present */
    body.preload-hidden .app,
    body.preload-hidden .overlay {
        display: none !important;
    }

/* Forbidden screen */
.forbidden {
    height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
}

.forbidden-card {
    width: min(520px, 92vw);
    border: 1px solid var(--border);
    background: #070a0f;
    border-radius: 14px;
    padding: 16px 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}

.forbidden-title {
    font-weight: 900;
    letter-spacing: 0.2px;
}

.forbidden-text {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

/* App root */
.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Top bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: #070a0f;
    flex: 0 0 auto;
}

.title {
    font-weight: 800;
    letter-spacing: 0.2px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status {
    font-size: 12px;
    color: var(--muted);
}

.link-btn {
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

    .link-btn:hover {
        background: rgba(255,255,255,0.06);
    }

/* Banner strip (dismissible) */
.banner {
    border-bottom: 1px solid var(--border);
    background: #070a0f;
    padding: 10px 14px;
    flex: 0 0 auto;
}

.banner-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.banner-title {
    font-weight: 900;
    font-size: 12px;
    letter-spacing: 0.2px;
}

.banner-text {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

    .banner-text strong {
        color: var(--text);
    }

.banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.banner-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-weight: 900;
    line-height: 1;
}

    .banner-close:hover {
        background: rgba(255,255,255,0.04);
    }

/* Desktop split layout */
.layout {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}

.panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.panel-left {
    flex: 0 0 var(--split-left);
    background: var(--panel2);
    min-width: 260px;
}

.panel-right {
    flex: 1 1 auto;
    background: var(--panel);
    min-width: 220px;
}

/* Splitter handle */
.splitter {
    flex: 0 0 8px;
    cursor: col-resize;
    background: #070a0f;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

    .splitter:hover {
        background: #0a0f17;
    }

body.resizing {
    cursor: col-resize;
    user-select: none;
}

.panel-header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}

.panel-title {
    font-weight: 800;
    letter-spacing: 0.2px;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
}

.table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
}


.table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* Fixed layout so col widths are respected and resizable */
/* Compact: larger font, less padding */
.data-table {
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

    .data-table thead th {
        position: sticky;
        top: 0;
        background: #070a0f;
        z-index: 2;
        text-align: left;
        border-bottom: 1px solid var(--border);
        padding: 8px 16px 8px 8px; /* still space for resizer handle */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 900;
    }

    .data-table td {
        border-bottom: 1px solid var(--border);
        padding: 6px 8px;
        vertical-align: top;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .data-table tbody tr:hover {
        background: rgba(255,255,255,0.03);
    }

.cell-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Column centering (header + cell content) */
.cell-center {
    text-align: center;
}

.data-table thead th[data-col="date"],
.data-table thead th[data-col="rating"],
.data-table thead th[data-col="rank"] {
    text-align: center;
}

.date-cell {
    font-weight: 900;
    white-space: nowrap;
}

/* Name cell: name + type hint */
.name-main {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.name-text {
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.name-hint {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Source (QR button) */
.uri-cell {
    display: flex;
    align-items: center;
    min-width: 0;
}

.uri-btn {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: var(--uri-btn-gap);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
    color: var(--text);
    padding: var(--uri-btn-pad-y) var(--uri-btn-pad-x);
    border-radius: var(--uri-btn-radius);
    font-size: var(--uri-btn-font);
    line-height: 1.15;
    cursor: pointer;
}

    .uri-btn:hover {
        background: rgba(255,255,255,0.06);
    }

.uri-btn-qr {
    flex: 0 0 auto;
    font-weight: 900;
    letter-spacing: 0.2px;
}

.uri-btn-domain {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--muted);
    font-size: var(--uri-btn-domain-font);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Column resizer handle */
.col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 10px;
    height: 100%;
    cursor: col-resize;
    touch-action: none;
}

    .col-resizer::after {
        content: "";
        position: absolute;
        top: 0;
        right: 4px;
        width: 1px;
        height: 100%;
        background: rgba(255,255,255,0.06);
    }

    .col-resizer:hover::after {
        background: rgba(255,255,255,0.14);
    }

/* Ranking badge */
.rank {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-weight: 900;
    letter-spacing: 0.2px;
}

/* Combined indicator display: "kurz / lang" */
/* Less "finance rating": subtle tags instead of one big pill */
.rating-combo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.rating-part {
    padding: 1px 6px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.02);
    font-weight: 800;
    font-size: 12px;
    line-height: 1.4;
}

.rating-sep {
    color: var(--muted);
    font-weight: 900;
}

/* Colour is on text (subtle), not big backgrounds */
.rating-open {
    color: var(--rating-open);
}

.rating-neutral {
    color: var(--rating-neutral);
}

.rating-negative {
    color: var(--rating-negative);
}

.rating-positive {
    color: var(--rating-positive);
}

/* 24h glow + fade for new items and header/title */
@keyframes glowFade24h {
    0% {
        background: rgba(255,138,0,0.18);
        box-shadow: 0 0 0 rgba(0,0,0,0);
    }

    2% {
        background: rgba(255,138,0,0.22);
        box-shadow: 0 0 18px var(--new-shadow);
    }

    10% {
        background: rgba(255,138,0,0.18);
        box-shadow: 0 0 12px rgba(255,138,0,0.22);
    }

    100% {
        background: transparent;
        box-shadow: 0 0 0 rgba(0,0,0,0);
    }
}

.row-new {
    animation: glowFade24h 86400s linear forwards;
    background: var(--new-row-bg);
}

.table-new thead th {
    animation: glowFade24h 86400s linear forwards;
}

.title-new {
    animation: glowFade24h 86400s linear forwards;
}

/* Chart */
.chart-wrap {
    flex: 1 1 auto;
    min-height: 0;
    padding: 10px 12px;
    overflow: hidden;
}

#monthlyChart {
    width: 100% !important;
    height: 100% !important;
}

/* Generic overlays (QR + Info) */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 100;
}

.hidden {
    display: none;
}

.overlay-content {
    width: min(760px, 95vw);
    background: #070a0f;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}

.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}

.overlay-title {
    font-weight: 900;
    letter-spacing: 0.2px;
}

.overlay-body {
    padding: 14px;
}

    .overlay-body.centered {
        text-align: center;
    }

.overlay-text {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

    .overlay-text strong {
        color: var(--text);
    }

#qrBox {
    display: inline-block;
    padding: 14px;
    background: white;
    border-radius: 10px;
}

.overlay-link {
    margin-top: 12px;
    font-size: 12px;
    color: var(--muted);
    word-break: break-all;
}

.overlay-actions {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.btn {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 800;
}

    .btn:hover {
        background: rgba(255,255,255,0.04);
    }

.btn-primary {
    background: rgba(46,160,67,0.15);
    border-color: rgba(46,160,67,0.5);
    text-decoration: none;
}

/* Tablet: chart top, table bottom (lower half emphasis) */
@media (max-width: 900px) {
    .topbar {
        padding: 8px 10px;
    }

    .banner {
        padding: 8px 10px;
    }

    .layout {
        flex-direction: column-reverse;
    }

    .splitter {
        display: none;
    }

    .panel-left, .panel-right {
        min-width: 0;
        flex: 1 1 auto;
    }

    .panel-left {
        height: 58vh;
    }

    .panel-right {
        height: 42vh;
    }

    .panel-header {
        padding: 8px 10px;
    }

    .data-table {
        font-size: 12px;
    }

        .data-table thead th {
            padding: 7px 14px 7px 6px;
        }

        .data-table td {
            padding: 6px 6px;
        }

    .uri-btn {
        padding: 6px 9px;
    }

    .overlay {
        padding: 12px;
    }

    #qrBox {
        padding: 10px;
    }
}
