/* =====================================================================
   Live-Dashboard — Dark-themed content within main.php layout
   Left: Matches + Vision 180 | Right: Live-Tabelle (sticky)
   ===================================================================== */

/* ── Full-width override for this page ────────────────────────────── */
.page-live-dashboard .main-content {
    max-width: 100%;
    padding: 0;
}

/* ── Dark wrapper ─────────────────────────────────────────────────── */
.live-dashboard-wrap {
    min-height: calc(100vh - 64px);
    background: #0a1118;
    color: #e8edf2;
    font-family: 'Inter', sans-serif;
}

/* ── Page Header ──────────────────────────────────────────────────── */
.dash-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #111d2a 0%, #152535 100%);
    border-bottom: 3px solid #c41e2a;
}

.dash-page-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.dash-page-title i { color: #c41e2a; font-size: 1rem; }
.dash-page-title h1 {
    font-size: 1.1rem; font-weight: 700; margin: 0; color: #e8edf2;
}

.dash-page-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dash-clock {
    font-family: 'JetBrains Mono', monospace; font-size: 0.9rem;
    color: #7a8ea0; background: rgba(0,0,0,0.3);
    padding: 0.25rem 0.75rem; border-radius: 20px;
}

.dash-tv-link {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.35rem 0.85rem; background: rgba(196,30,42,0.15);
    border: 1px solid rgba(196,30,42,0.3); border-radius: 20px;
    color: #e8343f; font-size: 0.8rem; font-weight: 600;
    text-decoration: none; transition: all 0.2s;
}
.dash-tv-link:hover {
    background: rgba(196,30,42,0.25); border-color: #c41e2a; color: #f87171;
}
.dash-tv-link i { font-size: 0.75rem; }

.dash-status {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.85rem; color: #7a8ea0;
}

.pulse-dot {
    width: 10px; height: 10px; background: #10b981; border-radius: 50%;
    animation: livePulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(16,185,129,0.5);
}
.pulse-dot.inactive { background: #4b5563; animation: none; box-shadow: none; }

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 8px rgba(16,185,129,0.5); }
    50% { opacity: 0.6; transform: scale(0.85); box-shadow: 0 0 4px rgba(16,185,129,0.2); }
}

/* ── Liga Tabs ────────────────────────────────────────────────────── */
.dash-liga-tabs {
    display: flex; gap: 0.25rem; padding: 0.75rem 1.5rem;
    background: #111d2a; border-bottom: 1px solid #1e3044;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
}

.liga-tab {
    background: transparent; border: 1px solid #2a4058; border-radius: 8px;
    color: #7a8ea0; font-family: 'Inter', sans-serif; font-size: 0.85rem;
    font-weight: 600; padding: 0.5rem 1.25rem; cursor: pointer;
    transition: all 0.2s; white-space: nowrap;
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
}
.liga-tab:hover { border-color: #c41e2a; color: #e8edf2; }
.liga-tab.active { background: #c41e2a; border-color: #c41e2a; color: white; }

/* ══════════════════════════════════════════════════════════════════════
   MAIN GRID — Left (Matches + Ticker) | Right (Standings)
   ══════════════════════════════════════════════════════════════════════ */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 1.25rem;
    padding: 1rem 1.5rem;
    align-items: start;
}

/* ── Left Column ──────────────────────────────────────────────────── */
.dash-left { min-width: 0; }

.dash-match-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
}

/* ── Recently Completed (full width, below grid) ─────────────────── */
.dash-recent {
    padding: 0 1.5rem 1.5rem;
}
.dash-recent-header {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.75rem 0 0.75rem; font-size: 0.8rem; font-weight: 700;
    color: #7a8ea0; text-transform: uppercase; letter-spacing: 0.06em;
    border-top: 1px solid #1e3044;
}
.dash-recent-header i { color: #d4a017; }
.dash-recent-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
}

