:root {
    --bg-dark: #090c10;
    --sidebar-bg: #161b22;
    --card-bg: #1e2530;
    --accent-red: #ff4655;
    --accent-blue: #38bdf8;
    --text-main: #f0f6fc;
    --text-dim: #8b949e;
    --border: rgba(255, 255, 255, 0.08);
    /* Fainter border */
    --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Smoother, more "premium" ease */
}

/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    /* More complex background pattern */
    background-image:
        radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.1) 0%, transparent 50%),
        radial-gradient(var(--sidebar-bg) 1px, transparent 1px);
    background-size: 100% 100%, 30px 30px;
    background-attachment: fixed;
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

h1,
h2,
h3,
.logo {
    font-family: 'Rajdhani', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Dashboard Layout */
.dashboard {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile & Responsive Adjustments */
@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: 1fr;
        /* Single column layout */
    }

    .sidebar {
        position: fixed;
        left: -280px;
        /* Hide off-screen */
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 1000;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.5);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.active {
        left: 0;
        /* Slide in */
    }

    .sidebar-overlay {
        display: none;
        /* Add via JS if needed, or rely on distinct shadow */
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        display: block;
    }
}

/* Sidebar */
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.logo-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo span {
    color: var(--accent-red);
}

/* Hamburger & Close Buttons */
.hamburger-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    margin-right: 15px;
    display: none;
    /* Hidden on desktop */
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-blue);
}

.close-sidebar-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
    /* Only show on mobile */
}

@media (max-width: 1024px) {
    .hamburger-btn {
        display: flex;
    }

    .close-sidebar-btn {
        display: block;
    }
}

#nav-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 12px 15px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    border-left: 3px solid var(--accent-red);
    background: linear-gradient(90deg, rgba(255, 70, 85, 0.1), transparent);
}

/* Main Content Area */
.main-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-left {
    display: flex;
    align-items: center;
    /* gap: 20px; Removed to handle hamburger button spacing better */
}

/* Layout Split Wrapper */
.content-wrapper {
    display: flex;
    gap: 25px;
    /* Subtracts header size to fit screen perfectly */
    height: calc(100vh - 120px);
    /* CRITICAL: Allows inner divs to scroll */
    min-height: 0;
    padding: 0 2rem;
    /* Add side padding to the whole page wrapper */
    transition: var(--transition);
}

@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
        /* Stack vertically on mobile */
        padding: 0;
        height: auto;
        overflow-y: auto;
        /* Allow full page scroll on mobile */
    }

    .main-content {
        padding: 1rem;
        height: 100vh;
        overflow-y: auto;
    }

    /* Adjust scrolling for mobile - let the page scroll mainly */
    #data-container {
        overflow-y: visible;
        height: auto;
        padding-right: 0;
        /* Remove scrollbar gap compensation */
    }

    /* Hide details panel by default or make it a drawer? 
       For now, let's stack it at bottom or use the overlay logic.
       But the original CSS has .details-panel with fixed width.
    */
    .details-panel {
        width: 100%;
        margin-top: 20px;
        height: auto;
        min-height: 300px;
    }
}

/* Left Side: Data Grid */
/* style.css */

#data-container {
    flex: 1;
    display: grid;
    /* Spacing logic: Fits as many 300px cards as possible, then stretches them */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    grid-auto-rows: min-content;
    /* Prevents rows from stretching awkwardly */

    /* THE SPACING FIXES */
    gap: 20px;
    /* Space between cards */
    padding: 20px;
    /* Space between cards and the wall */

    /* SCROLLING FIXES */
    overflow-y: auto;
    height: 100%;
    /* Fills the wrapper exactly */
    align-content: start;
    /* Keeps items at the top */
}

/* Custom Scrollbar */
/* style.css */

#data-container::-webkit-scrollbar {
    width: 8px;
    /* Slightly wider for easier grabbing */
}

#data-container::-webkit-scrollbar-track {
    background: transparent;
    /* Cleaner look */
}

