/* ==========================================================================
   CSS CORE DESIGN SYSTEM & THEMING
   Theme: Galactic Deep Blue Glassmorphism (Esports Aesthetic)
   ========================================================================== */

:root {
    --bg-main: #06070c;
    --bg-darker: #020306;
    --glass-bg: rgba(13, 17, 30, 0.65);
    --glass-bg-hover: rgba(22, 28, 48, 0.8);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-glow: rgba(79, 70, 229, 0.4);
    
    /* Harmonious Curated Colors */
    --color-primary: #5850ec; /* Indigo */
    --color-secondary: #00d2ff; /* Neon Cyan */
    --color-accent: #f59e0b; /* Amber */
    --color-success: #10b981; /* Emerald */
    --color-danger: #ef4444; /* Coral Red */
    
    /* Text colors */
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-glow: 0 0 10px rgba(88, 80, 236, 0.8);
    --text-glow-blue: 0 0 10px rgba(0, 210, 255, 0.8);
    --text-glow-gold: 0 0 12px rgba(245, 158, 11, 0.9);
    
    /* Dimensions & Transitions */
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets & Fonts */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', 'Outfit', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ==========================================================================
   ANIMATED BACKGROUND LAYER (Deep drifting glow)
   ========================================================================== */

.bg-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    opacity: 0.35;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.bg-glow-1 {
    background: radial-gradient(circle, var(--color-primary) 0%, rgba(0,0,0,0) 70%);
    top: -150px;
    left: -150px;
    animation: drift 25s infinite alternate ease-in-out;
}

.bg-glow-2 {
    background: radial-gradient(circle, rgba(0, 210, 255, 0.8) 0%, rgba(0,0,0,0) 70%);
    bottom: -150px;
    right: -150px;
    animation: drift 30s infinite alternate-reverse ease-in-out;
}

.bg-glow-3 {
    background: radial-gradient(circle, rgba(239, 68, 68, 0.4) 0%, rgba(0,0,0,0) 70%);
    top: 40%;
    left: 40%;
    transform: translate(-50%, -50%);
    animation: drift 35s infinite alternate ease-in-out;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(100px, 80px) scale(1.15); }
    100% { transform: translate(-80px, -50px) scale(0.9); }
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */

.app-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    margin-top: 24px;
    margin-bottom: 40px;
}

/* ==========================================================================
   GLASSMORPHISM NAVBAR
   ========================================================================== */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    border-radius: var(--radius-lg);
    z-index: 100;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: var(--transition-smooth);
}

.hover-glow:hover {
    border-color: var(--glass-border-glow);
    box-shadow: 0 8px 32px 0 rgba(79, 70, 229, 0.15), 0 0 15px 0 rgba(79, 70, 229, 0.1);
}

.nav-brand a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.brand-icon {
    font-size: 1.8rem;
    margin-right: 12px;
    color: var(--color-secondary);
}

.brand-sub {
    color: var(--color-secondary);
    font-weight: 400;
    margin-left: 2px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    border: 1px solid var(--glass-border-glow);
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.2);
    color: #fff;
}

.logout-btn {
    color: var(--color-danger);
}
.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ff6b6b !important;
}

/* ==========================================================================
   HERO / CHAMPION BANNER STYLE
   ========================================================================== */

.dashboard-hero {
    margin-bottom: 32px;
    padding: 24px 0;
}

.hero-title {
    font-family: 'Outfit', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff 30%, var(--color-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 8px 0;
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 400;
}

.champion-banner {
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 32px;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
    box-shadow: 0 8px 32px 0 rgba(245, 158, 11, 0.1) !important;
}

.crown-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.champion-name {
    text-transform: uppercase;
    font-size: 0.95rem;
    letter-spacing: 2px;
    color: var(--color-accent);
}

.champion-display {
    font-size: 2.5rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    margin: 8px 0;
    color: #fff;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

.champion-congrats {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* ==========================================================================
   TABS SYSTEM
   ========================================================================== */

.tabs-container {
    width: 100%;
}

.tabs-list {
    display: flex;
    gap: 8px;
    padding: 6px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    max-width: fit-content;
}

.tab-trigger {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 20px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition-smooth);
}

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

.tab-trigger.active {
    color: #fff;
    background: var(--color-primary);
    box-shadow: 0 4px 15px rgba(88, 80, 236, 0.4);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ==========================================================================
   STANDINGS GRID & TABLES
   ========================================================================== */

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 24px;
}

.group-card {
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.group-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 12px;
}

.group-icon {
    font-size: 1.25rem;
}

.group-card-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

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

.table th, .table td {
    padding: 12px 10px;
    text-align: left;
}

.table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--glass-border);
}

