/* Tournament Bracket Pro — Frontend v3 by SOLOUCE */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;800&family=DM+Sans:wght@400;500;600;700&display=swap');

/* ── BASE ─────────────────────────────────────────────────────────────────── */
.tbp-frontend {
    --accent:     #e63946; --accent-rgb: 230,57,70;
    --bg:         #0b0d12; --surf:       #12151e; --surf2: #191d28; --surf3: #1f2535;
    --border:     #242840; --text:       #e8eaf5; --muted: #525878; --radius: 14px;
    font-family: 'DM Sans',sans-serif; color:var(--text); background:var(--bg);
    border-radius:20px; overflow:hidden; position:relative;
}

/* ── FULLSCREEN ───────────────────────────────────────────────────────────── */
.tbp-fs-btn {
    position:absolute; top:16px; right:16px; z-index:10;
    background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.12);
    color:rgba(255,255,255,.6); border-radius:8px; padding:6px 10px;
    font-size:1.1rem; cursor:pointer; transition:all .2s; line-height:1;
}
.tbp-fs-btn:hover { background:rgba(255,255,255,.14); color:#fff; }

/* Fullscreen state */
.tbp-frontend.tbp-fullscreen {
    position:fixed !important; inset:0 !important;
    width:100vw !important; height:100vh !important;
    border-radius:0 !important; z-index:99998 !important;
    overflow-y:auto !important;
}
.tbp-frontend.tbp-fullscreen .tbp-fs-btn { position:fixed; }

/* ── HEADER ───────────────────────────────────────────────────────────────── */
.tbp-header { position:relative; padding:3.5rem 2rem 2.5rem; text-align:center; overflow:hidden; }
.tbp-header-glow { position:absolute; top:-80px; left:50%; transform:translateX(-50%); width:600px; height:250px; background:radial-gradient(ellipse at center,rgba(var(--accent-rgb),.28) 0%,transparent 65%); pointer-events:none; }
.tbp-tournament-title { font-family:'Syne',sans-serif; font-size:clamp(2rem,5vw,3.2rem); font-weight:800; color:#fff; margin:0 0 1.5rem; letter-spacing:-1px; position:relative; text-shadow:0 0 50px rgba(var(--accent-rgb),.35); }
.tbp-header-line { width:64px; height:3px; background:var(--accent); border-radius:99px; margin:0 auto; box-shadow:0 0 20px rgba(var(--accent-rgb),.7); }

/* ── TABS ─────────────────────────────────────────────────────────────────── */
.tbp-tabs { display:flex; gap:4px; padding:0 2rem; border-bottom:1px solid var(--border); }
.tbp-tab { padding:12px 24px; background:none; border:none; border-bottom:3px solid transparent; margin-bottom:-1px; color:var(--muted); font-family:'DM Sans',sans-serif; font-size:.95rem; font-weight:600; cursor:pointer; transition:all .2s; }
.tbp-tab:hover { color:var(--text); }
.tbp-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.tbp-panel { display:none; } .tbp-panel.active { display:block; }
.tbp-section { padding:2rem; }
.tbp-pending { text-align:center; padding:4rem 2rem; color:var(--muted); }
.tbp-pending-icon { font-size:2.5rem; margin-bottom:1rem; }

/* ── STANDINGS TABLE (shared) ─────────────────────────────────────────────── */
.tbp-standings-table { width:100%; border-collapse:collapse; }
.tbp-standings-table thead tr { background:var(--surf2); }
.tbp-standings-table th { padding:7px 10px; font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:.7px; color:var(--muted); text-align:center; }
.tbp-standings-table th:nth-child(2) { text-align:left; }
.tbp-standings-table tbody tr { border-top:1px solid var(--border); transition:background .15s; }
.tbp-standings-table tbody tr:hover { background:rgba(255,255,255,.025); }
.tbp-standings-table td { padding:9px 10px; font-size:.88rem; text-align:center; }
.tbp-row-adv { position:relative; background:linear-gradient(90deg,rgba(var(--tc-rgb),.08) 0%,transparent 100%); }
.tbp-row-adv > td:first-child { box-shadow: inset 3px 0 0 var(--tc); }
.tbp-row-out { opacity:.5; }
.tbp-rank-cell { width:36px; }
.tbp-place-badge { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:50%; font-size:.78rem; font-weight:800; }
.tbp-place-1 { background:linear-gradient(135deg,#ffd700,#ffaa00); color:#000; box-shadow:0 0 12px rgba(255,200,0,.5); }
.tbp-place-2 { background:linear-gradient(135deg,#c0c0c0,#909090); color:#000; }
.tbp-place-3 { background:linear-gradient(135deg,#cd7f32,#9b5e1e); color:#fff; }
.tbp-rank-n { color:var(--muted); font-size:.82rem; }
.tbp-st-team { text-align:left !important; }
.tbp-team-chip { display:flex; align-items:center; gap:9px; }
.tbp-chip-logo { width:32px; height:32px; border-radius:8px; border:1px solid; display:flex; align-items:center; justify-content:center; flex-shrink:0; overflow:hidden; }
.tbp-chip-logo img { max-width:28px; max-height:28px; object-fit:contain; }
.tbp-chip-init { font-size:.75rem; font-weight:800; }
.tbp-chip-name { font-weight:700; font-size:.9rem; }
.tbp-pts { font-weight:800; color:var(--accent); }

/* ── LEAGUE VIEW ──────────────────────────────────────────────────────────── */
.tbp-league-wrap { display:grid; grid-template-columns:1fr 1fr; gap:1.5rem; }
@media(max-width:768px){.tbp-league-wrap{grid-template-columns:1fr;}}
.tbp-league-table-wrap,.tbp-league-matches { background:var(--surf); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.tbp-group-title { font-family:'Syne',sans-serif; font-size:.8rem; font-weight:700; text-transform:uppercase; letter-spacing:2px; color:var(--accent); padding:10px 16px; background:rgba(var(--accent-rgb),.07); border-bottom:1px solid rgba(var(--accent-rgb),.15); display:flex; align-items:center; gap:8px; }
.tbp-bo-front-badge { font-size:.7rem; background:rgba(var(--accent-rgb),.15); border:1px solid rgba(var(--accent-rgb),.3); padding:1px 7px; border-radius:99px; }

.tbp-league-match { display:grid; grid-template-columns:1fr auto 1fr; gap:8px; align-items:center; padding:10px 14px; border-top:1px solid var(--border); transition:background .15s; }
.tbp-league-match:first-child { border-top:none; }
.tbp-league-match:hover { background:rgba(255,255,255,.02); }
.tbp-lm-team { display:flex; align-items:center; gap:7px; font-size:.88rem; font-weight:600; }
.tbp-lm-team img { width:22px; height:22px; object-fit:contain; border-radius:4px; max-width:150px; max-height:150px; }
.tbp-lm-right { flex-direction:row-reverse; text-align:right; }
.tbp-lm-winner span { font-weight:800; }
.tbp-lm-loser { opacity:.4; }
.tbp-lm-score { display:flex; align-items:center; gap:5px; font-weight:800; font-size:1rem; justify-content:center; min-width:60px; }
.tbp-lm-sc-w { color:var(--accent); font-size:1.1rem; }
.tbp-lm-games { grid-column:1/-1; display:flex; gap:6px; flex-wrap:wrap; font-size:.72rem; color:var(--muted); padding:2px 0; }
.tbp-lm-game { background:var(--surf2); border-radius:4px; padding:1px 6px; }
.tbp-gc-w { color:var(--accent); }

/* ── GROUPS ───────────────────────────────────────────────────────────────── */
.tbp-groups-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(320px,1fr)); gap:1.25rem; }
.tbp-group-card { background:var(--surf); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.tbp-gm-block { border-top:1px solid var(--border); }
.tbp-gm-label { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:var(--muted); padding:8px 14px; background:var(--surf2); }
.tbp-gm { display:flex; align-items:center; padding:9px 14px; gap:8px; border-top:1px solid var(--border); flex-wrap:wrap; }
.tbp-gm-team { flex:1; display:flex; align-items:center; gap:7px; font-size:.88rem; font-weight:600; }
.tbp-gm-team img { width:22px; height:22px; object-fit:contain; border-radius:4px; }
.tbp-gm-right { flex-direction:row-reverse; text-align:right; }
.tbp-gm-winner span { font-weight:800; }
.tbp-gm-loser { opacity:.4; }
.tbp-gm-score { display:flex; align-items:center; gap:5px; font-weight:700; font-size:.95rem; min-width:60px; justify-content:center; }
.tbp-sc-w { color:var(--accent); }
.tbp-vs { color:var(--muted); font-size:.8rem; font-weight:400; }
.tbp-gm-games { width:100%; display:flex; gap:6px; flex-wrap:wrap; font-size:.72rem; color:var(--muted); padding:2px 0; }

/* ── BRACKET ──────────────────────────────────────────────────────────────── */
.tbp-bracket-scroll { overflow-x:auto; padding:2rem; }
.tbp-bracket-scroll::-webkit-scrollbar{height:4px;} .tbp-bracket-scroll::-webkit-scrollbar-track{background:var(--surf);} .tbp-bracket-scroll::-webkit-scrollbar-thumb{background:var(--border);border-radius:99px;}
.tbp-bracket { position:relative; display:flex; gap:0; align-items:stretch; min-width:max-content; }
.tbp-canvas { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:0; }
.tbp-round { display:flex; flex-direction:column; width:220px; flex-shrink:0; position:relative; z-index:1; }
.tbp-round-final { width:240px; }
.tbp-round-header { display:flex; align-items:center; justify-content:space-between; padding:0 12px 12px; border-bottom:1px solid var(--border); margin-bottom:12px; }
.tbp-round-label { font-family:'Syne',sans-serif; font-size:.75rem; font-weight:700; text-transform:uppercase; letter-spacing:1.5px; color:var(--muted); }
.tbp-bo-badge { font-size:.7rem; font-weight:700; padding:2px 8px; border-radius:99px; background:var(--surf2); border:1px solid var(--border); color:var(--muted); }
.tbp-bo-highlight { background:rgba(var(--accent-rgb),.12); border-color:rgba(var(--accent-rgb),.3); color:var(--accent); }
.tbp-matches-col { flex:1; display:flex; flex-direction:column; justify-content:space-around; padding:0 10px; gap:12px; }
.tbp-match { background:var(--surf); border:1px solid var(--border); border-radius:11px; overflow:hidden; position:relative; transition:box-shadow .2s,border-color .2s; animation:tbp-appear .4s ease both; }
.tbp-match:hover { box-shadow:0 8px 30px rgba(0,0,0,.4); border-color:rgba(var(--accent-rgb),.25); }
.tbp-match-done { border-color:rgba(var(--accent-rgb),.18); }
.tbp-match-final { border-color:rgba(var(--accent-rgb),.45) !important; box-shadow:0 0 30px rgba(var(--accent-rgb),.15); }
.tbp-final-shine { position:absolute; inset:0; background:linear-gradient(135deg,rgba(var(--accent-rgb),.06) 0%,transparent 60%); pointer-events:none; }
.tbp-mrow { display:flex; align-items:center; gap:8px; padding:9px 10px; transition:background .15s; position:relative; }
.tbp-mrow-win { background:linear-gradient(90deg,rgba(var(--tc-rgb),.14) 0%,rgba(var(--tc-rgb),.04) 100%); }
.tbp-mrow-win::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--tc); border-radius:0 2px 2px 0; }
.tbp-mrow-loss { opacity:.38; }
.tbp-mlogo { width:32px; height:32px; flex-shrink:0; display:flex; align-items:center; justify-content:center; }
.tbp-mlogo img { width:32px; height:32px; object-fit:contain; border-radius:6px; max-width:150px; max-height:150px; }
.tbp-minit { width:30px; height:30px; border-radius:7px; display:flex; align-items:center; justify-content:center; font-size:.75rem; font-weight:800; color:#fff; }
.tbp-mtbd { width:30px; height:30px; border-radius:7px; background:var(--border); display:flex; align-items:center; justify-content:center; color:var(--muted); }
.tbp-mname { flex:1; font-size:.88rem; font-weight:700; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; color:var(--tc,var(--text)); }
.tbp-mname em { font-style:italic; color:var(--muted); font-weight:400; }
.tbp-crown { font-size:.9rem; margin-right:2px; flex-shrink:0; }
.tbp-mscore { font-size:1.05rem; font-weight:800; min-width:22px; text-align:center; color:var(--muted); }
.tbp-mrow-win .tbp-mscore { color:var(--tc,var(--accent)); }
.tbp-msep { height:1px; background:var(--border); margin:0 10px; }

/* Individual game pills in bracket */
.tbp-match-games { display:flex; flex-wrap:wrap; gap:4px; padding:6px 10px; border-top:1px solid var(--border); background:var(--surf2); }
.tbp-mg-pill { font-size:.7rem; color:var(--muted); background:var(--surf3); border-radius:4px; padding:2px 6px; }
.tbp-mgw { color:var(--accent); }

/* Animations */
@keyframes tbp-appear{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
.tbp-round:nth-child(1) .tbp-match{animation-delay:.05s}
.tbp-round:nth-child(2) .tbp-match{animation-delay:.15s}
.tbp-round:nth-child(3) .tbp-match{animation-delay:.25s}
.tbp-round:nth-child(4) .tbp-match{animation-delay:.35s}
.tbp-round:nth-child(5) .tbp-match{animation-delay:.45s}

@media(max-width:768px){
    .tbp-header{padding:2.5rem 1.25rem 2rem;}
    .tbp-section{padding:1.5rem 1rem;}
    .tbp-bracket-scroll{padding:1.25rem 1rem;}
    .tbp-round{width:190px;}
    .tbp-tabs{padding:0 1rem;}
    .tbp-fs-btn{top:10px;right:10px;}
}

/* ── LIGA LAYOUT ──────────────────────────────────────────────────────────── */
.tbp-league-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 900px) { .tbp-league-layout { grid-template-columns: 1fr; } }

/* Tore-Spalte */
.tbp-goals-cell { font-size: .88rem; font-weight: 700; white-space: nowrap; }
.tbp-ga { color: var(--muted); }

/* Tordifferenz */
.tbp-td-cell { font-weight: 800; font-size: .88rem; }
.tbp-td-pos  { color: #2cb67d; }
.tbp-td-neg  { color: #e63946; }
.tbp-td-zero { color: var(--muted); }

/* Spieltage */
.tbp-matchdays-wrap {
    background: var(--surf);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    position: sticky;
    top: 20px;
}
.tbp-days-count {
    font-size: .7rem; font-weight: 600; color: var(--muted);
    background: rgba(255,255,255,.06); border-radius: 99px;
    padding: 2px 8px; margin-left: auto;
}
.tbp-matchdays-scroll {
    max-height: 75vh;
    overflow-y: auto;
}
.tbp-matchdays-scroll::-webkit-scrollbar { width: 4px; }
.tbp-matchdays-scroll::-webkit-scrollbar-track { background: var(--surf); }
.tbp-matchdays-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.tbp-matchday { border-top: 1px solid var(--border); }
.tbp-matchday:first-child { border-top: none; }

.tbp-md-header {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 14px;
    background: var(--surf2);
    border-bottom: 1px solid var(--border);
}
.tbp-md-label {
    font-family: 'Syne', sans-serif;
    font-size: .78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--text);
}
.tbp-md-status { font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; margin-left: auto; }
.tbp-md-done-badge   { background: rgba(44,182,125,.15);  color: #2cb67d; }
.tbp-md-live-badge   { background: rgba(230,57,70,.15);   color: var(--accent); }
.tbp-md-open-badge   { background: rgba(255,255,255,.06); color: var(--muted); }

.tbp-matchday.tbp-md-done .tbp-md-header { background: rgba(44,182,125,.04); }

/* Individual match row inside matchday */
.tbp-md-match {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border-top: 1px solid rgba(255,255,255,.04);
    transition: background .15s;
}
.tbp-md-match:hover { background: rgba(255,255,255,.02); }
.tbp-md-games {
    grid-column: 1 / -1;
    display: flex; flex-wrap: wrap; gap: 4px;
    padding: 2px 0 4px;
    font-size: .7rem;
}
.tbp-md-gpill {
    background: var(--surf3); border-radius: 4px; padding: 1px 6px;
    color: var(--muted);
}

.tbp-md-team {
    display: flex; align-items: center; gap: 6px;
    font-size: .85rem; font-weight: 600;
    min-width: 0;
}
.tbp-md-team img { width: 20px; height: 20px; object-fit: contain; border-radius: 3px; flex-shrink: 0; }
.tbp-md-team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbp-md-right { flex-direction: row-reverse; text-align: right; }
.tbp-md-winner span { font-weight: 800; }
.tbp-md-loser  { opacity: .42; }

.tbp-md-score {
    display: flex; align-items: center; gap: 4px;
    font-weight: 800; font-size: .95rem;
    justify-content: center; min-width: 52px; flex-shrink: 0;
}
.tbp-md-sc-w  { color: var(--accent); font-size: 1.05rem; }
.tbp-md-sep   { color: var(--muted); }
.tbp-md-vs    { color: var(--muted); font-size: .75rem; font-weight: 400; }

/* Liga table tweaks */
.tbp-league-table th, .tbp-league-table td { padding: 8px 9px; }

/* ── MOBILE TABLE SCROLL ──────────────────────────────────────────────────── */
.tbp-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tbp-table-scroll::-webkit-scrollbar { height: 3px; }
.tbp-table-scroll::-webkit-scrollbar-track { background: transparent; }
.tbp-table-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* Prevent table from shrinking below its natural width */
.tbp-table-scroll .tbp-standings-table {
    min-width: 480px;
}



/* ── STANDINGS TABLE COLUMNS ──────────────────────────────────────────────── */

/* Header cells */
.tbp-th-rank  { width: 36px; text-align: center !important; }
.tbp-th-logo  { width: 48px; text-align: center !important; }
.tbp-th-name  { text-align: left !important; min-width: 100px; }
.tbp-th-num   { width: 54px; text-align: center !important; }

/* Data cells */
.tbp-td-rank  { text-align: center; width: 36px; padding: 8px 6px !important; }
.tbp-td-logo  { text-align: center; width: 48px; padding: 6px 4px !important; }
.tbp-td-name  { text-align: left; padding-left: 8px !important; white-space: nowrap; }
.tbp-td-num   { text-align: center; width: 54px; font-size: .88rem; font-weight: 600; }

/* Logo box inside table */
.tbp-tlogo {
    width: 34px; height: 34px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto;
    overflow: hidden;
    flex-shrink: 0;
}
.tbp-tlogo img {
    max-width: 28px; max-height: 28px;
    object-fit: contain;
}
.tbp-tlogo span {
    font-size: .72rem; font-weight: 800;
    line-height: 1;
}

/* Goals cell */
.tbp-goals-cell { font-weight: 700; white-space: nowrap; }
.tbp-ga { color: var(--muted); }

/* Tordifferenz */
.tbp-td-pos  { color: #2cb67d; font-weight: 800; }
.tbp-td-neg  { color: #e63946; font-weight: 800; }
.tbp-td-zero { color: var(--muted); }

/* Points */
.tbp-pts { color: var(--accent); font-weight: 800; }
