/* --- Root Design System Variables --- */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: rgba(17, 24, 39, 0.7);
    --bg-sidebar: rgba(13, 20, 38, 0.85);
    --card-bg: rgba(26, 36, 65, 0.5);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-border-focus: rgba(99, 102, 241, 0.6);
    --card-border-active: rgba(245, 158, 11, 0.5);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-accent: #fbbf24; /* Gold */
    
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --gold-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --green-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --red-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    
    --glow-primary: 0 0 15px rgba(99, 102, 241, 0.3);
    --glow-gold: 0 0 20px rgba(251, 191, 36, 0.4);
    --glow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Global Resets & Base Styles --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    direction: rtl;
    line-height: 1.6;
}

/* Background glows for premium look */
.bg-glow-1 {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0) 70%);
    top: -200px;
    right: -200px;
    z-index: -1;
    pointer-events: none;
}

.bg-glow-2 {
    position: absolute;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(217, 70, 239, 0.08) 0%, rgba(217, 70, 239, 0) 70%);
    bottom: -300px;
    left: -300px;
    z-index: -1;
    pointer-events: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(10, 15, 30, 0.5);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* --- Layout Container --- */
.app-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 6px 12px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header Section (Combined) --- */
.app-header-combined {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 6px;
}

.trophy-icon {
    width: 18px;
    height: 18px;
    color: var(--text-accent);
    filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.5));
}

.app-header-combined h1 {
    font-size: 1.1rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 40%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.app-tabs-inline {
    display: flex;
    gap: 6px;
}

.tab-btn {
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 4px;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.tab-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    color: #818cf8;
    box-shadow: var(--glow-primary);
}

/* --- Tab Contents Switching --- */
.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- TAB 1: BRACKET VIEW LAYOUT --- */
.bracket-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 12px;
    height: calc(100vh - 65px);
    min-height: 600px;
    position: relative;
}

.bracket-layout.sidebar-collapsed {
    grid-template-columns: 1fr;
}

@media (max-width: 1200px) {
    .bracket-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    .bracket-tree-container {
        height: 800px;
    }
    .sidebar-toggle-btn {
        display: none !important;
    }
}

/* Match Sidebar (Right column in RTL) */
.group-matches-sidebar {
    background: var(--bg-sidebar);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    box-shadow: var(--glow-card);
}

.bracket-layout.sidebar-collapsed .group-matches-sidebar {
    display: none !important;
}

/* Sidebar Collapse Toggle Button */
.sidebar-toggle-btn {
    position: absolute;
    right: 288px;
    top: 50%;
    transform: translateY(-50%) translateX(50%);
    width: 20px;
    height: 45px;
    background: rgba(99, 102, 241, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: var(--transition-fast);
}

.sidebar-toggle-btn:hover {
    background: #8b5cf6;
    box-shadow: var(--glow-primary);
}

.bracket-layout.sidebar-collapsed .sidebar-toggle-btn {
    right: -10px;
}

/* Sidebar Sub-tabs styling */
.sidebar-subtabs {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 3px;
    border-radius: 6px;
    margin-bottom: 4px;
}

.sidebar-subtab-btn {
    font-family: 'Cairo', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    flex: 1;
    padding: 4px 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: center;
}

.sidebar-subtab-btn:hover {
    color: var(--text-main);
}

.sidebar-subtab-btn.active {
    background: rgba(255, 255, 255, 0.05);
    color: #818cf8;
}

.subtab-pane {
    display: none;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
    overflow: hidden;
}

.subtab-pane.active {
    display: flex;
}

.sidebar-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
}

.sidebar-header .desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Group Letter Selector buttons grid */
.group-letters-selector {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
}

.group-letter-btn {
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 4px 0;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: center;
}

.group-letter-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.group-letter-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

/* Group detail panel inside sidebar */
.group-detail-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.group-detail-panel h4 {
    font-size: 0.9rem;
    font-weight: 700;
    border-bottom: 2px solid rgba(99, 102, 241, 0.3);
    padding-bottom: 4px;
}

/* Mini Table style */
.mini-table-wrapper {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    overflow: hidden;
}

.mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
    text-align: center;
}

.mini-table th {
    background: rgba(255, 255, 255, 0.02);
    padding: 4px 2px;
    color: var(--text-muted);
    font-weight: 600;
}

.mini-table td {
    padding: 4px 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

.mini-table tr.advanced-row {
    background: rgba(16, 185, 129, 0.04);
}

.mini-table tr.advanced-row-third {
    background: rgba(59, 130, 246, 0.04);
}

/* Match list in group sidebar */
.group-matches-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex-grow: 1;
    padding-left: 2px;
}

/* Individual match item card */
.match-item-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: var(--transition-fast);
}

.match-item-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(26, 36, 65, 0.65);
}

.match-meta-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    padding-bottom: 2px;
}

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

.team-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.team-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
}

.flag-img {
    width: 18px;
    height: 12px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Goals input style */
.score-input {
    width: 34px;
    height: 22px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    text-align: center;
    border-radius: 4px;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    outline: none;
    transition: var(--transition-fast);
}

.score-input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 4px rgba(129, 140, 248, 0.5);
    background: rgba(0, 0, 0, 0.6);
}