.standings-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: var(--transition-smooth);
}

.standings-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.pos-cell {
    width: 40px;
}

.badge-pos {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 800;
}

.badge-pos.gold {
    background: linear-gradient(135deg, #ffd700, #b8860b);
    color: #000;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.badge-pos.silver {
    background: linear-gradient(135deg, #c0c0c0, #708090);
    color: #000;
    box-shadow: 0 0 8px rgba(192, 192, 192, 0.3);
}

.badge-pos.bronze {
    background: linear-gradient(135deg, #cd7f32, #8b4513);
    color: #fff;
}

/* Standings qualifying state styling */
.row-winner {
    background: rgba(88, 80, 236, 0.04);
}
.row-runner-up {
    background: rgba(0, 210, 255, 0.02);
}

.player-name-cell {
    color: #fff;
}

.group-card-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.footer-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   MATCHES SECTION
   ========================================================================== */

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 10px 16px 10px 42px;
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-smooth);
}

.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 10px rgba(88, 80, 236, 0.25);
}

.filter-tabs {
    display: flex;
    gap: 8px;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition-smooth);
}

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

.filter-btn.active {
    background: rgba(88, 80, 236, 0.15);
    border-color: var(--color-primary);
    color: #fff;
}

.matches-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.match-item {
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 150px;
}

.match-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.match-group-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 2px 8px;
    border-radius: 12px;
    color: var(--color-secondary);
}

.match-code-badge {
    color: var(--text-muted);
}

.match-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.match-player {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.match-player:first-child {
    text-align: left;
}

.match-player:last-child {
    text-align: right;
}

.p-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: var(--transition-smooth);
}

.match-player.is-winner .p-name {
    color: #fff;
}

.p-score {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-muted);
}

.match-player.is-winner .p-score {
    color: var(--color-secondary);
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}

.match-vs {
    font-size: 0.75rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.15);
    padding: 0 6px;
}

.match-status {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    margin-top: 12px;
    padding-top: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-badge.played {
    color: var(--color-success);
}

.status-badge.unplayed {
    color: var(--text-muted);
}

/* ==========================================================================
   VISUAL KNOCKOUT BRACKET SYSTEM
   ========================================================================== */

.bracket-wrapper {
    overflow-x: auto;
    padding: 20px 0;
    width: 100%;
}

.bracket-container {
    display: flex;
    min-width: 900px;
    justify-content: space-between;
    margin: 0 auto;
    position: relative;
    padding: 10px;
}

.bracket-column {
    display: flex;
    flex-direction: column;
    width: 250px;
}

.column-header {
    text-align: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 24px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--glass-border);
}

.column-matches {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex-grow: 1;
    min-height: 640px; /* Aligns heights correctly */
}

.bracket-match {
    border-radius: var(--radius-md);
    padding: 12px;
    margin: 12px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: var(--transition-smooth);
    position: relative;
}

.bracket-match:hover {
    border-color: rgba(0, 210, 255, 0.3);
}

.bracket-match-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.b-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
}

.b-player:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.b-player .name {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.b-player .score {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    color: var(--text-muted);
}

.b-player.winner .name {
    color: #fff;
    font-weight: 700;
}

.b-player.winner .score {
    color: var(--color-secondary);
}

.final-match-card {
    border: 1px solid rgba(245, 158, 11, 0.25) !important;
}
.final-match-card:hover {
    border-color: var(--color-accent) !important;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.15) !important;
}

