/* ============================================================
   League System — Main Stylesheet
   Primary: #1D1E1D  |  Accent: #00C437
   ============================================================ */

/* ── Fonts ────────────────────────────────────────────────────────────────────
   English: Ubuntu (Regular / Light / Bold)
   Arabic:  Loew Next Arabic (Thin / Light / Medium / Bold / ExtraBold / Heavy / Black)
   The browser automatically picks the right font per script via unicode-range.
   ──────────────────────────────────────────────────────────────────────────── */

/* Ubuntu — English / Latin */
@font-face {
    font-family: 'Ubuntu';
    src: url('../fonts/Ubuntu-Light.ttf') format('truetype');
    font-weight: 300;
    font-style:  normal;
    font-display: swap;
}
@font-face {
    font-family: 'Ubuntu';
    src: url('../fonts/Ubuntu-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style:  normal;
    font-display: swap;
}
@font-face {
    font-family: 'Ubuntu';
    src: url('../fonts/Ubuntu-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style:  normal;
    font-display: swap;
}

/* Loew Next Arabic — Arabic script */
@font-face {
    font-family: 'Loew Next Arabic';
    src: url('../fonts/ArbFONTS-Loew-Next-Arabic-Thin.otf') format('opentype');
    font-weight: 100;
    font-style:  normal;
    font-display: swap;
}
@font-face {
    font-family: 'Loew Next Arabic';
    src: url('../fonts/ArbFONTS-Loew-Next-Arabic-Light.otf') format('opentype');
    font-weight: 300;
    font-style:  normal;
    font-display: swap;
}
@font-face {
    font-family: 'Loew Next Arabic';
    src: url('../fonts/ArbFONTS-Loew-Next-Arabic-Medium.otf') format('opentype');
    font-weight: 500;
    font-style:  normal;
    font-display: swap;
}
@font-face {
    font-family: 'Loew Next Arabic';
    src: url('../fonts/ArbFONTS-Loew-Next-Arabic-Bold.otf') format('opentype');
    font-weight: 700;
    font-style:  normal;
    font-display: swap;
}
@font-face {
    font-family: 'Loew Next Arabic';
    src: url('../fonts/ArbFONTS-Loew-Next-Arabic-ExtraBold.otf') format('opentype');
    font-weight: 800;
    font-style:  normal;
    font-display: swap;
}
@font-face {
    font-family: 'Loew Next Arabic';
    src: url('../fonts/ArbFONTS-Loew-Next-Arabic-Heavy.otf') format('opentype');
    font-weight: 900;
    font-style:  normal;
    font-display: swap;
}
@font-face {
    font-family: 'Loew Next Arabic';
    src: url('../fonts/ArbFONTS-Loew-Next-Arabic-Black.otf') format('opentype');
    font-weight: 950;
    font-style:  normal;
    font-display: swap;
}

:root {
    --bg:          #1D1E1D;
    --bg-deeper:   #141514;
    --surface:     #252625;
    --surface-2:   #2d2e2d;
    --surface-3:   #353635;
    --accent:      #00C437;
    --accent-dark: #009e2c;
    --accent-glow: rgba(0, 196, 55, 0.15);
    --text:        #e8e8e8;
    --text-muted:  #888;
    --text-dim:    #555;
    --border:      #333;
    --border-light:#3d3e3d;
    --danger:      #e74c3c;
    --danger-dark: #c0392b;
    --warning:     #f39c12;
    --info:        #3498db;
    --radius:      8px;
    --radius-sm:   4px;
    --radius-lg:   12px;
    --sidebar-w:   240px;
    --shadow:      0 2px 12px rgba(0,0,0,0.4);
    --transition:  0.18s ease;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: 'Ubuntu', 'Loew Next Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
ul { list-style: none; }

/* ── Layout ───────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-deeper);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
}
.brand-icon { font-size: 22px; color: var(--accent); line-height: 1; }
.brand-icon.large { font-size: 48px; display: block; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text); }
.sidebar-logo { max-width: 160px; max-height: 48px; object-fit: contain; }

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}
.nav-item:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }
.nav-item.sub { padding-left: 28px; font-size: 0.85rem; }
.nav-icon { font-size: 0.75rem; opacity: 0.7; }
.nav-group { margin-top: 8px; }
.nav-group-label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); padding: 6px 12px 2px; }

.sidebar-footer { padding: 14px 16px; border-top: 1px solid var(--border); }
.user-info { display: flex; flex-direction: column; margin-bottom: 8px; }
.user-name { font-size: 0.9rem; font-weight: 600; }
.user-role { font-size: 0.75rem; color: var(--text-muted); }
.btn-logout { display: block; padding: 6px 10px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 0.8rem; text-align: center; color: var(--text-muted); transition: background var(--transition); text-decoration: none; }
.btn-logout:hover { background: var(--danger); color: #fff; text-decoration: none; }

/* Main Content */
.main-content { flex: 1; margin-left: var(--sidebar-w); padding: 28px 32px; max-width: 100%; min-height: 100vh; }

/* ── Typography ───────────────────────────────────────────── */
h1 { font-size: 1.7rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; color: var(--text); }
h3 { font-size: 1.05rem; font-weight: 600; }
.text-muted { color: var(--text-muted) !important; }
.text-dim   { color: var(--text-dim); }
.text-sm    { font-size: 0.8rem; }
.mt-1 { margin-top: 12px; }
.mt-2 { margin-top: 24px; }

/* ── Buttons ──────────────────────────────────────────────── */
/* Reset <button> default browser styles */
button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
    vertical-align: middle;
}
.btn:hover { text-decoration: none; }

.btn-primary  { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #000; }

.btn-accent   { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); color: #000; }

.btn-outline  { background: transparent; color: var(--text); border-color: var(--border-light); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-dark); color: #fff; }

.btn-sm  { padding: 5px 12px; font-size: 0.82rem; }
.btn-xs  { padding: 4px 9px;  font-size: 0.78rem; }
.btn-lg  { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ── Bootstrap Modal overrides ────────────────────────────── */
.modal-content   { background: var(--surface); border: 1px solid var(--border-light); color: var(--text); }
.modal-header    { border-bottom-color: var(--border); }
.modal-footer    { border-top-color: var(--border); }
.modal-title     { color: var(--text); font-size: 1rem; font-weight: 600; }
.modal-body      { color: var(--text-muted); font-size: 0.92rem; line-height: 1.6; }
.btn-close       { filter: invert(1) grayscale(1); opacity: 0.6; }
.btn-close:hover { opacity: 1; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; border-left: 4px solid; font-size: 0.9rem; }
.alert-success { background: rgba(0,196,55,0.1); border-color: var(--accent); color: #a8f0be; }
.alert-error   { background: rgba(231,76,60,0.1); border-color: var(--danger); color: #f0a8a8; }
.error-list    { padding-left: 16px; list-style: disc; }

/* ── Page Header ──────────────────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-header h1 { margin-bottom: 2px; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ── Stats Grid ───────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; }
.stat-card.accent { border-color: var(--accent); background: var(--accent-glow); }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Section Header ───────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.link-muted { color: var(--text-muted); font-size: 0.85rem; }

/* ── League Cards ─────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.league-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; transition: border-color var(--transition), box-shadow var(--transition); }
.league-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.league-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.league-card-header h3 { font-size: 1rem; margin-bottom: 4px; }
.league-logo { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; }
.league-logo-placeholder { width: 44px; height: 44px; border-radius: 6px; background: var(--surface-3); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.league-card-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 14px; }
.league-card-actions { display: flex; gap: 8px; }

/* ── Status Badges ────────────────────────────────────────── */
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.status-setup      { background: rgba(243,156,18,0.15); color: var(--warning); }
.status-active     { background: rgba(0,196,55,0.15);   color: var(--accent); }
.status-completed  { background: rgba(52,152,219,0.15); color: var(--info); }
.status-eliminated { background: rgba(231,76,60,0.12);  color: var(--danger); }
.status-badge.large { padding: 4px 14px; font-size: 0.88rem; }

.badge       { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; background: var(--surface-3); color: var(--text-muted); }
.badge-count { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.85rem; background: var(--accent-glow); color: var(--accent); font-weight: 600; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table thead tr { background: var(--surface-2); }
.data-table th { padding: 12px 14px; text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); white-space: nowrap; }
.data-table td { padding: 12px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--surface); }
.cell-with-logo { display: flex; align-items: center; gap: 10px; }
.table-logo { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.table-logo-placeholder { width: 32px; height: 32px; border-radius: 4px; background: var(--surface-3); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.actions-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── Forms ────────────────────────────────────────────────── */
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; max-width: 860px; }
.form-card.narrow { max-width: 480px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 24px; }
.col-span-2 { grid-column: span 2; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }

/* Remove spin buttons from all number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], select, textarea {
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 9px 12px;
    font-size: 0.9rem;
    width: 100%;
    transition: border-color var(--transition);
    -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
input::placeholder { color: var(--text-dim); }
select option { background: var(--surface-2); }

.form-hint    { font-size: 0.78rem; color: var(--text-muted); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* Radio cards */
.radio-group { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-card { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; border: 1px solid var(--border-light); border-radius: var(--radius); cursor: pointer; transition: border-color var(--transition), background var(--transition); flex: 1; min-width: 180px; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-glow); }
.radio-card input[type="radio"] { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
.radio-label { display: flex; flex-direction: column; gap: 2px; }
.radio-label strong { font-size: 0.9rem; }
.radio-label small { font-size: 0.78rem; color: var(--text-muted); }

input[type="file"] { padding: 6px; cursor: pointer; }
.current-logo { margin-bottom: 10px; display: flex; align-items: center; gap: 12px; }
.preview-logo { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); }

/* ── Teams Page ───────────────────────────────────────────── */
.team-progress-bar { height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; margin-bottom: 6px; }
.team-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s ease; }
.team-progress-label { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 20px; }

/* ── Match Setup ──────────────────────────────────────────── */
.action-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 28px; flex-wrap: wrap; }
.action-card-body h3 { margin-bottom: 6px; }
.action-card-body p  { margin-bottom: 0; }
.action-card-actions { display: flex; gap: 10px; flex-shrink: 0; }

.matches-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 24px; }
.match-setup-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.match-number { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 10px; }
.match-teams-display { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.team-pill { flex: 1; padding: 8px 12px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: 600; text-align: center; border: 1px solid var(--border); color: var(--accent); }
.team-pill.empty { color: var(--text-dim); font-weight: 400; }
.vs-label { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }
.match-manual-inputs { display: flex; align-items: center; gap: 8px; }
.team-select { flex: 1; }

/* ── Bracket ──────────────────────────────────────────────── */
.bracket-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.highlight-control { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; }
.team-highlight-select { width: 220px; }
.bracket-legend { display: flex; gap: 16px; font-size: 0.8rem; color: var(--text-muted); align-items: center; }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend-dot.winner  { background: var(--accent); }
.legend-dot.loser   { background: var(--danger); }
.legend-dot.pending { background: var(--surface-3); border: 1px solid var(--border-light); }

.bracket-scroll-wrap {
    overflow-x: auto;
    overflow-y: visible;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 32px 36px;
    margin-bottom: 28px;
    min-height: 520px;
}

/* Bracket rendered by JS */
.bracket-container { position: relative; min-height: 460px; }
.bracket-wrapper   { position: relative; display: inline-block; min-width: 100%; }
.bracket-rounds    { display: flex; gap: 0; align-items: stretch; }
.bracket-round     { display: flex; flex-direction: column; min-width: 220px; }
.round-header      { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 700; padding: 0 18px 16px; text-align: center; }
.round-matches-wrap { flex: 1; position: relative; }

.match-spacer { display: flex; align-items: center; justify-content: center; padding: 0 18px; }
.match-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    width: 184px;
    transition: border-color var(--transition);
    cursor: default;
    position: relative;
}
.match-card:hover { border-color: var(--border-light); }
.match-card.completed { border-color: var(--border-light); }
.match-card.highlighted-match { border-color: var(--accent) !important; box-shadow: 0 0 0 2px var(--accent-glow); }

.team-slot {
    padding: 9px 12px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}
.team-slot:hover { background: var(--surface-3); }
.team-slot.empty   { color: var(--text-dim); font-weight: 400; cursor: default; }
.team-slot.winner  { color: var(--accent); }
.team-slot.loser   { color: var(--text-dim); text-decoration: line-through; opacity: 0.6; }
.team-slot.highlighted { background: var(--accent-glow) !important; color: var(--accent) !important; }
.team-slot::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--surface-3); flex-shrink: 0; }
.team-slot.winner::before     { background: var(--accent); }
.team-slot.loser::before      { background: var(--danger); }
.team-slot.highlighted::before { background: var(--accent); }
.slot-logo { width: 18px; height: 18px; border-radius: 3px; object-fit: cover; flex-shrink: 0; }

/* ── Bracket Winner Card ──────────────────────────────────── */
.bracket-winner-col { min-width: 160px; }
.winner-card {
    background: linear-gradient(135deg, rgba(0,196,55,0.12), rgba(0,196,55,0.04));
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    box-shadow: 0 0 24px rgba(0,196,55,0.15);
}
.winner-trophy { line-height: 1; color: var(--accent); }
.winner-logo { width: 64px; height: 64px; border-radius: var(--radius); object-fit: cover; border: 2px solid var(--accent); padding: 10px; }
.winner-name { font-size: 1rem; font-weight: 700; color: var(--accent); }

/* ── Match result — team logo ─────────────────────────────── */
.match-team-logo { width: 52px; height: 52px; border-radius: var(--radius); object-fit: cover; margin-bottom: 8px; }

.match-divider { height: 1px; background: var(--border); }
.match-score-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    padding: 4px 0 5px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* Connector SVG lines */
.bracket-svg path { transition: stroke 0.2s, stroke-width 0.2s; }

/* ── Empty State ──────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state.large { padding: 80px 20px; }
.empty-icon { font-size: 3rem; color: var(--text-dim); margin-bottom: 12px; }
.empty-state h3 { margin-bottom: 8px; color: var(--text); }
.back-link { margin-top: 24px; font-size: 0.88rem; }

/* ── Referee Matches ──────────────────────────────────────── */
.match-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 28px; }
.referee-match-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; position: relative; transition: border-color var(--transition); }
.referee-match-card:hover { border-color: var(--border-light); }
.referee-match-card.live { border-color: var(--accent); }
.live-indicator { position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 5px; font-size: 0.7rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease infinite; }
@keyframes pulse { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:0.4; transform:scale(1.4); } }
.ref-match-round { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 12px; }
.ref-matchup { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.ref-team { font-weight: 700; font-size: 0.95rem; flex: 1; display: flex; align-items: center; gap: 6px; }
.ref-team.away { flex-direction: row-reverse; }
.ref-vs   { color: var(--text-dim); font-size: 0.78rem; flex-shrink: 0; }

/* ── Match Result Form ────────────────────────────────────── */
.match-result-card { max-width: 640px; }
.match-display { display: flex; align-items: center; gap: 24px; margin-bottom: 28px; padding: 24px; background: var(--surface-2); border-radius: var(--radius-lg); border: 1px solid var(--border); }
.match-team-block { flex: 1; text-align: center; padding: 16px; border-radius: var(--radius); border: 2px solid transparent; transition: border-color var(--transition), background var(--transition); }
.match-team-block.selected-winner { border-color: var(--accent); background: var(--accent-glow); }
.team-name-large { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.score-input-wrap { display: flex; justify-content: center; }
.score-input { width: 70px; text-align: center; font-size: 2rem; font-weight: 700; padding: 8px; border-radius: var(--radius); background: var(--surface-3); }
.match-center { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }
.vs-large { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; }
.score-divider-lg { font-size: 2rem; color: var(--text-dim); }

.winner-selection { margin-bottom: 24px; }
.winner-selection h3 { margin-bottom: 12px; }
.winner-options { display: flex; gap: 12px; }
.winner-option { flex: 1; display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1px solid var(--border-light); border-radius: var(--radius); cursor: pointer; transition: border-color var(--transition), background var(--transition); }
.winner-option:has(input:checked),
.winner-option.selected { border-color: var(--accent); background: var(--accent-glow); }
.winner-option input[type="radio"] { accent-color: var(--accent); flex-shrink: 0; }
.winner-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.92rem; }
.winner-crown { color: var(--accent); font-size: 1rem; }

/* ── Timeline ─────────────────────────────────────────────── */
.timeline-header-strip { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.team-badge-large { display: flex; align-items: center; gap: 14px; font-size: 1.2rem; font-weight: 700; }
.team-initial { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: #000; font-weight: 900; font-size: 1.3rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.team-status-info { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }

.timeline { position: relative; padding-left: 32px; }
.timeline-item { position: relative; padding-bottom: 28px; display: flex; gap: 16px; }
.timeline-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; flex-shrink: 0; position: relative; z-index: 1; }
.timeline-dot.win  { background: rgba(0,196,55,0.2); border-color: var(--accent); color: var(--accent); }
.timeline-dot.loss { background: rgba(231,76,60,0.2); border-color: var(--danger);  color: var(--danger); }
.timeline-connector { position: absolute; left: 14px; top: 28px; bottom: 0; width: 2px; background: var(--border); }
.timeline-item.win  .timeline-connector { background: var(--accent); opacity: 0.3; }
.timeline-item.loss .timeline-connector { background: var(--danger); opacity: 0.3; }

.timeline-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 20px; flex: 1; transition: border-color var(--transition); }
.timeline-item.win  .timeline-card { border-left: 3px solid var(--accent); }
.timeline-item.loss .timeline-card { border-left: 3px solid var(--danger); }

.timeline-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.round-badge { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); background: var(--accent-glow); padding: 2px 8px; border-radius: 4px; }
.round-badge-final   { color: #e74c3c !important; background: rgba(231,76,60,0.15) !important; }
.round-badge-semi    { color: #9b59b6 !important; background: rgba(155,89,182,0.15) !important; }
.round-badge-quarter { color: #3498db !important; background: rgba(52,152,219,0.15) !important; }
.team-badge-home { display: inline-flex; align-items: center; gap: 6px; background: rgba(52,152,219,0.12); color: #3498db; padding: 2px 8px; border-radius: 4px; font-weight: 600; font-size: 0.88rem; }
.team-badge-away { display: inline-flex; align-items: center; gap: 6px; background: rgba(243,156,18,0.12); color: #f39c12; padding: 2px 8px; border-radius: 4px; font-weight: 600; font-size: 0.88rem; }
.team-badge-home.winner, .team-badge-away.winner { outline: 1px solid currentColor; }
.result-badge { font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; }
.result-win     { background: rgba(0,196,55,0.15); color: var(--accent); }
.result-loss    { background: rgba(231,76,60,0.12); color: var(--danger); }
.result-pending { background: var(--surface-3); color: var(--text-muted); }

.timeline-matchup { display: flex; align-items: center; gap: 14px; justify-self: center; }
.timeline-team { flex: 1; font-weight: 600; font-size: 0.92rem; display: flex; align-items: center; gap: 8px; }
.timeline-team.away { flex-direction: row-reverse; }
.timeline-team.team-winner { color: var(--accent); }
.team-initial-sm { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); color: var(--text-muted); font-size: 0.7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.team-winner .team-initial-sm { background: var(--accent-glow); color: var(--accent); }
.team-logo-sm { width: 24px; height: 24px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }

.timeline-score { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.score { font-size: 1.4rem; font-weight: 700; min-width: 28px; text-align: center; line-height: 1; }
.score-win   { color: var(--accent); }
.score-loss  { color: var(--text-muted); }
.score-divider { color: var(--text-dim); font-size: 1.1rem; }
.score-vs { color: var(--text-muted); font-size: 0.85rem; }

.timeline-end { display: flex; align-items: center; gap: 12px; padding-top: 4px; }
.timeline-end-label { font-weight: 700; font-size: 1rem; }
.timeline-end.winner { background: var(--accent-glow); border: 2px solid var(--accent); border-radius: var(--radius-lg); padding: 20px 28px; gap: 16px; margin-top: 12px; box-shadow: 0 0 32px rgba(0,196,55,0.2); justify-content: center; flex-direction: column; align-items: center; }
.timeline-end.winner .timeline-end-label { color: var(--accent); font-size: 1.6rem; }
.timeline-champion-trophy { line-height: 1; color: var(--accent); }
.timeline-end.eliminated .timeline-end-label { color: var(--danger); }

/* ── Team Leader — Leader Card ────────────────────────────── */
.leader-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.leader-card-info { display: flex; align-items: center; gap: 14px; flex: 1; }
.leader-avatar {
    width: 46px; height: 46px;
    border-radius: 50%;
    background: var(--accent-glow);
    color: var(--accent);
    font-size: 1.2rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.leader-username { font-size: 1rem; font-weight: 700; }
.leader-card-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.leader-pw-form { display: flex; align-items: center; gap: 8px; }
.leader-pw-form input[type="password"] {
    padding: 6px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
    width: 160px;
}
.leader-pw-form input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Team Leader — Info / Dashboard Cards ──────────────────── */
.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
}
.info-card-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.upcoming-matchup {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-self: center;
}
.upcoming-team {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.upcoming-team.away { flex-direction: row-reverse; }
.upcoming-team.highlight { color: var(--accent); }
.upcoming-team.highlight .team-initial-sm { background: var(--accent-glow); color: var(--accent); }
.last-score { display: flex; align-items: center; gap: 6px; flex-shrink: 0; justify-self: center; }

/* ── Login Page ───────────────────────────────────────────── */
body.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-deeper); }
.login-container { width: 100%; max-width: 400px; padding: 0 16px; }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand h1 { font-size: 1.6rem; margin-top: 10px; }
.login-logo { max-width: 200px; max-height: 80px; object-fit: contain; margin-bottom: 8px; }
.login-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.login-portal-label { text-align: center; font-size: 0.8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.login-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; }
.login-form .form-group { margin-bottom: 18px; }
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { flex: 1; padding-right: 44px; }
.pw-toggle { position: absolute; right: 10px; background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; opacity: 0.7; }
.pw-toggle:hover { opacity: 1; }
.portal-switcher { display: flex; justify-content: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.portal-link { font-size: 0.78rem; padding: 4px 12px; border-radius: 20px; background: var(--surface); color: var(--text-muted); text-decoration: none; border: 1px solid var(--border); transition: background var(--transition), color var(--transition); }
.portal-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.portal-link-active { background: var(--accent-glow); color: var(--accent); border-color: transparent; cursor: default; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar { position: static; width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
    .main-content { margin-left: 0; padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .col-span-2 { grid-column: span 1; }
    .match-display { flex-direction: column; }
    .winner-options { flex-direction: column; }
    .bracket-scroll-wrap { padding: 12px; }
}

/* ── Phase 2 Components ───────────────────────────────────────────────────── */

/* ── Login: active sessions banner ────────────────────────── */
.active-sessions-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 18px;
}
.active-sessions-label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.active-session-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    margin-bottom: 6px;
    text-decoration: none;
    transition: border-color var(--transition);
}
.active-session-link:hover { border-color: var(--accent); text-decoration: none; }
.active-session-role { font-size: .8rem; font-weight: 700; color: var(--accent); min-width: 90px; }
.active-session-user { font-size: .88rem; color: var(--text); flex: 1; }
.active-session-arrow { color: var(--text-muted); font-size: .9rem; }
.active-sessions-hint { font-size: .78rem; color: var(--text-dim); margin-top: 8px; margin-bottom: 0; }

/* ── Team logo in page header ──────────────────────────────── */
.team-logo-header {
    width: 52px; height: 52px;
    border-radius: var(--radius);
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
    padding: 3px;
}
.team-logo-header-placeholder {
    width: 52px; height: 52px;
    border-radius: var(--radius);
    background: var(--surface-3);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    padding: 3px;
}

/* ── Captain badge ─────────────────────────────────────────── */
.badge-no-captain {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 20px;
    background: rgba(231,76,60,0.12);
    color: var(--danger);
    font-size: .78rem;
    font-weight: 700;
}
.captain-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 20px;
    background: rgba(0,196,55,0.12);
    color: var(--accent);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
}
.captain-badge-sm {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    background: rgba(0,196,55,0.12);
    color: var(--accent);
    font-size: .72rem;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
}

/* ── Player photos ─────────────────────────────────────────── */
.player-photo-sm {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}
.player-photo-placeholder-sm {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text-dim);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}
.player-photo-preview {
    width: 64px; height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

/* ── Player profile page ───────────────────────────────────── */
.player-profile-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
}
.player-profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-align: center;
}
.player-photo-wrap { margin-bottom: 18px; display: flex; justify-content: center; }
.player-photo-lg {
    width: 110px; height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
}
.player-photo-placeholder-lg {
    width: 110px; height: 110px;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text-dim);
    display: flex; align-items: center; justify-content: center;
    font-size: 40px;
}
.player-identity h2 { font-size: 1.2rem; }
.player-team-info { margin-top: 14px; text-align: left; }
.team-link { font-weight: 600; color: var(--text); font-size: .92rem; }
.team-link:hover { color: var(--accent); }

.player-stats-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
}
.player-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.detail-value { font-size: .95rem; font-weight: 600; color: var(--text); }

/* ── Players list: filter bar ──────────────────────────────── */
.filters-bar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 24px;
}
.filter-group { display: flex; flex-direction: column; gap: 5px; min-width: 160px; }
.filter-group label { font-size: .78rem; font-weight: 600; color: var(--text-muted); }
.filter-search { flex: 1; min-width: 200px; }
.filter-actions { display: flex; gap: 8px; align-items: flex-end; padding-bottom: 0; }
.player-name-link { font-weight: 700; color: var(--text); }
.player-name-link:hover { color: var(--accent); }

/* ── Match result: referee notes textarea ──────────────────── */
.referee-notes-group {
    margin-bottom: 24px;
}
.referee-notes-group label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
}
.referee-notes-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* ── Bracket: notes button ─────────────────────────────────── */
.match-notes-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    font-size: .7rem;
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
    transition: background var(--transition);
    line-height: 1;
}
.match-notes-btn:hover { background: var(--accent); }
.match-notes-score {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    color: var(--accent);
    margin-bottom: 12px;
    letter-spacing: .05em;
}
.match-notes-body {
    white-space: pre-wrap;
    color: var(--text);
    line-height: 1.7;
    font-size: .92rem;
    text-align: center;
}

/* ── Match history: winner cell ────────────────────────────── */
.match-winner-cell { font-weight: 700; color: var(--accent); }

@media (max-width: 768px) {
    .player-profile-layout { grid-template-columns: 1fr; }
    .player-details-grid   { grid-template-columns: 1fr; }
    .filters-bar { flex-direction: column; align-items: stretch; }
}