/* --- DYNAMIC HIERARCHICAL TREE BRACKET --- */
.bracket-tree-container {
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: auto;
    position: relative;
    box-shadow: var(--glow-card);
    display: flex;
    flex-direction: column;
    padding: 10px 0;
}

/* Header Columns styling */
.bracket-headers-row {
    display: flex;
    flex-direction: row; /* Natural RTL layout direction */
    justify-content: flex-start;
    gap: 12px;
    padding: 5px 10px 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 10px;
    min-width: 1376px;
}

.bracket-header-col {
    width: 140px;
    flex-shrink: 0;
    text-align: center;
}

.bracket-header-col h2, 
.bracket-header-col div {
    font-size: 0.78rem;
    font-weight: 700;
    color: white;
    margin-bottom: 2px;
}

.bracket-header-col .badge {
    font-size: 0.62rem;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    padding: 1px 6px;
    border-radius: 10px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Tree wrapper */
.bracket-tree-wrapper {
    display: flex;
    flex-direction: row; /* Symmetrical layout start (RTL) */
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    padding: 10px;
    min-width: 1376px;
    flex-grow: 1;
}

/* Center bracket column */
.center-bracket-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 140px;
    flex-shrink: 0;
}

/* Symmetrical Bracket Nodes and Directions */
.bracket-node {
    position: relative;
}

.bracket-node.dir-rtl {
    display: flex;
    flex-direction: row-reverse; /* children on right, card on left */
    align-items: center;
}

.bracket-node.dir-ltr {
    display: flex;
    flex-direction: row; /* children on left, card on right */
    align-items: center;
}

.bracket-children {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 10px;
    position: relative;
}

.bracket-children.dir-rtl {
    padding-left: 12px; /* Space to the right of parent card */
}

.bracket-children.dir-ltr {
    padding-right: 12px; /* Space to the left of parent card */
}

/* Knockout Match Card */
.ko-match-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 3px 5px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    transition: var(--transition-normal);
    position: relative;
    width: 140px;
    z-index: 2; /* Sits on top of connection lines */
}

.ko-match-card:hover {
    transform: translateY(-1px);
    border-color: var(--card-border-focus);
    box-shadow: var(--glow-primary);
}

.ko-match-label {
    font-size: 0.58rem;
    color: var(--text-muted);
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 2px;
}

.ko-match-time {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 1px;
}

/* Symmetrical vertical team layout for knockouts */
.ko-match-teams-vertical {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ko-team-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* Mirrored flow logic:
   - Left side & Center: Name/Flag on left, Score input on right.
     In RTL body, layout from left to right is achieved with row-reverse.
   - Right side: Score input on left, Name/Flag on right.
     In RTL body, layout from right to left (default) is achieved with row.
*/
.dir-ltr .ko-team-row,
.center-bracket-column .ko-team-row {
    flex-direction: row-reverse;
}

.dir-rtl .ko-team-row {
    flex-direction: row;
}

.ko-team-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-direction: row-reverse; /* Places flag (1st child) on the left, name (2nd child) on the right */
    flex-grow: 1;
    overflow: hidden;
}

.ko-team-name {
    font-size: 0.65rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
    flex-grow: 1;
}

.ko-team-row.winner .ko-team-name {
    color: var(--text-accent);
    font-weight: 700;
}

.flag-placeholder {
    width: 18px;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    flex-shrink: 0;
}

/* Knockout match card overrides for scores and flags */
.ko-match-card .score-input {
    width: 26px;
    height: 18px;
    font-size: 0.72rem;
}

.ko-match-card .flag-img,
.ko-match-card .flag-placeholder {
    width: 15px;
    height: 10px;
}

.ko-score-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 2px;
}

/* Penalty Shootout input styling */
.penalty-input {
    width: 24px;
    height: 18px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
    text-align: center;
    border-radius: 4px;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 0.7rem;
    outline: none;
}

.penalty-input:focus {
    background: rgba(245, 158, 11, 0.3);
    border-color: #fbbf24;
}

.penalty-label {
    font-size: 0.62rem;
    color: #f59e0b;
    font-weight: 600;
}

/* --- VISUAL CONNECTOR TREE LINES (CSS Pseudo-elements) --- */

/* RTL Flow Connectors */
.bracket-node.dir-rtl:not(.leaf) > .ko-match-card::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    width: 6px;
    height: 2px;
    background: rgba(99, 102, 241, 0.5); /* Violet theme line */
    z-index: 1;
    box-shadow: 0 0 4px rgba(99, 102, 241, 0.3);
}

.bracket-children.dir-rtl > .bracket-node > .ko-match-card::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    width: 6px;
    height: 2px;
    background: rgba(217, 70, 239, 0.5); /* Magenta theme line */
    z-index: 1;
    box-shadow: 0 0 4px rgba(217, 70, 239, 0.3);
}

.bracket-children.dir-rtl::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 25%;
    height: 50%;
    width: 2px;
    background: linear-gradient(to bottom, rgba(99, 102, 241, 0.8) 0%, rgba(217, 70, 239, 0.8) 100%);
    z-index: 1;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