#data-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    border: 2px solid var(--bg-dark);
    /* Creates a "padding" effect around the bar */
}

#data-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* Right Side: Detail Panel */
.details-panel {
    width: 400px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 1.5rem;
    /* Add extra padding at the bottom to make room for the absolute text */
    padding-bottom: 4rem;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    /* CRITICAL: Anchors the absolute text inside */
    overflow: hidden;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

/* Add this NEW class for the status text */
.match-status {
    position: absolute;
    bottom: 1.5rem;
    /* Matches the card's padding */
    left: 1.5rem;
    /* Matches the card's padding */
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

/* Specific styling for when it is LIVE */
.match-status.is-live {
    color: var(--accent-red);
    text-transform: uppercase;
    animation: pulse-text 2s infinite;
}

.card:hover {
    border-color: var(--accent-red);
    transform: translateY(-3px);
    background: linear-gradient(135deg, rgba(255, 70, 85, 0.05) 0%, var(--card-bg) 100%);
}

/* Role Icon in Card */
.role-icon {
    font-size: 1.4rem;
    color: var(--text-dim);
    transition: var(--transition);
}

.card:hover .role-icon {
    color: var(--accent-red);
}

/* Role Badge in Detail Panel */
.role-badge {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.role-badge i {
    font-size: 1.5rem;
    color: var(--accent-red);
}

.role-badge span {
    font-size: 0.65rem;
    font-weight: 700;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 1px;
}

/* UI Elements */
.status-badge {
    background: rgba(255, 70, 85, 0.1);
    color: var(--accent-red);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    animation: pulse-animation 1.5s infinite;
}

@keyframes pulse-animation {
    0% {
        box-shadow: 0 0 0 0px rgba(255, 70, 85, 0.4);
    }

    100% {
        box-shadow: 0 0 0 10px rgba(255, 70, 85, 0);
    }
}

@keyframes pulse-text {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }

    100% {
        opacity: 1;
    }
}

.text-accent {
    color: var(--accent-red);
    font-weight: bold;
}

.text-dim {
    color: var(--text-dim);
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Empty State Styling */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-dim);
    text-align: center;
    gap: 15px;
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.3;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Brackets Styling */
.bracket-wrapper {
    display: flex;
    gap: 50px;
    padding: 20px;
}

/* --- HOME PAGE STYLES --- */

/* Grid Layout for Home */
.home-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    /* Hero takes 2/3, Player takes 1/3 */
    grid-template-rows: auto auto;
    gap: 25px;
    height: 100%;
}

/* Hero Card */
.hero-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(13, 17, 23, 0.95) 100%);
    border: 1px solid var(--border);
    border-radius: 32px;
    /* Large curves for hero */
    padding: 50px;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    /* Deep shadow */
}

.hero-content h1 {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #fff, var(--text-dim));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Action Buttons */
.action-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    font-size: 0.9rem;
}

.action-btn.primary {
    background: var(--accent-red);
    color: white;
    border: none;
}

.action-btn.primary:hover {
    background: #d63a46;
}

.action-btn.secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Spotlight Card (Top Player) */
.spotlight-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
    grid-column: 2;
    /* Right column */
    grid-row: 1 / span 2;
    /* Spans down */
    display: flex;
    flex-direction: column;
}

.avatar-circle {
    width: 100px;
    height: 100px;
    background: var(--bg-dark);
    border: 3px solid var(--accent-red);
    border-radius: 50%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: var(--text-dim);
}

.stat-badge {
    background: rgba(255, 70, 85, 0.1);
    color: var(--accent-red);
    padding: 10px;
    border-radius: 8px;
    display: inline-block;
    margin-top: 15px;
}


/* --- Add to style.css --- */

/* Live Score on Card */
.live-score {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-red);
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 70, 85, 0.3);
}

/* Lineup Styling in Details */
.lineup-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.lineup-team h4 {
    margin-bottom: 10px;
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.player-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.player-row i {
    color: var(--accent-blue);
    font-size: 0.8rem;
}

/* Tournament Meta Badges */
.meta-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 5px;
}

