/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
}

/* Navigation Bar */
.navbar {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 40px;
    width: auto;
    max-width: 120px;
    border-radius: 0;
    background: transparent;
    object-fit: contain;
}

.logo-text {
    font-size: 1.3em;
    font-weight: 700;
    color: #e8640a;
}

.nav-menu {
    display: flex;
    gap: 5px;
    flex: 1;
}

.nav-link {
    padding: 10px 20px;
    color: #555;
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background: #f0f4ff;
    color: #e8640a;
}

.nav-link.active {
    background: linear-gradient(135deg, #e8640a 0%, #ff8c38 100%);
    color: white;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.kategori-selector {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95em;
    background: white;
    cursor: pointer;
    min-width: 150px;
}

.lang-selector {
    padding: 8px 14px;
    border: 2px solid #e8640a;
    border-radius: 8px;
    font-size: 0.88em;
    background: white;
    color: #e8640a;
    cursor: pointer;
    min-width: 140px;
    font-weight: 700;
    transition: background 0.2s, color 0.2s;
    appearance: auto;
}
.lang-selector:hover,
.lang-selector:focus {
    background: #e8640a;
    color: white;
    outline: none;
}

.btn-gabung {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #e8640a 0%, #ff8c38 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-gabung:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(26, 93, 216, 0.4);
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
}

.page-section {
    display: none;
    padding: 30px;
    animation: fadeIn 0.4s ease;
}

.page-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 2.5em;
    color: #1a1a1a;
    font-weight: 700;
}

/* Hero Section (Beranda) */
.hero-section {
    background: linear-gradient(135deg, #e8640a 0%, #c44d00 40%, #1a0a00 100%);
    padding: 80px 30px;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 600"><circle cx="200" cy="100" r="150" fill="rgba(255,255,255,0.05)"/><circle cx="1000" cy="400" r="200" fill="rgba(255,255,255,0.05)"/></svg>');
    opacity: 0.5;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-logo {
    width: 400px;
    height: auto;
    max-width: 90%;
    border-radius: 0;
    margin-bottom: 20px;
    border: none;
    object-fit: contain;
}

.hero-title {
    font-size: 3em;
    margin-bottom: 15px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.hero-subtitle {
    font-size: 1.5em;
    margin-bottom: 30px;
    opacity: 0.95;
}

.btn-hero {
    padding: 15px 40px;
    background: white;
    color: #e8640a;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-hero:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Info Section */
.info-section {
    padding: 60px 30px;
    background: white;
}

.info-container {
    max-width: 1000px;
    margin: 0 auto;
}

.info-container h2 {
    font-size: 2em;
    margin-bottom: 30px;
    color: #1a1a1a;
}

.info-content {
    font-size: 1.1em;
    line-height: 1.8;
    color: #555;
}

.info-content p {
    margin-bottom: 15px;
}

.info-highlight {
    color: #e8640a;
    font-weight: 700;
}

/* Filter Section */
.filter-section {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.filter-select {
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    min-width: 200px;
}

/* Komunitas Grid */
.komunitas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
}

.komunitas-card {
    background: white;
    border-radius: 15px;
    padding: 30px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid #f0f0f0;
}

.komunitas-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border-color: #e8640a;
}

.komunitas-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 20px;
    border-radius: 12px;
}

.komunitas-name {
    font-size: 1.2em;
    font-weight: 700;
    color: #1a1a1a;
}

/* Jadwal Tabs */
.jadwal-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.tab-btn {
    padding: 12px 30px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: linear-gradient(135deg, #e8640a 0%, #ff8c38 100%);
    color: white;
    border-color: #e8640a;
}

/* Jadwal Content */
.jadwal-content {
    display: grid;
    gap: 20px;
}

.week-section {
    margin-bottom: 40px;
}

.week-title {
    font-size: 1.5em;
    color: #e8640a;
    margin-bottom: 20px;
    font-weight: 700;
}

.match-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 600px));
    gap: 20px;
}

.match-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    border: 2px solid #f0f0f0;
    transition: all 0.3s ease;
}

