@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: #f4f5f7;
    color: #1a1a2e;
    font-size: 14px;
    line-height: 1.5;
}

/* ── Header ─────────────────────────────── */

.header {
    background: #00558a;
    color: #fff;
    padding: 28px 24px;
    text-align: center;
    border-bottom: 3px solid #78be20;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.header-sub {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 4px;
    font-weight: 400;
}

/* ── Nav ────────────────────────────────── */

.nav {
    display: flex;
    gap: 2px;
    background: #fff;
    padding: 0 24px;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-btn {
    padding: 12px 20px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-btn:hover { color: #00558a; }

.nav-btn.active {
    color: #00558a;
    border-bottom-color: #00558a;
    font-weight: 600;
}

/* ── Layout ─────────────────────────────── */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.tab { display: none; }
.tab.active { display: block; }

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #1a1a2e;
}

/* ── Card ───────────────────────────────── */

.card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: #334155;
}

/* ── Stats Row ──────────────────────────── */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.stat-val {
    font-size: 1.6rem;
    font-weight: 800;
    color: #00558a;
}

.stat-lbl {
    font-size: 0.72rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* ── Podium ─────────────────────────────── */

.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.podium-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px 16px;
    text-align: center;
    width: 180px;
}

.podium-card.p1 {
    border-color: #78be20;
    border-width: 2px;
    box-shadow: 0 2px 12px rgba(120,190,32,0.15);
    order: 2;
    padding-bottom: 32px;
}

.podium-card.p2 { order: 1; }
.podium-card.p3 { order: 3; }

.podium-rank {
    font-size: 1.8rem;
    margin-bottom: 4px;
}

.podium-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a2e;
}

.podium-team {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 6px;
}

.podium-score {
    font-size: 1.2rem;
    font-weight: 800;
}