.final-match-card .winner .score {
    color: var(--color-accent) !important;
}

/* Visual Connector SVGs */
.connector-column {
    width: 100px;
    position: relative;
}

.bracket-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.connector-line {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 2;
    stroke-linecap: round;
    transition: var(--transition-smooth);
}

/* When a match path is active (e.g. winner determined), highlight the line! */
.connector-line.active {
    stroke: var(--color-secondary);
    filter: drop-shadow(0 0 4px rgba(0, 210, 255, 0.4));
}

/* ==========================================================================
   ADMIN PANEL WORKSPACE
   ========================================================================== */

.admin-header {
    border-radius: var(--radius-lg);
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 992px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

.admin-card {
    border-radius: var(--radius-lg);
    padding: 24px;
}

.admin-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.header-icon {
    font-size: 1.4rem;
}

.admin-card-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
}

.progression-status {
    padding: 16px 0;
}

.status-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.alert {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.alert-info {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* Seeding configs */
.qualifiers-list {
    margin-top: 16px;
}

.qualifiers-list h5 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.clean-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 16px;
}

.clean-list li {
    font-size: 0.9rem;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.best-runner-up-box {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    border-color: rgba(0, 210, 255, 0.2);
    margin-bottom: 20px;
}

.pairing-row {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pairing-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.select-pair {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: #fff;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-smooth);
}

.form-select:focus {
    border-color: var(--color-primary);
}

.vs-text {
    font-size: 0.7rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.2);
}

/* Match scrollables for score inputs */
.max-height-container {
    display: flex;
    flex-direction: column;
}

.matches-list-scrollable {
    max-height: 480px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Custom Scrollbar for modern visual styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
}

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

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

.admin-match-item {
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.group-label {
    font-size: 0.7rem;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.04);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--color-secondary);
}

.code-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 6px;
}

/* ==========================================================================
   BUTTONS & FORMS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.35);
}
.btn-primary:hover:not(:disabled) {
    background: #4338ca;
    box-shadow: 0 4px 20px 0 rgba(79, 70, 229, 0.5);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-glass {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}
.btn-glass:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-danger-glass {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}
.btn-danger-glass:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

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

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

.form-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

.form-input:focus {
    border-color: var(--color-primary);
}

/* ==========================================================================
   MODAL DIALOGS
   ========================================================================== */

.modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background: rgba(2, 3, 6, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.25s ease-out;
}

.modal-wrapper.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius-lg);
    padding: 24px;
    transform: scale(0.92);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-wrapper.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 12px;
}

.modal-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.score-input-grid {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 16px;
    margin: 16px 0;
}

.player-score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.player-label {
    font-size: 0.95rem;
    text-align: center;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-box-input {
    width: 80px;
    height: 80px;
    font-size: 2.2rem !important;
    border-radius: var(--radius-md) !important;
}

.modal-vs-box {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.15);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    border-top: 1px solid var(--glass-border);
    padding-top: 16px;
}

.modal-danger {
    border-color: rgba(239, 68, 68, 0.3) !important;
}

/* ==========================================================================
   LOGIN CARD
   ========================================================================== */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: var(--radius-lg);
    padding: 36px 32px;
}

.password-input-wrapper {
    position: relative;
}

.password-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.password-input-wrapper .form-input {
    width: 100%;
    padding-left: 42px;
}

/* ==========================================================================
   TOAST SYSTEM (Notifications)
   ========================================================================== */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1100;
}

.toast {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    min-width: 300px;
    max-width: 420px;
    gap: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    border-left-width: 4px;
    justify-content: space-between;
}