.match-card:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    border-color: #e8640a;
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.match-number {
    font-weight: 700;
    color: #1a1a1a;
    font-size: 1.1em;
}

.match-week {
    color: #ff6b35;
    font-weight: 600;
}

.match-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
    font-size: 0.9em;
    color: #666;
}

.match-teams {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.team-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.team-row.winner {
    background: #e8f4ff;
    border: 2px solid #e8640a;
}

.team-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-logo-small {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    object-fit: contain;
}

.team-name {
    font-weight: 600;
    color: #1a1a1a;
}

.team-scores {
    display: flex;
    gap: 6px;
    align-items: center;
}

.score-box {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 6px;
    font-weight: 700;
    color: #333;
    border: 1px solid #e0e0e0;
    font-size: 0.95em;
}

.score-total {
    min-width: 38px;
    height: 38px;
    background: #e8640a;
    color: white;
    font-size: 1.15em;
}

.score-win {
    background: #dcfce7;
    color: #16a34a;
    border-color: #86efac;
    font-weight: 800;
}

.match-detail-btn {
    width: 100%;
    padding: 8px;
    background: #f0f4ff;
    color: #e8640a;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.3s ease;
}

.match-detail-btn:hover {
    background: #e8640a;
    color: white;
}

/* Klasemen Table */
#page-klasemen {
    padding: 0;
}

#page-klasemen .page-header,
#page-klasemen .filter-section {
    padding: 0 30px;
}

#page-klasemen .page-header {
    padding-top: 30px;
}

.table-container {
    background: white;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    margin: 0 30px 30px 30px;
    border-radius: 15px;
}

/* ===== LEADERBOARD (TOURNAMENT) ===== */
.page-section#page-leaderboard {
    padding-top: 26px;
}

#page-leaderboard .page-header {
    margin-bottom: 16px;
}

#page-leaderboard .page-header h1 {
    letter-spacing: -0.02em;
}

#page-leaderboard .filter-section {
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
}

#page-leaderboard .filter-select {
    min-width: 220px;
    border-color: #e5e7eb;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
}

.leaderboard-list:empty {
    display: block;
}

.leaderboard-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 18px;
}

.leaderboard-card {
    background: linear-gradient(180deg, #ffffff 0%, #fff7ed 100%);
    border-radius: 18px;
    border: 1px solid rgba(232,100,10,0.18);
    padding: 18px 18px 16px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
}

.leaderboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 45px rgba(17,24,39,0.12);
    border-color: rgba(232,100,10,0.45);
}

.leaderboard-card::before {
    content: '';
    position: absolute;
    inset: -40% -25% auto auto;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle at 30% 30%, rgba(232,100,10,0.22), rgba(232,100,10,0) 65%);
    transform: rotate(10deg);
    pointer-events: none;
}

.leaderboard-card::after {
    content: '›';
    position: absolute;
    right: 16px;
    top: 18px;
    font-size: 30px;
    font-weight: 900;
    color: rgba(17,24,39,0.25);
    transition: transform 0.2s ease, color 0.2s ease;
}

.leaderboard-card:hover::after {
    transform: translateX(2px);
    color: rgba(232,100,10,0.75);
}

.leaderboard-title {
    font-size: 1.25em;
    font-weight: 900;
    color: #111827;
    margin-bottom: 8px;
    padding-right: 34px;
    position: relative;
}

.leaderboard-title::before {
    content: '🏅';
    margin-right: 10px;
    filter: saturate(1.05);
}

.leaderboard-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: #6b7280;
    font-size: 0.88em;
    margin-bottom: 8px;
}

.lb-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(17,24,39,0.10);
    background: rgba(255,255,255,0.65);
    font-weight: 800;
    color: #374151;
}

