@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@700&family=Roboto+Condensed:ital,wght@1,700&display=swap');

body { background-color: #050505; color: #f8fafc; font-family: sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
.glass-card { 
    background: rgba(30, 30, 35, 0.9); 
    backdrop-filter: blur(10px); 
    border: 2px solid #dc2626; 
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.2);
}
.btn-primary { 
    background: linear-gradient(to right, #991b1b, #dc2626); 
    transition: all 0.3s ease; 
}
.btn-primary:hover { 
    opacity: 0.9; 
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.4);
    transform: translateY(-1px);
}
select { background-color: #1a1a1c !important; border-color: #3f3f46 !important; }
main { flex: 1; }
.btn-calendar { border: 1px solid #3f3f46; transition: all 0.2s ease; }
.btn-calendar:hover { background-color: #ffffff; color: #000000; border-color: #ffffff; }
.day-slot { transition: all 0.2s ease; border: 1px solid #2d2d30; }
.day-available { background: rgba(34, 197, 94, 0.1); border-color: #22c55e; color: #22c55e; }
.day-busy { background: rgba(220, 38, 38, 0.1); border-color: #dc2626; color: #ef4444; }
.timer-red { color: #dc2626; font-family: monospace; font-weight: bold; }
.timer-checkin { color: #3b82f6; font-family: monospace; font-weight: bold; }
.timer-checkin-pending { color: #60a5fa; font-family: monospace; font-weight: bold; }
.timer-end { color: #6b7280; font-family: monospace; font-weight: bold; }
.timer-ready { color: #f59e0b; font-family: monospace; font-weight: bold; }
.timer-active { color: #ef4444; font-family: monospace; font-weight: bold; animation: pulse 1.5s infinite; }
.timer-completed { color: #22c55e; font-family: monospace; font-weight: bold; }
.bracket-live-badge {
    background: rgba(220, 38, 38, 0.9);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: pulse 1.5s infinite;
    white-space: nowrap;
    box-shadow: 0 0 12px rgba(220,38,38,0.5);
    display: inline-block;
    margin-bottom: 8px;
    text-align: center;
}
.bracket-upcoming-badge {
    background: rgba(245, 158, 11, 0.9);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    box-shadow: 0 0 12px rgba(245,158,11,0.5);
    display: inline-block;
    margin-bottom: 8px;
    text-align: center;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.animate-slide-in { animation: slideIn 0.3s ease-out; }

/* ========== API STATUS INDICATOR ========== */
.api-status-bar { position: fixed; bottom: 10px; right: 10px; z-index: 50; display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.9); padding: 6px 14px; border-radius: 6px; border: 1px solid rgba(220,38,38,0.5); font-size: 10px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; backdrop-filter: blur(8px); box-shadow: 0 4px 15px rgba(0,0,0,0.5); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-online { background: #22c55e; box-shadow: 0 0 10px #22c55e; }
.status-offline { background: #ef4444; box-shadow: 0 0 10px #ef4444; }
.status-checking { background: #eab308; box-shadow: 0 0 10px #eab308; }

/* ========== OVERLAY & SIDEBARS GLOBAL ========== */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 9999; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.overlay.active { opacity: 1; pointer-events: auto; }

.sidebar-base { 
    position: fixed; top: 0; right: 0; width: 100%; height: 100vh; z-index: 10000; 
    background: #0b0e13; transform: translateX(100%); transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1); 
    display: flex; flex-direction: column; 
}
.sidebar-base.open { transform: translateX(0); }

.sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; background: rgba(0,0,0,0.95); flex-shrink: 0; }
.sidebar-header h2 { font-size: 16px; color: white; text-transform: uppercase; letter-spacing: 2px; font-weight: bold; margin: 0; }
.sidebar-content { flex: 1; overflow-y: auto; padding: 20px; }
.sidebar-content::-webkit-scrollbar { width: 6px; height: 6px; }
.sidebar-content::-webkit-scrollbar-track { background: #111; }

.loading-attendees { text-align: center; padding: 40px; color: #aaa; }
.loading-attendees .spinner { display: inline-block; width: 30px; height: 30px; border: 3px solid #333; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== ATTENDEES SIDEBAR ========== */
.attendees-sidebar { max-width: 400px; border-left: 3px solid #dc2626; box-shadow: -10px 0 40px rgba(0,0,0,0.9); }
.attendees-sidebar .sidebar-header { border-bottom: 2px solid #dc2626; }
.attendees-sidebar .count { color: #dc2626; font-size: 14px; }
.attendees-sidebar .btn-close { background: #dc2626; color: white; border: none; padding: 10px 18px; cursor: pointer; font-weight: bold; text-transform: uppercase; font-size: 13px; border-radius: 6px; transition: all 0.2s; }
.attendees-sidebar .btn-close:hover { background: #ef4444; box-shadow: 0 0 15px rgba(220,38,38,0.5); }
.attendees-sidebar .sidebar-content::-webkit-scrollbar-thumb { background: #dc2626; border-radius: 3px; }
.attendees-sidebar .spinner { border-top-color: #dc2626; }

.attendee-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; margin-bottom: 8px; transition: all 0.2s; }
.attendee-item:hover { background: rgba(220,38,38,0.1); border-color: rgba(220,38,38,0.3); }
.attendee-number { color: #dc2626; font-weight: bold; font-size: 13px; min-width: 30px; }
.attendee-name { color: white; font-weight: 600; font-size: 14px; flex: 1; }
.attendee-name.clickable { cursor: pointer; text-decoration: underline dotted; }
.attendee-name.clickable:hover { color: #dc2626; }
.attendee-flag { width: 28px; height: 20px; border-radius: 3px; object-fit: cover; }
.attendees-icon-left { position: absolute; bottom: 8px; left: 10px; background: rgba(0,0,0,0.75); color: white; width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; transition: all 0.2s ease; border: 1px solid rgba(255,255,255,0.2); padding: 0; }
.attendees-icon-left:hover { background: #dc2626; border-color: #dc2626; box-shadow: 0 0 15px rgba(220,38,38,0.5); }

/* PLAYER HISTORY STYLES */
.player-history { background: rgba(255,255,255,0.02); border: 1px solid rgba(220,38,38,0.3); border-radius: 8px; padding: 12px; margin-top: 8px; margin-bottom: 12px; margin-left: 42px; }
.history-title { font-size: 12px; font-weight: bold; color: #dc2626; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.history-empty { font-size: 11px; color: #ef4444; font-weight: bold; background: rgba(239,68,68,0.1); padding: 8px; border-radius: 4px; border: 1px solid rgba(239,68,68,0.3); }
.history-search { font-size: 11px; color: #aaa; padding: 8px; text-align: center; }
.history-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 11px; }
.history-item:last-child { border-bottom: none; }
.history-name { color: white; flex: 1; font-size: 11px; font-weight: bold; }
.history-placement { font-weight: 900; font-size: 12px; }
.history-winrate { font-size: 18px; font-weight: bold; margin-bottom: 12px; }
.history-winrate-detail { font-size: 11px; color: #aaa; margin-bottom: 8px; }
.history-winrate-60 { color: #22c55e; }
.history-winrate-40 { color: #eab308; }
.history-winrate-0 { color: #ef4444; }
.legend-bar { display: flex; gap: 12px; padding: 10px 14px; background: rgba(220, 38, 38, 0.1); border: 1px solid rgba(220, 38, 38, 0.3); border-radius: 8px; margin-bottom: 16px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; backdrop-filter: blur(10px); }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 10px; text-transform: uppercase; font-weight: bold; letter-spacing: 1px; color: white; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-dot.green { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,0.5); }
.legend-dot.yellow { background: #eab308; box-shadow: 0 0 8px rgba(234,179,8,0.5); }
.legend-dot.red { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,0.5); }

/* ========== RANKING SIDEBAR ========== */
.ranking-sidebar { max-width: 420px; border-left: 3px solid #7c3aed; box-shadow: -10px 0 40px rgba(124,58,237,0.25); }
.ranking-sidebar .sidebar-header { border-bottom: 2px solid #7c3aed; }
.ranking-sidebar .header-left { display: flex; flex-direction: column; gap: 2px; }
.ranking-sidebar .league-name { color: #a855f7; font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.ranking-sidebar .btn-close { background: #7c3aed; color: white; border: none; padding: 10px 18px; cursor: pointer; font-weight: bold; text-transform: uppercase; font-size: 13px; border-radius: 6px; transition: all 0.2s; }
.ranking-sidebar .btn-close:hover { background: #9333ea; box-shadow: 0 0 15px rgba(124,58,237,0.5); }
.ranking-sidebar .sidebar-content::-webkit-scrollbar-thumb { background: #7c3aed; border-radius: 3px; }
.ranking-sidebar .spinner { border-top-color: #7c3aed; }

.btn-ranking { display: flex; align-items: center; justify-content: center; gap: 6px; background: linear-gradient(135deg, #7c3aed, #a855f7); color: white; font-weight: 900; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(168,85,247,0.5); cursor: pointer; transition: all 0.2s ease; box-shadow: 0 0 12px rgba(124,58,237,0.3); }
.btn-ranking:hover { background: linear-gradient(135deg, #6d28d9, #9333ea); box-shadow: 0 0 22px rgba(124,58,237,0.6); transform: translateY(-1px); }
.league-badge { display: inline-flex; align-items: center; gap: 4px; background: rgba(124,58,237,0.15); border: 1px solid rgba(168,85,247,0.4); color: #c084fc; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; padding: 3px 8px; border-radius: 4px; margin-bottom: 6px; }

.ranking-player-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px; margin-bottom: 8px; border: 1px solid rgba(255,255,255,0.05); background: rgba(255,255,255,0.03); transition: all 0.2s; position: relative; overflow: hidden; }
.ranking-player-card:hover { background: rgba(124,58,237,0.1); border-color: rgba(168,85,247,0.35); }
.ranking-player-card.rank-1 { border-color: rgba(255,204,0,0.45); background: rgba(255,204,0,0.05); }
.ranking-player-card.rank-2 { border-color: rgba(192,192,192,0.4); background: rgba(192,192,192,0.04); }
.ranking-player-card.rank-3 { border-color: rgba(176,110,60,0.4); background: rgba(176,110,60,0.04); }
.rank-number { font-size: 20px; font-weight: 900; font-style: italic; min-width: 38px; text-align: center; font-family: 'Georgia', serif; }
.rank-number.rank-1 { color: #ffcc00; text-shadow: 0 0 12px rgba(255,204,0,0.5); }
.rank-number.rank-2 { color: #c0c0c0; text-shadow: 0 0 12px rgba(192,192,192,0.4); }
.rank-number.rank-3 { color: #b06e3c; text-shadow: 0 0 12px rgba(176,110,60,0.4); }
.rank-number.rank-other { color: #555; }
.ranking-player-info { flex: 1; min-width: 0; }
.ranking-player-name { color: white; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking-player-pts { color: #a855f7; font-size: 11px; font-weight: 800; letter-spacing: 0.5px; margin-top: 2px; }
.ranking-flag { width: 28px; height: 20px; border-radius: 3px; object-fit: cover; flex-shrink: 0; }
.ranking-flag-placeholder { width: 28px; height: 20px; background: rgba(255,255,255,0.05); border-radius: 3px; flex-shrink: 0; }
.ranking-bar-wrap { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: rgba(255,255,255,0.04); }
.ranking-bar-fill { height: 100%; border-radius: 0 2px 2px 0; transition: width 0.6s ease; }
.rank-1 .ranking-bar-fill { background: #ffcc00; }
.rank-2 .ranking-bar-fill { background: #c0c0c0; }
.rank-3 .ranking-bar-fill { background: #b06e3c; }
.rank-other-bar { background: #7c3aed; }
.ranking-footer-link { flex-shrink: 0; padding: 12px 20px; border-top: 1px solid rgba(124,58,237,0.2); background: rgba(0,0,0,0.6); }
.ranking-footer-link a { display: flex; align-items: center; justify-content: center; gap: 6px; color: #a855f7; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; text-decoration: none; padding: 8px; border-radius: 6px; border: 1px solid rgba(168,85,247,0.3); transition: all 0.2s; }
.ranking-footer-link a:hover { background: rgba(124,58,237,0.2); border-color: #a855f7; }

/* ========== BRACKET SIDEBAR & BUTTON ========== */
.btn-bracket { display: flex; align-items: center; justify-content: center; gap: 6px; background: linear-gradient(135deg, #1e3a8a, #3b82f6); color: white; font-weight: 900; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(59,130,246,0.5); cursor: pointer; transition: all 0.2s ease; box-shadow: 0 0 12px rgba(59,130,246,0.3); }
.btn-bracket:hover { background: linear-gradient(135deg, #1e40af, #2563eb); box-shadow: 0 0 22px rgba(59,130,246,0.6); transform: translateY(-1px); }

.bracket-sidebar { max-width: 100%; border-left: 3px solid #3b82f6; box-shadow: -10px 0 40px rgba(59,130,246,0.25); }
.bracket-sidebar .sidebar-header { border-bottom: 2px solid #3b82f6; }
.bracket-sidebar .header-left { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.bracket-sidebar .btn-close { background: #3b82f6; color: white; border: none; padding: 10px 18px; cursor: pointer; font-weight: bold; text-transform: uppercase; font-size: 13px; border-radius: 6px; transition: all 0.2s; }
.bracket-sidebar .btn-close:hover { background: #2563eb; box-shadow: 0 0 15px rgba(59,130,246,0.5); }
.bracket-sidebar .sidebar-content { overflow: auto; padding: 0; background: #0b0e13; position: relative; }
.bracket-sidebar .sidebar-content::-webkit-scrollbar-thumb { background: #3b82f6; border-radius: 3px; }
.bracket-sidebar .spinner { border-top-color: #3b82f6; }

.event-select { background: #1a1a1c; border: 1px solid #3b82f6; color: white; padding: 6px 12px; border-radius: 6px; font-size: 12px; outline: none; cursor: pointer; }

/* BRACKET LAYOUT START GG */
.brk-container { --magenta: #ff0055; --led-red: #ff3366; --gold: #ffd700; font-family: 'Oswald', sans-serif; padding: 50px; display: flex; flex-direction: column; gap: 40px; position: relative; z-index: 10; width: max-content; }
.brk-row { display: flex; gap: 60px; align-items: flex-start; min-height: 200px; flex-wrap: nowrap; position: relative; }
.brk-label { color: #ffffff; text-transform: uppercase; font-size: 28px; margin-bottom: 15px; border-left: 8px solid var(--magenta); padding-left: 15px; letter-spacing: 2px; }
.brk-column { display: flex; flex-direction: column; gap: 40px; min-width: 420px; position: relative; }
.brk-round-title { font-size: 20px; text-transform: uppercase; color: #ffffff; border-bottom: 2px solid #444; padding-bottom: 8px; margin-bottom: 10px; }
.brk-match-card { background: #161a21; width: 420px; border: 2px solid #333; box-shadow: 0 6px 20px rgba(0,0,0,0.6); position: relative; z-index: 20; }
.brk-match-card.on-stream { border: 2px solid var(--gold) !important; box-shadow: 0 0 25px rgba(255, 215, 0, 0.5); }
.brk-match-card.on-stream::after { content: "LIVE ON STREAM"; position: absolute; top: -18px; right: -2px; background: var(--gold); color: black; font-size: 11px; font-weight: 900; padding: 2px 10px; border-radius: 2px; }
.brk-player { display: flex; justify-content: space-between; align-items: center; height: 65px; padding: 0 0 0 20px; border-bottom: 2px solid #000; position: relative; }
.brk-name-container { display: flex; align-items: center; overflow: hidden; }
.brk-name { font-size: 24px; text-transform: uppercase; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; color: white; }
.brk-score { background: #232933; width: 70px; height: 100%; display: flex; justify-content: center; align-items: center; font-size: 32px; color: #ffffff; font-weight: bold; }
.brk-winner { border-left: 8px solid var(--led-red); background: rgba(255, 51, 102, 0.15); box-shadow: -5px 0 15px rgba(255, 51, 102, 0.5); }
.brk-winner .brk-score { background: var(--led-red); }
.brk-loser .brk-name { color: #cccccc; }
.brk-loser .brk-score { background: #333; color: #ffffff; }
.brk-flag-img { width: 35px; height: auto; margin-right: 12px; border-radius: 3px; box-shadow: 0 0 6px rgba(0,0,0,0.8); flex-shrink: 0; }
.brk-connector { position: absolute; background: #333; z-index: 5; overflow: hidden; pointer-events: none; }
.brk-led-flow { position: absolute; background: var(--led-red); box-shadow: 0 0 10px var(--led-red), 0 0 20px var(--led-red); animation: brk-led-animation 2s linear infinite; }
.brk-empty-area { display: none; }

@keyframes brk-led-animation { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes brk-led-animation-v-down { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } }
@keyframes brk-led-animation-v-up { 0% { transform: translateY(100%); } 100% { transform: translateY(-100%); } }

@media (max-width: 768px) { 
    .api-status-bar { bottom: 5px; right: 5px; padding: 4px 10px; font-size: 9px; }
    .attendees-icon-left { display: flex; width: 24px; height: 24px; bottom: 6px; left: 6px; border-radius: 4px; }
    .attendees-icon-left i { font-size: 10px; }
    .attendees-sidebar, .ranking-sidebar, .bracket-sidebar { max-width: 100%; border-left: none; }
    .sidebar-header { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
    .sidebar-header h2 { font-size: 14px; }
    .sidebar-content { padding: 12px; }
    .btn-close { padding: 8px 14px; font-size: 11px; }
    .attendee-item { padding: 10px 12px; gap: 8px; }
    .attendee-name { font-size: 13px; }
    .attendee-number { font-size: 11px; min-width: 24px; }
    .attendee-flag { width: 22px; height: 16px; }
    .player-history { margin-left: 36px; }
    .brk-container { padding: 20px; gap: 20px; }
    .brk-row { gap: 30px; }
    .brk-column { min-width: 280px; gap: 20px; }
    .brk-match-card { width: 280px; }
    .brk-player { height: 45px; }
    .brk-name { font-size: 16px; max-width: 150px; }
    .brk-score { width: 40px; font-size: 20px; }
    .brk-flag-img { width: 24px; }
    .brk-label { font-size: 18px; }
    .brk-round-title { font-size: 14px; }
}