.meta-badge.prize {
    color: #fbbf24;
}

/* Gold color */
.meta-badge.tier {
    color: #a8a29e;
}


/* News Section */
.news-section {
    grid-column: 1;
    /* Left column */
    background: var(--card-bg);
    /* Or transparent */
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border);
}


.news-item {
    display: flex;
    gap: 20px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

.news-item:last-child {
    border-bottom: none;
}

.news-date {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--accent-blue);
    min-width: 80px;
    padding-top: 4px;
}

.news-content h4 {
    margin-bottom: 5px;
    font-size: 1.1rem;
}

/* Filter Dropdown */
.filter-dropdown {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    min-width: 200px;
    transition: var(--transition);
    appearance: none;
    /* Remove default arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.filter-dropdown:hover {
    border-color: var(--accent-blue);
    background-color: rgba(255, 255, 255, 0.02);
}

.filter-dropdown:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 40px;
}

.match-node {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 15px;
    width: 220px;
    border-radius: 8px;
    position: relative;
}

.match-node.winner {
    border-left: 4px solid var(--accent-red);
}

/* Sidebar Footer */
.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-dim);
}

#clock {
    color: var(--text-main);
    font-weight: bold;
}

/* Add to style.css */

.profile-container {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 40px;
    background: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.profile-avatar-lg {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--accent-red);
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    text-align: center;
    padding: 20px;
}

.profile-actions {
    display: flex;
    justify-content: center;
}


@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Add to bottom of style.css --- */

/* Responsive Twitch Embed (16:9 Aspect Ratio) */
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Player Config Grid */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.config-item {
    background: var(--bg-dark);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.config-item span {
    color: var(--text-dim);
    font-size: 0.75rem;
}

/* Crosshair Code Box */
.code-box {
    background: var(--bg-dark);
    padding: 10px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--accent-blue);
    margin-top: 5px;
    word-break: break-all;
    border: 1px dashed var(--border);
}

/* Copy Button */
.copy-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: bold;
}

.copy-btn:hover {
    color: var(--text-main);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Match Card Layout Fixes */
.match-grid {
    display: grid;
    /* 3 Columns: 1fr (Team A) | auto (VS) | 1fr (Team B) */
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    /* Safe space around the VS text */
    align-items: center;
    margin: 15px 0;
}

.team-name {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
    /* Optional: prevents super long names from breaking layout */
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.vs-badge {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 6px;
}

/* --- RESULTS LIST VIEW (Compact) --- */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.result-row {
    display: grid;
    /* Layout: Team A (Right align) | Score | Team B (Left align) | Event Info */
    grid-template-columns: 1fr 100px 1fr 200px; 
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 15px 20px;
    border-radius: 8px;
    transition: var(--transition);
}

.result-row:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--text-dim);
    transform: translateX(5px);
}

.score-box {
    text-align: center;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

/* Colors for Win/Loss */
.score-win { color: #4ade80; text-shadow: 0 0 10px rgba(74, 222, 128, 0.2); }
.score-loss { color: #f87171; }
.score-draw { color: var(--text-dim); }

.team-a { text-align: right; font-weight: 600; color: var(--text-main); }
.team-b { text-align: left; font-weight: 600; color: var(--text-main); }

.event-col {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-dim);
    border-left: 1px solid var(--border);
    padding-left: 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bo-badge {
    display: inline-block;
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    width: fit-content;
    align-self: flex-end;
}

/* Mobile fix for rows */
@media (max-width: 768px) {
    .result-row {
        grid-template-columns: 1fr auto 1fr;
        grid-template-rows: auto auto;
        gap: 10px;
        padding: 15px;
    }
    .event-col {
        grid-column: 1 / -1;
        grid-row: 2;
        border-left: none;
        border-top: 1px solid var(--border);
        padding-left: 0;
        padding-top: 10px;
        text-align: center;
        align-items: center;
    }
    .bo-badge { align-self: center; }
}