.leaderboard-note {
    color: #6b7280;
    font-size: 0.95em;
    line-height: 1.4;
    padding-top: 6px;
}

.modal-content-leaderboard {
    max-width: 980px;
    padding: 26px 26px 24px;
}

/* Leaderboard detail page */
#page-leaderboardDetail {
    padding-top: 26px;
}

#leaderboardDetailPageContent .lb-detail-head {
    margin-top: 2px;
}

.lb-detail-head {
    padding-bottom: 10px;
    border-bottom: 2px solid #f3f4f6;
    margin-bottom: 14px;
}

.lb-detail-title {
    font-size: 1.45em;
    font-weight: 900;
    color: #111827;
    margin-bottom: 8px;
}

.lb-section-title {
    font-size: 1.05em;
    font-weight: 900;
    color: #111827;
    margin: 18px 0 10px;
}

.lb-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
}

.lb-ko-shell {
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #ffffff;
    padding: 12px 14px 18px;
    box-shadow: 0 10px 35px rgba(17,24,39,0.08);
}

.lb-group-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    background: white;
}

.lb-group-name {
    background: linear-gradient(135deg, #e8640a 0%, #ff8c38 100%);
    color: white;
    font-weight: 900;
    padding: 10px 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.82em;
}

.lb-table-wrap {
    overflow-x: auto;
}

.lb-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}

.lb-table thead th {
    text-align: left;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6b7280;
    background: #f9fafb;
    padding: 12px 12px;
    border-bottom: 1px solid #eef0f5;
}

.lb-table tbody td {
    padding: 12px 12px;
    border-bottom: 1px solid #f3f4f6;
    color: #111827;
    font-size: 0.92em;
}

.lb-table tbody tr:hover {
    background: #fff7ed;
}

@media (max-width: 900px) {
    .leaderboard-list {
        grid-template-columns: 1fr;
    }
    #page-leaderboard .filter-select {
        min-width: 0;
        flex: 1;
    }
}

.klasemen-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.klasemen-table thead {
    background: linear-gradient(135deg, #e8640a 0%, #ff8c38 100%);
    color: white;
}

.klasemen-table thead th {
    padding: 20px 15px;
    text-align: center;
    font-weight: 700;
    font-size: 0.85em;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-right: 1px solid rgba(255,255,255,0.1);
}

.klasemen-table thead th:last-child {
    border-right: none;
}

.klasemen-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    background: white;
}

.klasemen-table tbody tr:hover {
    background: #f8faff;
    transform: translateX(5px);
}