/* ── Match Card ───────────────────────────────────────────────────── */
.live-match-card {
    background: linear-gradient(145deg, #162536, #1a2d42);
    border: 1px solid #2a4058; border-radius: 12px; overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: pointer;
}
.live-match-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.live-match-card.card-selected {
    border-color: #d4a017;
    box-shadow: 0 0 16px rgba(212,160,23,0.25);
}
.live-match-card.updated { animation: cardFlash 0.6s ease-out; }
.live-match-card.completed { opacity: 0.65; border-color: #1e3044; }
.live-match-card.completed:hover { opacity: 0.85; }

@keyframes cardFlash {
    0% { border-color: #d4a017; box-shadow: 0 0 20px rgba(212,160,23,0.3); }
    100% { border-color: #2a4058; box-shadow: none; }
}

.card-board-bar {
    background: rgba(0,0,0,0.3); padding: 0.4rem 0.75rem;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
}
.card-board-name { color: #d4a017; font-weight: 700; }
.card-meta { display: flex; align-items: center; gap: 0.5rem; }
.card-league-badge {
    background: rgba(196,30,42,0.2); color: #e8343f;
    padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.65rem; font-weight: 700;
}
.card-friendly-badge {
    background: rgba(139,92,246,0.2); color: #a78bfa;
    padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.65rem; font-weight: 700;
}
.card-friendly-badge i { font-size: 0.55rem; margin-right: 0.15rem; }
.card-friendly { border-color: rgba(139,92,246,0.3); }
.card-friendly:hover { border-color: rgba(139,92,246,0.5); }
.card-leg-info { color: #7a8ea0; }

.card-players {
    display: grid; grid-template-columns: 1fr auto 1fr;
    align-items: center; padding: 0.85rem 0.75rem; gap: 0.25rem;
}
.card-player { text-align: center; position: relative; }
.card-player-name {
    font-size: 0.85rem; font-weight: 700; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; max-width: 130px;
    margin: 0 auto; color: #e8edf2;
}
.card-player.active .card-player-name { color: #d4a017; }
.card-player.winner .card-player-name { color: #10b981; }
.card-player.winner .card-player-name::after { content: ' \2713'; font-size: 0.75rem; }

.turn-indicator {
    display: block; width: 6px; height: 6px; background: #d4a017;
    border-radius: 50%; margin: 0 auto 0.2rem;
    box-shadow: 0 0 6px rgba(212,160,23,0.6);
}

.card-remaining {
    font-family: 'JetBrains Mono', monospace; font-size: 1.8rem;
    font-weight: 900; margin-top: 0.2rem; line-height: 1;
    color: #e8edf2; min-height: 1.8rem;
}
.card-remaining.checkout-zone {
    color: #10b981; text-shadow: 0 0 12px rgba(16,185,129,0.3);
}

.card-vs {
    display: flex; flex-direction: column; align-items: center;
    gap: 0.15rem; padding: 0 0.5rem; min-width: 70px;
}
.card-leg-progress {
    font-family: 'JetBrains Mono', monospace; font-size: 0.65rem;
    color: #7a8ea0; font-weight: 600; letter-spacing: 0.04em;
}
.card-legs {
    display: inline-flex; align-items: baseline; white-space: nowrap;
    font-family: 'JetBrains Mono', monospace; font-size: 1.4rem; font-weight: 800;
}
.card-legs .p1-legs { color: #3b82f6; }
.card-legs .p2-legs { color: #ef4444; }
.card-legs .legs-sep { color: #4b5563; margin: 0 0.15rem; }
.card-game-mode {
    font-size: 0.55rem; color: #7a8ea0; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
}

.card-live-badge {
    background: #c41e2a; color: white; font-size: 0.55rem; font-weight: 800;
    padding: 0.15rem 0.5rem; border-radius: 4px; letter-spacing: 0.1em;
    animation: liveBadgePulse 2s ease-in-out infinite;
}
@keyframes liveBadgePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

.card-final-badge {
    background: #374151; color: #9ca3af; font-size: 0.55rem; font-weight: 700;
    padding: 0.15rem 0.5rem; border-radius: 4px; letter-spacing: 0.08em;
}

/* ══════════════════════════════════════════════════════════════════════
   VISION 180 — Compact, below standings in right column
   ══════════════════════════════════════════════════════════════════════ */
.dash-ticker-panel {
    margin-top: 0.75rem;
    background: linear-gradient(145deg, #111d2a, #162536);
    border: 1px solid #2a4058; border-radius: 10px; overflow: hidden;
    display: flex; flex-direction: column;
    height: 180px;
    flex-shrink: 0;
}

.dash-ticker-head {
    padding: 0.35rem 0.75rem; background: rgba(0,0,0,0.25);
    border-bottom: 1px solid #1e3044; flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.5rem;
}

.dash-ticker-brand {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: #7a8ea0; white-space: nowrap;
}
.dash-ticker-brand i { color: #c41e2a; font-size: 0.75rem; }

.dash-ticker-tabs {
    display: flex; gap: 0.2rem;
    overflow-x: auto; flex-shrink: 0;
}

.dtab {
    background: transparent; border: 1px solid #2a4058; border-radius: 20px;
    color: #7a8ea0; font-family: 'Inter', sans-serif; font-size: 0.65rem;
    font-weight: 600; padding: 0.15rem 0.5rem; cursor: pointer;
    transition: all 0.2s; white-space: nowrap;
}
.dtab:hover { border-color: #c41e2a; color: #e8edf2; }
.dtab.active { background: #c41e2a; border-color: #c41e2a; color: white; }

.dash-ticker-feed {
    flex: 1; min-height: 0; overflow-y: auto;
    padding: 0.25rem 0; scroll-behavior: smooth;
}
.dash-ticker-feed::-webkit-scrollbar { width: 4px; }
.dash-ticker-feed::-webkit-scrollbar-track { background: transparent; }
.dash-ticker-feed::-webkit-scrollbar-thumb { background: #2a4058; border-radius: 4px; }

/* ── Ticker Messages ──────────────────────────────────────────────── */
.ticker-msg {
    display: flex; align-items: flex-start; gap: 0.4rem;
    padding: 0.2rem 0.75rem; font-size: 0.72rem; line-height: 1.35;
    animation: tickerSlide 0.3s ease-out;
    border-left: 3px solid transparent; transition: background 0.2s;
}
.ticker-msg:hover { background: rgba(255,255,255,0.03); }

@keyframes tickerSlide {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.ticker-time {
    font-family: 'JetBrains Mono', monospace; font-size: 0.62rem;
    color: #4b5563; white-space: nowrap; min-width: 50px; padding-top: 1px;
}
.ticker-dot {
    width: 5px; height: 5px; border-radius: 50%; background: #4b5563;
    flex-shrink: 0; margin-top: 4px;
}
.ticker-text { color: #c9d1d9; flex: 1; }

/* Event colors */
.ticker-score-180 { border-left-color: #c41e2a; }
.ticker-score-180 .ticker-dot { background: #c41e2a; box-shadow: 0 0 6px rgba(196,30,42,0.5); }
.ticker-score-180 .ticker-text { color: #f87171; font-weight: 700; }

.ticker-score-140 { border-left-color: #f59e0b; }
.ticker-score-140 .ticker-dot { background: #f59e0b; }
.ticker-score-140 .ticker-text { color: #fbbf24; font-weight: 600; }

.ticker-score-100 { border-left-color: #6b7280; }
.ticker-score-100 .ticker-dot { background: #6b7280; }

.ticker-leg-won { border-left-color: #10b981; }
.ticker-leg-won .ticker-dot { background: #10b981; box-shadow: 0 0 4px rgba(16,185,129,0.4); }
.ticker-leg-won .ticker-text { color: #34d399; font-weight: 600; }

.ticker-match-start { border-left-color: #3b82f6; }
.ticker-match-start .ticker-dot { background: #3b82f6; }
.ticker-match-start .ticker-text { color: #60a5fa; font-weight: 600; }

.ticker-match-end { border-left-color: #d4a017; }
.ticker-match-end .ticker-dot { background: #d4a017; box-shadow: 0 0 6px rgba(212,160,23,0.5); }
.ticker-match-end .ticker-text { color: #fbbf24; font-weight: 700; }

.ticker-checkout-zone { border-left-color: #8b5cf6; }
.ticker-checkout-zone .ticker-dot { background: #8b5cf6; }
.ticker-checkout-zone .ticker-text { color: #a78bfa; }

/* ══════════════════════════════════════════════════════════════════════
   RIGHT COLUMN — LIVE TABELLE (sticky)
   ══════════════════════════════════════════════════════════════════════ */
.dash-right {
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.dash-standings {
    background: linear-gradient(145deg, #111d2a, #162536);
    border: 1px solid #2a4058; border-radius: 12px; overflow: hidden;
    display: flex; flex-direction: column;
    flex: 1;
    min-height: 0;
}

.dash-standings-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem; background: rgba(0,0,0,0.25);
    border-bottom: 1px solid #1e3044; flex-shrink: 0;
}

.dash-standings-title {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: #7a8ea0;
}
.dash-standings-title i { color: #d4a017; font-size: 0.9rem; }

.dash-standings-tabs { display: flex; gap: 0.25rem; }

.stab {
    background: transparent; border: 1px solid #2a4058; border-radius: 20px;
    color: #7a8ea0; font-family: 'Inter', sans-serif; font-size: 0.7rem;
    font-weight: 600; padding: 0.25rem 0.75rem; cursor: pointer;
    transition: all 0.2s; white-space: nowrap;
}
.stab:hover { border-color: #d4a017; color: #e8edf2; }
.stab.active { background: #d4a017; border-color: #d4a017; color: #111; font-weight: 700; }

.dash-standings-body {
    flex: 1; overflow-y: auto;
}
.dash-standings-body::-webkit-scrollbar { width: 4px; }
.dash-standings-body::-webkit-scrollbar-track { background: transparent; }
.dash-standings-body::-webkit-scrollbar-thumb { background: #2a4058; border-radius: 4px; }

.dash-standings-scroll { overflow-x: auto; }

.dash-table {
    width: 100%; border-collapse: collapse; font-size: 0.78rem;
}
.dash-table thead th {
    color: #7a8ea0; font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
    padding: 0.55rem 0.4rem; text-align: center;
    border-bottom: 1px solid #1e3044; white-space: nowrap;
    position: sticky; top: 0;
    background: linear-gradient(145deg, #111d2a, #162536);
    z-index: 1;
}
.dash-table thead th:nth-child(2) { text-align: left; }

.dash-table tbody td {
    padding: 0.45rem 0.4rem; text-align: center;
    border-bottom: 1px solid rgba(30,48,68,0.5); color: #c9d1d9;
}
.dash-table tbody tr:last-child td { border-bottom: none; }
.dash-table tbody tr:hover { background: rgba(255,255,255,0.03); }

.st-rank { font-weight: 800; color: #7a8ea0; width: 28px; }
.dash-table tbody tr:nth-child(1) .st-rank { color: #d4a017; }
.dash-table tbody tr:nth-child(2) .st-rank { color: #9ca3af; }
.dash-table tbody tr:nth-child(3) .st-rank { color: #b87333; }

.st-name {
    text-align: left !important; font-weight: 700;
    color: #e8edf2 !important; white-space: nowrap;
    max-width: 120px; overflow: hidden; text-overflow: ellipsis;
}
.st-win { color: #10b981 !important; font-weight: 600; }
.st-loss { color: #ef4444 !important; font-weight: 600; }
.st-lw { color: #e8edf2 !important; }
.st-pos { color: #10b981 !important; font-weight: 600; }
.st-neg { color: #ef4444 !important; font-weight: 600; }
.st-avg {
    color: #d4a017 !important; font-weight: 700;
    font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
}

.dash-standings-loading {
    padding: 2rem; text-align: center; color: #4b5563; font-size: 0.85rem;
}

/* ── Player Highlight (when match selected) ──────────────────────── */
.dash-table tbody tr.st-highlight {
    background: rgba(212,160,23,0.1) !important;
    border-left: 3px solid #d4a017;
}
.dash-table tbody tr.st-highlight .st-name {
    color: #fbbf24 !important;
    font-weight: 800;
}
.dash-table tbody tr.st-highlight .st-rank {
    color: #d4a017 !important;
}

/* ── Live Player Indicator (green dot next to name) ──────────────── */
.st-live-dot {
    display: inline-block;
    width: 6px; height: 6px;
    background: #10b981;
    border-radius: 50%;
    margin-left: 0.3rem;
    vertical-align: middle;
    animation: livePulse 2s ease-in-out infinite;
    box-shadow: 0 0 4px rgba(16,185,129,0.5);
}

/* ── No Matches ───────────────────────────────────────────────────── */
.dash-empty {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; min-height: 60vh; text-align: center;
    color: #e8edf2; padding: 2rem;
}
.dash-empty-icon {
    width: 80px; height: 80px; border-radius: 50%;
    background: linear-gradient(135deg, #1e3044, #152535);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1.5rem; border: 2px solid #2a4058;
}
.dash-empty-icon i { font-size: 2rem; color: #4b5563; }
.dash-empty h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.5rem; }
.dash-empty p { color: #7a8ea0; font-size: 0.9rem; max-width: 400px; }
.dash-empty-hint {
    margin-top: 1.5rem; display: flex; align-items: center;
    gap: 0.5rem; color: #4b5563; font-size: 0.8rem;
}

/* ── Footer override for dark page ────────────────────────────────── */
.page-live-dashboard .footer {
    background: #0d1620; border-top: 1px solid #1e3044; color: #4b5563;
}
.page-live-dashboard .footer-container { color: #4b5563; }

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    .dash-grid { grid-template-columns: 1fr 360px; gap: 1rem; }
}

@media (max-width: 1024px) {
    .dash-grid { grid-template-columns: 1fr 320px; }
    .dash-table { font-size: 0.72rem; }
    .dash-table thead th { font-size: 0.62rem; padding: 0.4rem 0.3rem; }
    .dash-table tbody td { padding: 0.4rem 0.3rem; }
    .st-name { max-width: 100px; }
}

@media (max-width: 768px) {
    .dash-page-header {
        flex-direction: column; gap: 0.5rem; padding: 0.6rem 1rem;
    }
    .dash-page-meta {
        width: 100%; justify-content: space-between;
    }
    .dash-liga-tabs { padding: 0.5rem 1rem; }

    /* Stack to single column */
    .dash-grid {
        grid-template-columns: 1fr;
        padding: 0.5rem;
    }

    .dash-right {
        position: static;
        max-height: none;
        overflow: visible;
    }
    .dash-standings {
        max-height: none;
    }

    .dash-match-grid { grid-template-columns: 1fr; gap: 0.5rem; }
    .dash-ticker-panel { height: 150px; }
    .dash-recent { padding: 0 0.5rem 0.5rem; }
}

@media (max-width: 480px) {
    .dash-page-title h1 { font-size: 0.95rem; }
    .dash-tv-link span { display: none; }
    .card-remaining { font-size: 1.4rem; }
    .card-legs { font-size: 1.1rem; }
    .card-player-name { font-size: 0.8rem; max-width: 100px; }
    .ticker-msg { font-size: 0.68rem; padding: 0.15rem 0.5rem; }
    .ticker-time { font-size: 0.58rem; min-width: 42px; }
    .dash-table { font-size: 0.7rem; }
    .dash-ticker-panel { height: 130px; }
}

@media (max-width: 768px) {
    .dash-grid {
        grid-template-columns: 1fr;
        padding: 0.75rem;
        gap: 1rem;
    }
    .dash-match-grid {
        grid-template-columns: 1fr;
    }
    .dash-recent { padding: 0 0.75rem 1rem; }
}

@media (min-width: 1400px) {
    .dash-grid {
        grid-template-columns: 1fr 440px;
        padding: 1rem 2rem;
    }
    .dash-match-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (min-width: 1600px) {
    .dash-grid { grid-template-columns: 1fr 480px; }
    .dash-match-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}
