/* ================================
   SportsBet Analyzer - Premium Dark Theme
   ================================ */

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(99, 102, 241, 0.15);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-primary: #6366f1;
    --accent-secondary: #22d3ee;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #22d3ee);
    
    --success: #10b981;
    --success-soft: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.12);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* === Background Orbs === */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
}

.bg-orb-1 {
    width: 600px;
    height: 600px;
    background: rgba(99, 102, 241, 0.08);
    top: -200px;
    right: -200px;
    animation: orbFloat1 20s ease-in-out infinite;
}

.bg-orb-2 {
    width: 500px;
    height: 500px;
    background: rgba(34, 211, 238, 0.06);
    bottom: -150px;
    left: -150px;
    animation: orbFloat2 25s ease-in-out infinite;
}

.bg-orb-3 {
    width: 400px;
    height: 400px;
    background: rgba(139, 92, 246, 0.05);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: orbFloat3 30s ease-in-out infinite;
}

@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-80px, 80px); }
}

@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(60px, -60px); }
}

@keyframes orbFloat3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
}

/* === Container === */
.container {
    position: relative;
    z-index: 1;
    max-width: 1800px;
    margin: 0 auto;
    padding: 24px;
}

/* === Header === */
.header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 20px 28px;
    margin-bottom: 24px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-md);
    /* Stat-cards below the header also have backdrop-filter which creates
       their own stacking context. Without these two lines the nav-menu
       dropdown panel (z-index: 100 inside the header) disappears behind
       them. Promoting the whole header to its own stacking context above
       the rest of the page fixes it. */
    position: relative;
    z-index: 50;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;   /* top-align so right column docks beside the logo */
    flex-wrap: wrap;
    gap: 16px;
}

/* Left column: logo + status pills + nav menu, stacked vertically.
   The status pills and the nav-toggle live UNDER the logo so they
   don't compete with the scrape buttons for horizontal space, and
   the nav dropdown opens below its toggle without overlapping the
   right-column scrape buttons. */
.header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glow);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Header-action groups: simple flex containers, no background / border.
   The grouping is visual via gap + the header itself, not via a chrome
   box around each cluster. */
.action-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Scrape group no longer needs margin-left:auto because it lives in its
   own right-column .header-actions container. Keeping the rule at all
   would cause the group to slide oddly when wrapped onto its own row
   on mobile. */

/* === Status Badge === */
.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    /* Fixed width so the label text ('Bereit' / 'Crawlt...' / 'Fertig')
       doesn't shift the rest of the header row when it changes. */
    min-width: 108px;
    justify-content: center;
}

/* VPN button: variable-length endpoint name moved to the chip beside it;
   the button text is fixed-length ('VPN: an' / 'VPN: aus' / 'VPN…') and
   the min-width keeps it from reflowing mid-toggle. */
/* Compact buttons in the header status group — tighter padding + smaller
   font so the status pills, VPN, DNS toggle fit on one row alongside the
   nav-menu and the scrape primary actions. */
.btn-nav.btn-compact {
    padding: 6px 10px;
    font-size: 0.78rem;
    gap: 6px;
}
.btn-nav.btn-compact svg {
    width: 14px;
    height: 14px;
}

/* VPN-server-name inline inside the VPN button (previously a separate
   100-130px wide chip). Hides entirely when disconnected; when shown,
   ellipsis-truncates at ~140px on desktop, 90px on mobile. */
.vpn-server-inline {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    margin-left: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 6px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--success);
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.28);
}
.vpn-server-inline[hidden] {
    display: none;
}

/* Nav-Menü Dropdown — single toggle button that exposes the 5 site links
   on click. Saves ~400 px in the header row compared to the previous
   always-visible link list. */
.nav-menu-wrapper {
    position: relative;
    display: inline-flex;
}
.nav-menu-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    /* Solid background — --bg-card is 70% opaque so the page content
       leaked through. --bg-secondary is the solid sibling token. */
    background: var(--bg-secondary, #111827);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.45);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-menu-panel[hidden] {
    display: none;
}
.nav-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 7px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}
.nav-menu-item:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}
.nav-menu-item svg {
    flex-shrink: 0;
    opacity: 0.8;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: background 0.3s;
}