.klasemen-table tbody tr.rank-1 {
    background: linear-gradient(90deg, #fff9e6 0%, #fffbf0 100%);
    border-left: 6px solid #ffd700;
}

.klasemen-table tbody tr.rank-2 {
    background: linear-gradient(90deg, #f5f5f5 0%, #fafafa 100%);
    border-left: 6px solid #c0c0c0;
}

.klasemen-table tbody tr.rank-3 {
    background: linear-gradient(90deg, #fff5f0 0%, #fffaf7 100%);
    border-left: 6px solid #cd7f32;
}

.klasemen-table tbody td {
    padding: 18px 15px;
    text-align: center;
    font-size: 1em;
    color: #333;
}

.rank {
    font-weight: 700;
    font-size: 1.4em;
    color: #e8640a;
}

.team-info-cell {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-left: 10px;
}

.team-avatar {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    object-fit: contain;
}

.team-name-cell {
    font-weight: 700;
    color: #1a1a1a;
    text-align: left;
}

.kategori-mk {
    font-weight: 700;
}

.kategori-mk .menang {
    color: #10b981;
}

.kategori-mk .kalah {
    color: #ef4444;
}

.selisih-skor .positif {
    color: #10b981;
    font-weight: 700;
}

.selisih-skor .negatif {
    color: #ef4444;
    font-weight: 700;
}

.poin {
    font-size: 1.6em;
    font-weight: 900;
    color: #e8640a;
}

.loading,
.loading-text {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

/* ===== HAMBURGER BUTTON ===== */
.hamburger {
    display: none;
    background: none;
    border: 2px solid #e8640a;
    border-radius: 8px;
    padding: 7px 11px;
    cursor: pointer;
    font-size: 1.2em;
    color: #e8640a;
    line-height: 1;
    transition: all 0.2s;
    order: 2;
}
.hamburger:hover {
    background: #e8640a;
    color: white;
}

/* ===== RESPONSIVE — TABLET ===== */
@media (max-width: 1024px) {
    .nav-container {
        flex-wrap: wrap;
        gap: 10px;
    }
    .nav-menu {
        order: 3;
        width: 100%;
        justify-content: center;
    }
    .match-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== RESPONSIVE — MOBILE ===== */
@media (max-width: 768px) {

    /* --- Navbar --- */
    .hamburger {
        display: block;
        order: 0;
    }
    .nav-container {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 0;
    }
    .nav-logo {
        flex: 1;
        order: 1;
        padding-left: 10px;
    }
    .nav-actions {
        order: 2;
        gap: 8px;
    }
    .nav-menu {
        display: none;
        order: 4;
        width: 100%;
        flex-direction: column;
        gap: 4px;
        padding: 10px 0 6px;
        border-top: 1px solid #f0f0f0;
        margin-top: 10px;
        justify-content: flex-start;
    }
    .nav-menu.open {
        display: flex;
    }
    .nav-link {
        font-size: 1em;
        padding: 12px 16px;
        border-radius: 8px;
    }
    .btn-gabung {
        display: none;
    }
    .lang-selector {
        font-size: 0.8em;
        padding: 6px 10px;
        min-width: 110px;
    }

    /* --- Page sections --- */
    .page-section {
        padding: 20px 16px;
    }
    .page-header {
        margin-bottom: 18px;
    }
    .page-header h1 {
        font-size: 1.7em;
    }

    /* --- Hero --- */
    .hero-section {
        padding: 50px 20px 40px;
    }
    .hero-logo {
        max-width: 160px;
        width: auto;
        height: auto;
    }
    .hero-title {
        font-size: 1.8em;
    }
    .hero-subtitle {
        font-size: 1em;
    }
    .btn-hero {
        padding: 12px 20px;
        font-size: 0.9em;
        white-space: normal;
        max-width: 260px;
        display: inline-block;
        line-height: 1.3;
        text-align: center;
    }

    /* --- Info section --- */
    .info-section {
        padding: 30px 20px;
    }
    .info-container h2 {
        font-size: 1.4em;
        margin-bottom: 16px;
    }
    .info-content {
        font-size: 0.97em;
    }

    /* --- Filters --- */
    .filter-section {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 20px;
    }
    .filter-select {
        width: 100%;
        min-width: unset;
    }

    /* --- Tabs --- */
    .jadwal-tabs {
        gap: 8px;
        margin-bottom: 20px;
    }
    .tab-btn {
        flex: 1;
        padding: 10px 12px;
        font-size: 0.9em;
    }

    /* --- Komunitas grid --- */
    .komunitas-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    .komunitas-card {
        padding: 20px 14px;
    }
    .komunitas-logo {
        width: 80px;
        height: 80px;
    }
    .komunitas-name {
        font-size: 0.95em;
    }

    /* --- Match week --- */
    .week-title {
        font-size: 1.1em;
    }

    /* --- Match cards --- */
    .match-grid {
        grid-template-columns: 1fr;
    }
    .match-card {
        padding: 12px;
    }
    .match-number {
        font-size: 1em;
    }
    .score-box {
        min-width: 26px;
        height: 26px;
        font-size: 0.8em;
    }
    .score-total {
        min-width: 30px;
        height: 30px;
        font-size: 0.95em;
    }
    .team-name {
        font-size: 0.9em;
    }

    /* --- Klasemen table (horizontal scroll) --- */
    #page-klasemen {
        padding: 0;
    }
    #page-klasemen .page-header,
    #page-klasemen .filter-section {
        padding: 0 16px;
    }
    #page-klasemen .page-header {
        padding-top: 20px;
    }
    .table-container {
        margin: 0 16px 20px 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .klasemen-table {
        min-width: 540px;
        font-size: 0.78em;
    }
    .klasemen-table thead th,
    .klasemen-table tbody td {
        padding: 12px 8px;
    }
    .team-avatar {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }
    .team-info-cell {
        gap: 8px;
    }
    .poin {
        font-size: 1.2em;
    }
    .rank {
        font-size: 1.1em;
    }

    /* --- Modals — slide up from bottom --- */
    .modal {
        padding: 0;
        align-items: flex-end;
    }
    .modal-content {
        max-height: 90vh;
        max-width: 100%;
        width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 20px 16px 28px;
    }
    .modal-close {
        top: 14px;
        right: 16px;
        font-size: 26px;
    }

    /* Match detail modal */
    .md-scoreboard {
        padding: 14px 12px;
        gap: 8px;
    }
    .md-logo {
        width: 44px;
        height: 44px;
    }
    .md-score {
        font-size: 2.2em;
    }
    .md-tname {
        font-size: 0.75em;
    }
    .pair-row {
        padding: 8px 10px;
        gap: 6px;
    }
    .pair-names {
        font-size: 0.78em;
    }
    .ps-num {
        font-size: 0.88em;
    }

    /* Team profile modal */
    .modal-content-profile {
        max-width: 100%;
    }
    .tp-header {
        gap: 12px;
    }
    .tp-logo {
        width: 54px;
        height: 54px;
    }
    .tp-stats {
        gap: 6px;
    }
    .tp-stat {
        padding: 6px 10px;
        min-width: 44px;
    }
    .tp-teamname {
        font-size: 1.05em;
    }
    .tp-row-top {
        grid-template-columns: auto 1fr auto;
        gap: 8px;
        padding: 8px 12px;
    }
    .tp-row-meta {
        display: none;
    }
}

/* ===== RESPONSIVE — SMALL MOBILE ===== */
@media (max-width: 400px) {
    .logo-img {
        height: 34px;
        width: auto;
        max-width: 100px;
    }
    .logo-text {
        font-size: 1.1em;
    }
    .hero-title {
        font-size: 1.5em;
    }
    .hero-subtitle {
        font-size: 0.9em;
    }
    .hero-logo {
        max-width: 140px;
        width: auto;
        height: auto;
    }
    .komunitas-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .komunitas-logo {
        width: 60px;
        height: 60px;
    }
    .komunitas-name {
        font-size: 0.82em;
    }
    .klasemen-table {
        min-width: 480px;
        font-size: 0.72em;
    }
    .md-scoreboard {
        padding: 10px 8px;
    }
    .md-score {
        font-size: 1.9em;
    }
    .md-logo {
        width: 36px;
        height: 36px;
    }
}

/* ===== MATCH DETAIL MODAL ===== */
.modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    font-weight: 700;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: #333;
}

/* ===== MATCH DETAIL MODAL ===== */
.md-meta {
    text-align: center;
    font-size: 0.85em;
    color: #888;
    margin-bottom: 18px;
}

.md-scoreboard {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #1a3a6e 0%, #e8640a 100%);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    color: white;
}

.md-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.75;
}

.md-team.md-team-win {
    opacity: 1;
}

.md-logo {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: contain;
    border: 2px solid rgba(255,255,255,0.3);
    background: white;
}

.md-team-win .md-logo {
    border-color: #facc15;
    box-shadow: 0 0 12px rgba(250,204,21,0.5);
}

.md-tname {
    font-size: 0.85em;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

.md-result {
    display: flex;
    align-items: center;
    gap: 8px;
}

.md-score {
    font-size: 2.8em;
    font-weight: 800;
    color: rgba(255,255,255,0.5);
    line-height: 1;
}

.md-score.md-score-win {
    color: #facc15;
}

.md-vs {
    font-size: 0.75em;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
}

.md-pairs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cat-block {
    background: #f8faff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.cat-label {
    background: #e8640a;
    color: white;
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 14px;
}

.pair-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #eef2ff;
}

.pair-row:last-child {
    border-bottom: none;
}

.pair-names {
    font-size: 0.88em;
    color: #64748b;
    font-weight: 500;
}

.pair-names.right {
    text-align: right;
}

.pair-names.pair-winner {
    color: #1a3a6e;
    font-weight: 700;
}

.pair-scoreboard {
    display: flex;
    align-items: center;
    gap: 6px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px 10px;
}

.ps-num {
    font-size: 1em;
    font-weight: 700;
    color: #94a3b8;
    min-width: 16px;
    text-align: center;
}

.ps-num.ps-win {
    color: #e8640a;
    font-size: 1.15em;
}

.ps-sep {
    color: #cbd5e1;
    font-size: 0.85em;
}

/* keep old selector alive for score-number */
.score-number {
    color: #64748b;
    min-width: 30px;
    text-align: center;
}

.score-number.score-winner {
    color: #2563eb;
    font-size: 1.2em;
}

/* ===== TEAM PROFILE MODAL ===== */
.modal-content-profile {
    max-width: 600px;
    padding: 24px;
}

.tp-loading, .tp-empty {
    text-align: center;
    color: #aaa;
    padding: 40px 0;
    font-size: 0.95em;
}

.tp-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid #f0f4ff;
}