.podium-card.p1 .podium-score { color: #78be20; }
.podium-card.p2 .podium-score { color: #64748b; }
.podium-card.p3 .podium-score { color: #b45309; }

.podium-meta {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 2px;
}

/* ── Table ──────────────────────────────── */

.table-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

thead th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: center;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

tbody td {
    padding: 9px 14px;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}

tbody tr:hover { background: #f8fafc; }

.text-left { text-align: left; }

.rank-1 { color: #78be20; font-weight: 700; }
.rank-2 { color: #64748b; font-weight: 700; }
.rank-3 { color: #b45309; font-weight: 700; }

.kda-k { color: #16a34a; font-weight: 600; }
.kda-d { color: #dc2626; font-weight: 600; }
.kda-a { color: #0077b6; font-weight: 600; }

.role-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.role-jungler { background: #fef2f2; color: #dc2626; }
.role-gold { background: #fffbeb; color: #b45309; }
.role-mid { background: #f5f3ff; color: #7c3aed; }
.role-exp { background: #ecfdf5; color: #059669; }
.role-roamer { background: #eff6ff; color: #0077b6; }

.badge-mvp {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #f0fdf4;
    color: #16a34a;
}

.score-highlight {
    font-weight: 700;
    color: #00558a;
}

/* ── Match Cards ────────────────────────── */

.match-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 12px;
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.match-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1a1a2e;
}

.match-teams {
    font-size: 0.8rem;
    color: #64748b;
}

.match-winner {
    font-size: 0.75rem;
    font-weight: 600;
    color: #16a34a;
}

.match-mvp-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mvp-avatar {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: #00558a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.mvp-info { flex: 1; }

.mvp-name {
    font-weight: 600;
    font-size: 0.88rem;
}

.mvp-detail {
    font-size: 0.75rem;
    color: #64748b;
}

.mvp-score-val {
    font-size: 1.1rem;
    font-weight: 800;
    color: #78be20;
}

.match-stats-table {
    margin-top: 10px;
    width: 100%;
}

.match-stats-table th {
    font-size: 0.68rem;
    padding: 6px 8px;
}

.match-stats-table td {
    font-size: 0.78rem;
    padding: 6px 8px;
}

.match-toggle {
    font-size: 0.75rem;
    color: #0077b6;
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-weight: 500;
    margin-top: 8px;
}

.match-toggle:hover { text-decoration: underline; }

/* ── Forms ──────────────────────────────── */

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.82rem;
    color: #1a1a2e;
    background: #fff;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #00558a;
    box-shadow: 0 0 0 2px rgba(0,85,138,0.1);
}

.form-group input::placeholder { color: #94a3b8; }

/* ── Player Form Card ───────────────────── */

.player-form-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 10px;
}

.player-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.player-form-header strong {
    font-size: 0.85rem;
    color: #334155;
}

.player-form-header .team-label {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 500;
}

/* ── Team Cards ─────────────────────────── */

.team-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 12px;
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.team-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.team-count {
    font-size: 0.75rem;
    color: #64748b;
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: 4px;
    font-size: 0.82rem;
}

.player-row .ign { font-weight: 500; }
.player-row .role { color: #64748b; font-size: 0.75rem; }

.add-player-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.add-player-row input,
.add-player-row select {
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.8rem;
}

/* ── Buttons ────────────────────────────── */

.btn {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary { background: #00558a; color: #fff; }
.btn-primary:hover { background: #003d66; }

.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-outline {
    background: #fff;
    color: #334155;
    border: 1px solid #d1d5db;
}
.btn-outline:hover { background: #f8fafc; }

.btn-sm { padding: 4px 10px; font-size: 0.75rem; }

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.btn-icon:hover { color: #dc2626; background: #fef2f2; }

/* ── Bobot Grid ─────────────────────────── */

.bobot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.bobot-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 4px;
    font-size: 0.82rem;
}

.bobot-item span:last-child {
    font-weight: 600;
    color: #00558a;
}

/* ── Toast ──────────────────────────────── */

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    z-index: 9999;
    color: #fff;
    animation: slideUp 0.25s ease;
}

.toast-ok { background: #16a34a; }
.toast-err { background: #dc2626; }
.toast-info { background: #00558a; }

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ── Bracket (BracketHQ style) ────────────── */

.bracket-container {
    position: relative;
}

.bq-grid {
    display: grid;
    grid-template-columns: 190px 190px 190px 130px;
    grid-template-rows: auto auto auto;
    gap: 0 50px;
    padding: 16px 8px 24px;
    position: relative;
    overflow-x: auto;
    max-width: 900px;
}

.bq-hdr {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 16px;
}

.bq-c1 { grid-column: 1; }
.bq-c2 { grid-column: 2; }
.bq-c3 { grid-column: 3; }
.bq-c4 { grid-column: 4; }
.bq-r1 { grid-row: 2; }
.bq-r2 { grid-row: 3; }
.bq-r3 { grid-row: 4; }
.bq-r12 { grid-row: 2 / 4; display: flex; align-items: center; }
.bq-r123 { grid-row: 2 / 5; display: flex; align-items: center; }

.bq-cell {
    padding: 6px 0;
}

/* ── Match box ── */
.bq-match {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    width: 100%;
}

.bq-match.done {
    border-color: #cbd5e1;
}

.bq-match.bq-bye {
    border-style: dashed;
    background: #f8fafc;
}

.bq-bye-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    text-align: center;
    padding: 2px 0 4px;
}

/* ── Team row ── */
.bq-team {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-bottom: 1px solid #f1f5f9;
}

.bq-team:last-child {
    border-bottom: none;
}

.bq-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bq-team.tbd .bq-name {
    color: #b0b8c4;
    font-style: italic;
    font-weight: 400;
}

.bq-team.win {
    background: #ecfdf5;
}

.bq-team.win .bq-name {
    color: #15803d;
    font-weight: 700;
}

.bq-team.lose .bq-name {
    color: #b0b8c4;
    text-decoration: line-through;
}

.bq-check {
    color: #16a34a;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-left: 6px;
}

.bq-score {
    font-weight: 800;
    font-size: 0.9rem;
    color: #00558a;
    min-width: 16px;
    text-align: center;
    flex-shrink: 0;
    margin-left: 6px;
}

.bq-team.win .bq-score { color: #15803d; }
.bq-team.lose .bq-score { color: #b0b8c4; }

/* ── SVG connector lines ── */
.bq-lines {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

/* ── Champion ── */
.bq-champion {
    background: #fff;
    border: 2px dashed #e2e8f0;
    border-radius: 8px;
    padding: 16px 12px;
    text-align: center;
    width: 100%;
}

.bq-champion.decided {
    border: 2px solid #78be20;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
}

.bq-trophy { font-size: 1.8rem; margin-bottom: 4px; }

.bq-champ-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: #15803d;
}

.bq-champion:not(.decided) .bq-champ-name {
    color: #94a3b8;
    font-weight: 500;
}

/* ── Extra sections (3rd place, BO3 detail) ── */
.bq-extra {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.bq-extra-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 10px;
}

.bq-extra .bq-match {
    width: 220px;
}

.bq-bo3-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.bq-bo3-row .bq-match {
    width: 180px;
}

.bracket-awards {
    display: flex;
    gap: 20px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.award-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    flex: 1;
    min-width: 240px;
    text-align: center;
}

.award-card h3 {
    font-size: 0.85rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.award-icon {
    font-size: 2rem;
    margin-bottom: 6px;
}

.award-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
}

.award-detail {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 2px;
}

.award-card.champion { border-color: #78be20; border-width: 2px; }
.award-card.runnerup { border-color: #94a3b8; }
.award-card.third { border-color: #b45309; }
.award-card.mvp-award { border-color: #00558a; border-width: 2px; }
.award-card.fsp-award { border-color: #dc2626; }

/* ── Interactive Bracket ────────────────── */

.bq-team-sel select {
    width: 100%;
    padding: 5px 8px;
    font-size: 0.78rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}
.bq-team-sel select:focus { border-color: #00558a; outline: none; }

.bq-winner-row {
    display: flex;
    gap: 6px;
    padding: 4px 8px 6px;
    border-top: 1px solid #e2e8f0;
    align-items: center;
}
.bq-winner-row select {
    flex: 1;
    padding: 3px 6px;
    font-size: 0.72rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
}
.bq-btn-play {
    padding: 3px 8px;
    font-size: 0.7rem;
    background: #00558a;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 600;
}
.bq-btn-play:hover { background: #003d66; }

.bq-actions {
    padding: 3px 8px 5px;
    text-align: right;
    border-top: 1px solid #e2e8f0;
}
.bq-btn-del {
    padding: 2px 8px;
    font-size: 0.68rem;
    background: none;
    color: #dc2626;
    border: 1px solid #fca5a5;
    border-radius: 4px;
    cursor: pointer;
}
.bq-btn-del:hover { background: #fef2f2; }

.bq-lock {
    font-size: 0.65rem;
    margin-left: auto;
    opacity: 0.5;
}

.bq-bo3-game {
    flex: 1;
    min-width: 170px;
}
.bq-bo3-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    text-align: center;
}

/* Inline form card */
.bq-form-card {
    margin-top: 24px;
    border: 2px solid #00558a;
    animation: bqSlideIn 0.3s ease;
}
@keyframes bqSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.bq-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f0f7ff;
    border-bottom: 1px solid #e2e8f0;
}
.bq-form-header h3 {
    margin: 0;
    font-size: 0.95rem;
    color: #00558a;
}
.bq-btn-close {
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #64748b;
}
.bq-btn-close:hover { background: #f1f5f9; }
.bq-form-meta {
    padding: 10px 20px;
    font-size: 0.82rem;
    color: #475569;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.bq-form-submit {
    padding: 16px 20px;
    text-align: right;
    border-top: 1px solid #e2e8f0;
}

/* ── FSP Form ───────────────────────────── */

.bq-fsp-form {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
}
.bq-fsp-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.bq-fsp-row select {
    padding: 6px 10px;
    font-size: 0.82rem;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    min-width: 160px;
}
.bq-fsp-current {
    margin-top: 10px;
    font-size: 0.82rem;
    color: #475569;
    padding: 8px 12px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 6px;
}

/* ── Misc ───────────────────────────────── */

.text-muted { color: #64748b; font-size: 0.8rem; }
.empty-state {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 0.85rem;
}