.status-idle .status-dot { background: var(--text-muted); }
.status-scraping .status-dot { background: var(--warning); animation: pulse 1.5s infinite; }
.status-done .status-dot { background: var(--success); }
.status-error .status-dot { background: var(--danger); }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* === Primary Button === */
.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.stat-icon-matches { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.stat-icon-sources { background: rgba(34, 211, 238, 0.15); color: #22d3ee; }
.stat-icon-value { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-icon-time { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* === Progress Bar === */
.progress-container {
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 100px;
    width: 0%;
    transition: width 0.8s ease;
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.progress-text {
    margin-top: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* === Filter Bar === */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.filter-group select,
.filter-group input {
    padding: 6px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.2s;
}

.filter-group select:focus,
.filter-group input:focus {
    border-color: var(--accent-primary);
}

.filter-group input {
    width: 180px;
}

/* === Results Table === */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-md);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.results-table thead {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.results-table th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    user-select: none;
}

.results-table th.sortable {
    cursor: pointer;
    transition: color 0.2s;
}

.results-table th.sortable:hover {
    color: var(--accent-secondary);
}

.results-table th.active-sort {
    color: var(--accent-primary);
}

.sort-icon {
    font-size: 0.75rem;
    opacity: 0.5;
}

.results-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.results-table tbody tr {
    cursor: pointer;
    transition: all 0.2s ease;
}

.results-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

/* Row variants */
.row-hot { border-left: 3px solid var(--success); }
.row-warm { border-left: 3px solid #6ee7b7; }
.row-mild { border-left: 3px solid #a7f3d0; }
.row-cold { border-left: 3px solid var(--text-muted); }
.row-neutral { border-left: 3px solid transparent; }

/* Fade-in animation disabled — rows render immediately */
.fade-in {
    animation: none;
    opacity: 1;
}

/* Cell styles */
.td-rank {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.8rem;
    width: 40px;
    text-align: center;
}

.td-match {
    min-width: 200px;
}

.match-teams {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.team-home {
    font-weight: 600;
    color: var(--text-primary);
}

.team-away {
    font-weight: 400;
    color: var(--text-secondary);
}

/* Highlight the team / player the bet is on. JS adds `bet-side` to whichever
   team-name span matches the best_bet side (home for "1", away for "2",
   the vs separator itself for a draw "X"). */
.team-home.bet-side,
.team-away.bet-side,
.team-name.bet-side,
.vs.bet-side {
    color: var(--success) !important;             /* same green as positive ROI / profit */
    font-weight: 700 !important;
}

.vs {
    /* font-size inherits from the table cell so vs matches the surrounding
       team-name text size instead of looking shrunken. */
    color: var(--text-muted);
    font-weight: 300;
}

.kickoff {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.td-league {
    max-width: 140px;
}

.league-badge {
    display: inline-block;
    padding: 3px 8px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 100px;
    font-size: 0.72rem;
    color: #a5b4fc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 130px;
}

.td-odds {
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    text-align: center;
    min-width: 60px;
}

.td-prob {
    min-width: 140px;
}

.prob-mini {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.td-sources {
    text-align: center;
}

.sources-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.15);
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    color: #22d3ee;
}

.td-value {
    text-align: center;
    min-width: 80px;
}

.value-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.value-badge.neutral {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.td-bet {
    min-width: 100px;
}

.bet-tip {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #34d399;
    white-space: nowrap;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-muted);
}

.empty-icon {
    margin-bottom: 20px;
    color: var(--accent-primary);
    opacity: 0.3;
}

.empty-state h2 {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

/* === Modal === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.modal-visible {
    opacity: 1;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 720px;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.modal-visible .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.detail-header {
    margin-bottom: 24px;
}

.detail-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.detail-league {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.detail-comparison {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.detail-col {
    flex: 1;
    padding: 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.detail-col h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
}

.detail-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detail-odds {
    display: flex;
    gap: 8px;
}

.odd-box {
    flex: 1;
    text-align: center;
    padding: 10px 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.odd-box.value-positive {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}

.odd-box.value-negative {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.03);
}

.odd-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.odd-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.odd-prob {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.odd-dev {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 2px;
}

.value-positive .odd-dev { color: var(--success); }
.value-negative .odd-dev { color: var(--danger); }

.margin-info {
    display: block;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.detail-recommendation {
    padding: 16px;
    background: var(--success-soft);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.detail-recommendation h3 {
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.detail-recommendation p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.detail-sources {
    margin-top: 20px;
}

.detail-sources h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
}

.detail-source {
    padding: 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.detail-source h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-secondary);
    margin-bottom: 6px;
}

.detail-probs {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.detail-pred, .detail-conf {
    display: inline-block;
    margin-top: 4px;
    margin-right: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.no-data {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
    z-index: 2000;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); color: #1a1a1a; }
.toast-info { background: var(--accent-primary); }

/* === Footer === */
.footer {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* === Navigation Button === */
.btn-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-nav:hover {
    border-color: var(--border-glow);
    background: var(--bg-card-hover);
}

/* === Evaluation Page === */
.controls-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
    backdrop-filter: blur(20px);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.eval-input {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.eval-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.stat-icon-eval { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.stat-icon-winloss { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-icon-staked { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.stat-icon-profit { background: rgba(34, 211, 238, 0.15); color: #22d3ee; }
.stat-icon-pending { background: var(--warning-soft); color: var(--warning); }
.stat-icon-unmatched { background: var(--danger-soft); color: var(--danger); }
.stat-icon-roi { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }

.profit-positive { color: var(--success) !important; }
.profit-negative { color: var(--danger) !important; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.badge-won {
    background: var(--success-soft);
    color: var(--success);
    border-color: transparent;
}

.badge-lost {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: transparent;
}

.badge-running {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border-color: transparent;
}

.badge-pending {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: transparent;
}

.badge-unmatched {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: transparent;
}

.badge-cancelled {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border-color: transparent;
}

.exclude-tag {
    background: var(--danger-soft);
    color: var(--danger);
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.exclude-tag-remove {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 1;
}

.exclude-tag-remove:hover {
    opacity: 1;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 16px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-heading svg {
    flex-shrink: 0;
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-overlay .loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.loading-overlay h3 {
    color: var(--text-primary);
    margin-bottom: 6px;
}

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.exclude-banner {
    background: var(--danger-soft);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 20px;
    color: var(--danger);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.exclude-banner svg {
    flex-shrink: 0;
}

.score-input {
    width: 70px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-align: center;
    font-family: inherit;
    font-size: 0.85rem;
}

.score-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.8rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.btn-sm:hover {
    background: var(--bg-card-hover);
}

.table-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === Responsive === */

/* Tablet */
@media (max-width: 1024px) {
    .results-table {
        font-size: 0.8rem;
    }

    .th-prob, .td-prob {
        display: none;
    }

    .stat-card:hover {
        transform: none;
        box-shadow: none;
    }
}

/* Mobile */
@media (max-width: 768px) {
    /* Performance: smaller orbs */
    .bg-orb-1 { width: 300px; height: 300px; }
    .bg-orb-2 { width: 250px; height: 250px; }
    .bg-orb-3 { display: none; }

    .container {
        padding: 10px;
    }

    /* Header */
    .header {
        padding: 14px 16px;
        border-radius: var(--radius-lg);
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .header h1 {
        font-size: 1.15rem;
    }

    .subtitle {
        font-size: 0.78rem;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
    }

    .logo-icon svg {
        width: 26px;
        height: 26px;
    }

    /* Header-left also becomes full-width on mobile so the status pills +
       nav menu sit cleanly under the logo, exactly the same vertical
       stack pattern as on desktop. */
    .header-left {
        width: 100%;
    }

    .header-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    /* In header-actions (scrape group) on mobile, collapse the boxes so
       the 3 scrape buttons spread evenly across the row. Header-left
       groups keep their flex layout so status pills + DNS sit side by
       side in one wrap-friendly row. */
    .header-actions .action-group {
        display: contents;
    }
    .header-left .action-group {
        flex-wrap: wrap;
        gap: 6px;
    }
    .header-left .action-group-nav {
        width: 100%;
    }
    .header-left .nav-menu-wrapper,
    .header-left #nav-menu-toggle {
        width: 100%;
    }

    .header-left .btn-nav,
    .header-actions .btn-nav,
    .header-actions .btn-primary {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
        font-size: 0.82rem;
        padding: 10px 14px;
        min-height: 44px;   /* iOS touch-target floor */
    }

    .header-actions .status-badge {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
        font-size: 0.78rem;
        min-height: 44px;
    }

    /* Sport-tabs (Dashboard + Unmatched-Choice): bigger touch targets,
       horizontal scroll if the row wraps awkwardly with many sports. */
    .sport-tabs {
        gap: 8px !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap !important;
        padding-bottom: 2px;
    }
    .sport-tab {
        flex: 0 0 auto;
        min-height: 44px;
        padding: 10px 18px !important;
        font-size: 0.95rem !important;
        white-space: nowrap;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 12px 14px;
        gap: 10px;
        border-radius: var(--radius-md);
    }

    .stat-icon {
        width: 36px;
        height: 36px;
    }

    .stat-icon svg {
        width: 18px;
        height: 18px;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    /* Filter bar */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
        border-radius: var(--radius-md);
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .filter-group select,
    .filter-group input {
        width: 100%;
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    /* Tables: horizontal scroll only as a last resort. Padding & font dropped
       aggressively so most tables actually fit on a phone viewport without
       any horizontal scrolling. */
    .table-container {
        border-radius: var(--radius-lg);
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .results-table {
        font-size: 0.72rem;
    }

    .results-table th {
        padding: 6px 4px;
        font-size: 0.62rem;
    }

    .results-table td {
        padding: 6px 4px;
    }

    /* Dashboard: hide less-important columns */
    .th-rank, .td-rank {
        display: none;
    }

    .th-odds:not(:first-of-type), .td-odds:not(:first-of-type) {
        display: none;
    }

    .th-league, .td-league {
        display: none;
    }

    .th-sources, .td-sources {
        display: none;
    }

    /* Don't force a min-width — let the visible columns shrink to their
       content. This is the difference between always-scrolling vs.
       fits-on-screen for typical phone widths. */
    #table-container .results-table {
        min-width: 0;
    }

    .td-match {
        min-width: 0;
    }

    .td-value {
        min-width: 0;
    }

    .td-bet {
        min-width: 0;
    }

    /* Choice ROI tables (data-table="pending"/"eval") — 14 columns:
       1 Datum | 2 Vorlauf | 3 Begegnung | 4 Tipp | 5 Abw. | 6 Quote |
       7 Tip-CLV | 8 Pinn-CLV | 9 Quellen | 10 Herkunft | 11 Ergebnis |
       12 Status | 13 P/L | 14 ×

       Hide low-priority columns on mobile so the table fits a phone screen.
       Status is hidden too — the Ergebnis cell visually transports the same
       information (badge color + text). Keep: Datum, Begegnung, Tip-CLV,
       Ergebnis, P/L, remove. */
    .results-table[data-table="pending"] th:nth-child(2),
    .results-table[data-table="pending"] td:nth-child(2),
    .results-table[data-table="pending"] th:nth-child(4),
    .results-table[data-table="pending"] td:nth-child(4),
    .results-table[data-table="pending"] th:nth-child(5),
    .results-table[data-table="pending"] td:nth-child(5),
    .results-table[data-table="pending"] th:nth-child(6),
    .results-table[data-table="pending"] td:nth-child(6),
    .results-table[data-table="pending"] th:nth-child(8),
    .results-table[data-table="pending"] td:nth-child(8),
    .results-table[data-table="pending"] th:nth-child(9),
    .results-table[data-table="pending"] td:nth-child(9),
    .results-table[data-table="pending"] th:nth-child(10),
    .results-table[data-table="pending"] td:nth-child(10),
    .results-table[data-table="pending"] th:nth-child(12),
    .results-table[data-table="pending"] td:nth-child(12),
    .results-table[data-table="eval"] th:nth-child(2),
    .results-table[data-table="eval"] td:nth-child(2),
    .results-table[data-table="eval"] th:nth-child(4),
    .results-table[data-table="eval"] td:nth-child(4),
    .results-table[data-table="eval"] th:nth-child(5),
    .results-table[data-table="eval"] td:nth-child(5),
    .results-table[data-table="eval"] th:nth-child(6),
    .results-table[data-table="eval"] td:nth-child(6),
    .results-table[data-table="eval"] th:nth-child(8),
    .results-table[data-table="eval"] td:nth-child(8),
    .results-table[data-table="eval"] th:nth-child(9),
    .results-table[data-table="eval"] td:nth-child(9),
    .results-table[data-table="eval"] th:nth-child(10),
    .results-table[data-table="eval"] td:nth-child(10),
    .results-table[data-table="eval"] th:nth-child(12),
    .results-table[data-table="eval"] td:nth-child(12) {
        display: none;
    }
    /* Let the remaining Choice ROI columns shrink to content too. */
    .results-table[data-table="pending"],
    .results-table[data-table="eval"] {
        min-width: 0;
    }
    /* Compact the CLV cell sub-lines (open → close) — on phones the
       parent cell is narrow, the second-line "65% → 52%" sub-row was
       wrapping unattractively. */
    .results-table[data-table="pending"] .results-table div,
    .results-table[data-table="eval"] div {
        font-size: 0.66rem;
    }
    /* Choice ROI status/result badges: shrink so the rightmost columns
       fit without wrapping the Profit/Loss number. */
    .results-table[data-table="pending"] .badge,
    .results-table[data-table="eval"] .badge {
        font-size: 0.62rem;
        padding: 2px 5px;
    }
    /* League/prediction badge inside Choice ROI cells */
    .results-table[data-table="pending"] .league-badge,
    .results-table[data-table="eval"] .league-badge {
        font-size: 0.65rem;
        max-width: none;
    }

    /* Controls panel */
    .controls-panel {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 14px 16px;
        border-radius: var(--radius-md);
    }

    .controls-panel .input-group {
        min-width: 0 !important;
        flex: none !important;
    }

    .eval-input {
        width: 100% !important;
    }

    /* Section headings */
    .section-heading {
        font-size: 0.9rem;
        padding: 12px 14px;
    }

    /* Modal */
    .modal-content {
        width: 96%;
        max-height: 90vh;
        padding: 20px 16px;
        border-radius: var(--radius-lg);
    }

    .detail-comparison {
        flex-direction: column;
    }

    .detail-vs {
        display: none;
    }

    .detail-header h2 {
        font-size: 1.1rem;
        padding-right: 32px;
    }

    .detail-probs {
        flex-direction: column;
        gap: 4px;
    }

    .detail-odds {
        gap: 6px;
    }

    .odd-value {
        font-size: 1rem;
    }

    .detail-source {
        padding: 10px;
    }

    /* Toast: full width on mobile */
    .toast {
        left: 10px;
        right: 10px;
        bottom: 10px;
        text-align: center;
    }

    /* Empty state */
    .empty-state {
        padding: 48px 16px;
    }

    .empty-icon svg {
        width: 48px;
        height: 48px;
    }

    .empty-state h2 {
        font-size: 1.1rem;
    }

    /* Footer */
    .footer {
        padding: 20px 12px;
        font-size: 0.72rem;
    }

    /* Progress bar */
    .progress-container {
        padding: 12px 14px;
        border-radius: var(--radius-md);
    }

    /* Loading overlay */
    .loading-overlay h3 {
        font-size: 1rem;
    }

    /* Badges: compact */
    .badge {
        font-size: 0.72rem;
        padding: 3px 8px;
    }

    .value-badge {
        font-size: 0.72rem;
        padding: 3px 8px;
    }

    .league-badge {
        font-size: 0.68rem;
        max-width: 100px;
    }

    .bet-tip {
        font-size: 0.7rem;
        padding: 2px 8px;
    }

    .sources-count {
        width: 24px;
        height: 24px;
        font-size: 0.72rem;
    }

    /* Exclude */
    .exclude-banner {
        font-size: 0.78rem;
        padding: 10px 12px;
    }

    .exclude-tag {
        font-size: 0.72rem;
    }
}

/* Small phone */
@media (max-width: 480px) {
    .container {
        padding: 6px;
    }

    .header {
        padding: 12px;
        border-radius: var(--radius-md);
    }

    .header h1 {
        font-size: 1rem;
    }

    .logo-section {
        gap: 10px;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
    }

    .logo-icon svg {
        width: 22px;
        height: 22px;
    }

    /* Stats: single column */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .stat-card {
        padding: 10px 12px;
    }

    /* Buttons: fully stacked — undo the 768px display:contents trick so the
       action-group divs become real flex containers again and each button
       takes its own full-width row. */
    .header-actions {
        flex-direction: column;
    }

    .header-actions .action-group {
        display: flex;
        flex-direction: column;
        gap: 6px;
        width: 100%;
        background: transparent;
        border: none;
        padding: 0;
        margin-left: 0;
    }

    .header-actions .btn-nav,
    .header-actions .btn-primary,
    .header-actions .status-badge {
        width: 100%;
        flex: none;
    }

    /* Modal: bottom sheet */
    .modal {
        align-items: flex-end;
    }

    .modal-content {
        width: 100%;
        max-height: 92vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding: 16px 12px;
    }

    .modal-close {
        top: 12px;
        right: 12px;
    }

    .odd-box {
        padding: 6px 3px;
    }

    .odd-value {
        font-size: 0.9rem;
    }

    .odd-label {
        font-size: 0.68rem;
    }

    .detail-col h3 {
        font-size: 0.78rem;
    }

    .detail-header h2 {
        font-size: 1rem;
    }

    /* Tables — tighter still on small phones */
    .results-table {
        font-size: 0.68rem;
    }

    .results-table th {
        padding: 5px 3px;
        font-size: 0.58rem;
    }

    .results-table td {
        padding: 5px 3px;
    }

    .table-container {
        border-radius: var(--radius-md);
    }

    /* Section headings */
    .section-heading {
        font-size: 0.85rem;
        padding: 10px 12px;
    }

    /* Controls */
    .controls-panel {
        padding: 12px;
        border-radius: var(--radius-md);
    }

    /* Score input */
    .score-input {
        width: 60px;
        padding: 3px 6px;
        font-size: 0.78rem;
    }

    .filter-bar {
        padding: 10px 12px;
        border-radius: var(--radius-md);
    }

    .empty-state {
        padding: 36px 12px;
    }
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