.tp-logo {
    width: 70px;
    height: 70px;
    border-radius: 14px;
    object-fit: contain;
    background: #f0f4ff;
    border: 2px solid #e2e8f0;
    flex-shrink: 0;
}

.tp-info {
    flex: 1;
}

.tp-teamname {
    font-size: 1.25em;
    font-weight: 800;
    color: #1a2744;
    margin-bottom: 10px;
}

.tp-stats {
    display: flex;
    gap: 10px;
}

.tp-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8faff;
    border-radius: 10px;
    padding: 8px 14px;
    border: 1px solid #e2e8f0;
    min-width: 52px;
}

.tp-stat.win  { background: #f0fdf4; border-color: #bbf7d0; }
.tp-stat.draw { background: #fefce8; border-color: #fef08a; }
.tp-stat.loss { background: #fff1f2; border-color: #fecdd3; }

.tp-stat-num {
    font-size: 1.4em;
    font-weight: 800;
    color: #1a2744;
    line-height: 1;
}

.tp-stat.win  .tp-stat-num { color: #16a34a; }
.tp-stat.draw .tp-stat-num { color: #ca8a04; }
.tp-stat.loss .tp-stat-num { color: #dc2626; }

.tp-stat-label {
    font-size: 0.7em;
    color: #94a3b8;
    margin-top: 2px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tp-section-title {
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 10px;
}

.tp-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tp-history-row {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.tp-row-top {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: white;
}

.tp-result-badge {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85em;
    flex-shrink: 0;
}

.tp-win  { background: #dcfce7; color: #16a34a; }
.tp-loss { background: #fee2e2; color: #dc2626; }
.tp-draw { background: #fef9c3; color: #ca8a04; }

.tp-opp {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.tp-opp-logo {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    object-fit: contain;
    background: #f0f4ff;
    flex-shrink: 0;
}

.tp-opp-name {
    font-size: 0.9em;
    font-weight: 600;
    color: #1a2744;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-row-score {
    font-size: 1.05em;
    font-weight: 800;
    color: #e8640a;
    white-space: nowrap;
}

.tp-row-meta {
    font-size: 0.72em;
    color: #94a3b8;
    white-space: nowrap;
    text-align: right;
}

.tp-pairs-detail {
    background: #f8faff;
    border-top: 1px solid #eef2ff;
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tp-cat-name {
    font-size: 0.7em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #e8640a;
    margin-top: 6px;
    margin-bottom: 2px;
}

.tp-cat-name:first-child { margin-top: 0; }

.tp-pair-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    font-size: 0.82em;
}

.tp-pair-name {
    color: #64748b;
    font-weight: 500;
}

.tp-pair-name.opp { text-align: right; }

.tp-pair-name.tp-pair-win {
    color: #1a2744;
    font-weight: 700;
}

.tp-pair-score {
    background: #e2e8f0;
    color: #64748b;
    font-weight: 700;
    font-size: 0.85em;
    padding: 2px 8px;
    border-radius: 6px;
    text-align: center;
    white-space: nowrap;
}

.tp-pair-score.tp-pair-score-win  { background: #dbeafe; color: #1d4ed8; }
.tp-pair-score.tp-pair-score-loss { background: #fee2e2; color: #dc2626; }

/* ===== PUBLIC KNOCKOUT BRACKET ===== */

/* wrapper: inline-flex so text-align:center on parent centers it */
.pub-bracket-wrapper {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    vertical-align: top;
}

/* each side is a fixed-width flex row of columns */
.pub-side        { display: flex; flex: none; }
.pub-left        { flex-direction: row; }
.pub-right       { flex-direction: row-reverse; }

/* center section (SF + Final) */
.pub-center {
    flex: none;
    width: 380px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    padding: 0 8px;
    position: relative;
    z-index: 1;
}

/* round column — width set via JS per round */
.pub-round-col {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 38px 6px 12px;
    flex: none;
    position: relative;
    z-index: 1;
}

.pub-round-label {
    position: absolute;
    top: 10px;
    left: 0; right: 0;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* ---- Match boxes ---- */
.pub-match {
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.pub-match.pub-final {
    border-color: #f59e0b;
    box-shadow: 0 4px 16px rgba(245,158,11,0.22);
}

/* ---- Slots ---- */
.pub-slot {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 11px;
    min-height: 40px;
    border-left: 3px solid transparent;
    box-sizing: border-box;
}

.pub-slot:first-child { border-bottom: 1px solid #f3f4f6; }
.pub-slot.pub-won  { background: #ecfdf5; border-left-color: #10b981; }
.pub-slot.pub-lost { opacity: 0.5; }

.pub-slot-logo, .pub-slot-initial {
    width: 24px; height: 24px;
    border-radius: 5px;
    flex-shrink: 0;
    margin-top: 1px;
}
.pub-slot-logo { object-fit: contain; }
.pub-slot-initial {
    background: #e8640a; color: #fff;
    font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

.pub-slot-name {
    flex: 1; min-width: 0;
    font-size: 12px; font-weight: 600;
    color: #111827; line-height: 1.35;
    word-break: break-word;
}
.pub-slot-name.pub-slot-name-won { font-weight: 700; color: #059669; }

.pub-slot-tbd { font-size: 11px; color: #d1d5db; font-style: italic; }

.pub-slot-meta {
    flex-shrink: 0;
    font-size: 13px; font-weight: 800;
    color: #6b7280; white-space: nowrap;
    line-height: 1; padding: 2px 6px;
    background: #f3f4f6; border-radius: 6px;
    min-width: 24px; text-align: center;
}
.pub-slot-meta.pub-meta-won  { color: #059669; background: #d1fae5; }
.pub-slot-meta.pub-meta-lost { color: #9ca3af; background: #f3f4f6; }

/* ---- Center labels ---- */
.pub-final-label {
    font-weight: 800; color: #d97706;
    font-size: 14px; letter-spacing: 2px;
    margin-bottom: 8px; text-align: center;
}
.pub-sf-label {
    font-size: 9px; font-weight: 700;
    color: #9ca3af; letter-spacing: 1.5px;
    margin-bottom: 6px; text-align: center;
    text-transform: uppercase;
}