/* LTR Flow Connectors */
.bracket-node.dir-ltr:not(.leaf) > .ko-match-card::after {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    width: 6px;
    height: 2px;
    background: rgba(99, 102, 241, 0.5);
    z-index: 1;
    box-shadow: 0 0 4px rgba(99, 102, 241, 0.3);
}

.bracket-children.dir-ltr > .bracket-node > .ko-match-card::before {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    width: 6px;
    height: 2px;
    background: rgba(217, 70, 239, 0.5);
    z-index: 1;
    box-shadow: 0 0 4px rgba(217, 70, 239, 0.3);
}

.bracket-children.dir-ltr::before {
    content: '';
    position: absolute;
    right: 6px;
    top: 25%;
    height: 50%;
    width: 2px;
    background: linear-gradient(to bottom, rgba(99, 102, 241, 0.8) 0%, rgba(217, 70, 239, 0.8) 100%);
    z-index: 1;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

/* --- Column & Round Toggling --- */
.bracket-tree-container.hide-r32 .col-r32 { display: none !important; }
.bracket-tree-container.hide-r16 .col-r16 { display: none !important; }
.bracket-tree-container.hide-qf .col-qf { display: none !important; }
.bracket-tree-container.hide-sf .col-sf { display: none !important; }

.bracket-tree-container.hide-r32 .round-r16 > .bracket-children { display: none !important; }
.bracket-tree-container.hide-r32 .round-r16 > .ko-match-card::after { display: none !important; }

.bracket-tree-container.hide-r16 .round-qf > .bracket-children { display: none !important; }
.bracket-tree-container.hide-r16 .round-qf > .ko-match-card::after { display: none !important; }

.bracket-tree-container.hide-qf .round-sf > .bracket-children { display: none !important; }
.bracket-tree-container.hide-qf .round-sf > .ko-match-card::after { display: none !important; }

.bracket-tree-container.hide-sf .round-final > .bracket-children { display: none !important; }
.bracket-tree-container.hide-sf .round-final > .ko-match-card::after { display: none !important; }

/* Bracket Toolbar */
.bracket-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 20px;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.toolbar-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}

.round-toggle-btn {
    font-family: 'Cairo', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.round-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.round-toggle-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    color: #818cf8;
}

/* --- CHAMPION BANNER (Left of Final Card) --- */
.champion-banner-container {
    background: radial-gradient(circle, rgba(251, 191, 36, 0.15) 0%, rgba(251, 191, 36, 0.02) 80%);
    border: 2px solid var(--text-accent);
    box-shadow: var(--glow-gold);
    border-radius: 8px;
    padding: 6px;
    text-align: center;
    width: 140px;
    flex-shrink: 0;
    align-self: center;
    animation: pulseGold 2s infinite alternate;
}

@keyframes pulseGold {
    from { box-shadow: 0 0 6px rgba(251, 191, 36, 0.3); }
    to { box-shadow: 0 0 15px rgba(251, 191, 36, 0.6); }
}

.champion-trophy {
    font-size: 1.5rem;
    margin-bottom: 2px;
    filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.7));
}

.champion-banner-container h3 {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-accent);
    margin-bottom: 4px;
}

.champion-team {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 6px;
    border-radius: 20px;
    border: 1px solid rgba(251, 191, 36, 0.2);
    font-size: 0.72rem;
    font-weight: 700;
}

/* --- TAB 2: GROUPS & STANDINGS FULL VIEW --- */
.third-places-ranking-section {
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: var(--glow-card);
}

.card-header-accent h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #60a5fa;
    margin-bottom: 2px;
}

.card-header-accent .desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.third-places-table-wrapper {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    font-size: 0.78rem;
}

.standings-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 4px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.standings-table td {
    padding: 6px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.standings-table tr.qualifier-row-highlight {
    background: rgba(16, 185, 129, 0.04);
}

.standings-table tr.qualifier-row-highlight:hover {
    background: rgba(16, 185, 129, 0.08);
}

.standings-table tr.eliminated-row-highlight {
    background: rgba(239, 68, 68, 0.02);
}

.status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

.status-badge.qualified {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.eliminated {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* 12 Groups grid layout */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 10px;
}

.group-card {
    background: var(--bg-sidebar);
    backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px;
    box-shadow: var(--glow-card);
    transition: var(--transition-normal);
}

.group-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.group-card-header {
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 4px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-card-header h3 {
    font-size: 0.9rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.group-card-table-wrapper {
    overflow-x: auto;
}

.group-table th,
.group-table td {
    padding: 4px 2px;
    font-size: 0.72rem;
}

/* Table rows styling */
.group-table tr.top2-row {
    border-right: 3px solid #10b981;
}

.group-table tr.best3rd-row {
    border-right: 3px solid #3b82f6;
}

/* --- App Footer --- */
.app-footer-info {
    text-align: center;
    margin-top: 20px;
    padding: 10px 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Highlight for upcoming matches within 24 hours */
.match-item-card.upcoming-match-highlight,
.ko-match-card.upcoming-match-highlight {
    border-right: 3px solid #10b981 !important;
}