.toast-success { border-left-color: var(--color-success); color: #e6fcf5; }
.toast-error { border-left-color: var(--color-danger); color: #fff5f5; }
.toast-warning { border-left-color: var(--color-accent); color: #fffbeb; }
.toast-info { border-left-color: var(--color-secondary); color: #f0fdfa; }

.toast-icon {
    font-size: 1.15rem;
}
.toast-success .toast-icon { color: var(--color-success); }
.toast-error .toast-icon { color: var(--color-danger); }
.toast-warning .toast-icon { color: var(--color-accent); }
.toast-info .toast-icon { color: var(--color-secondary); }

.toast-content {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 2px;
}

/* ==========================================================================
   ELEGANT FOOTER STYLE
   ========================================================================== */

.footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 24px 0 8px;
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
}

.pulse {
    color: var(--color-danger);
    animation: heartpulse 1.5s infinite ease-in-out;
}

@keyframes heartpulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   TEXT GLOWS AND SHADOW HELPER CLASSES
   ========================================================================== */

.text-glow {
    text-shadow: var(--text-glow);
}
.text-glow-blue {
    text-shadow: var(--text-glow-blue);
}
.text-glow-gold {
    text-shadow: var(--text-glow-gold);
}
.text-glow-orange {
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}
.text-glow-indigo {
    text-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
}
.text-glow-small {
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.4);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 12px;
}

.badge-glow-primary {
    background: rgba(79, 70, 229, 0.15);
    border: 1px solid var(--color-primary);
    color: #c7d2fe;
    box-shadow: 0 0 8px rgba(79, 70, 229, 0.3);
}

.badge-glow-orange {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--color-accent);
    color: #fde68a;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

/* Layout Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-4 { padding: 24px; }
.w-auto { width: auto; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-mono { font-family: monospace; }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-muted { color: var(--text-muted); }

/* Animation triggers */
.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

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

.animate-bounce {
    animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ==========================================================================
   SYMMETRICAL CHAMPIONSHIP ARENA STYLING
   ========================================================================== */

.arena-scroll-wrapper {
    width: 100%;
    overflow-x: visible;
    display: flex;
    justify-content: center;
    padding: 10px 0;
}

.arena-container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    gap: 0;
}

.arena-column {
    display: flex;
    flex-direction: column;
    width: 110px;
    flex-shrink: 0;
}

.arena-column.groups-column {
    width: 155px;
}

.arena-column.final-column {
    width: 135px;
}

.arena-column .column-content {
    height: 480px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.arena-column.semis-column .column-content,
.arena-column.final-column .column-content {
    justify-content: center;
}

.flex-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.gap-4 {
    gap: 12px;
}

.mini-group {
    width: 100%;
    padding: 6px 8px;
    border-radius: var(--radius-md);
}

.mini-group .group-card-header {
    font-size: 0.75rem;
    margin-bottom: 4px;
    padding-bottom: 4px;
}

.mini-standings th, .mini-standings td {
    padding: 3px 2px;
    font-size: 0.7rem;
}

.mini-standings th {
    font-size: 0.65rem;
}

.bracket-match {
    width: 100%;
    padding: 6px 8px;
    margin: 4px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-md);
}

.b-player {
    font-size: 0.72rem;
    padding: 3px 2px;
}

.b-player .name {
    max-width: 95px;
}

/* Symmetrical SVG connectors */
.arena-connector {
    width: 25px;
    flex-shrink: 0;
    position: relative;
    height: 480px;
}

.arena-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ==========================================================================
   ADMIN WINNER-SELECTION CARD STYLING
   ========================================================================== */

.winner-buttons-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin: 24px 0;
}

.winner-select-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02) !important;
    color: var(--text-muted);
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.winner-select-card:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: rgba(99, 102, 241, 0.4) !important;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12) !important;
}

.winner-select-card.active {
    background: rgba(99, 102, 241, 0.15) !important;
    border-color: var(--color-primary) !important;
    color: #fff;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3) !important;
}

.winner-select-card .trophy-icon {
    font-size: 2.2rem;
    color: rgba(255, 255, 255, 0.15);
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.winner-select-card:hover .trophy-icon {
    color: rgba(99, 102, 241, 0.7);
    transform: scale(1.1);
}

.winner-select-card.active .trophy-icon {
    color: #fbbf24;
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
    transform: scale(1.2) rotate(-5deg);
}

.winner-player-name {
    font-size: 1.05rem;
    font-weight: 700;
}
