@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Google Material Design 3 Tokens - Light Theme Default */
    --md-sys-color-primary: #0061a4;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #d1e4ff;
    --md-sys-color-on-primary-container: #001d36;
    
    --md-sys-color-secondary: #535f70;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #d7e3f7;
    --md-sys-color-on-secondary-container: #101c2b;
    
    --md-sys-color-tertiary: #6b5778;
    --md-sys-color-on-tertiary: #ffffff;
    --md-sys-color-tertiary-container: #f2daff;
    --md-sys-color-on-tertiary-container: #251432;
    
    --md-sys-color-error: #ba1a1a;
    --md-sys-color-on-error: #ffffff;
    --md-sys-color-error-container: #ffdad6;
    --md-sys-color-on-error-container: #410002;
    
    --md-sys-color-background: #fdfcff;
    --md-sys-color-on-background: #1a1c1e;
    
    --md-sys-color-surface: #fdfcff;
    --md-sys-color-on-surface: #1a1c1e;
    --md-sys-color-surface-variant: #dfe2eb;
    --md-sys-color-on-surface-variant: #43474e;
    
    --md-sys-color-outline: #73777f;
    --md-sys-color-outline-variant: #c3c7d0;
    
    /* Surface Containers for MD3 */
    --md-sys-color-surface-container-lowest: #ffffff;
    --md-sys-color-surface-container-low: #f7f9ff;
    --md-sys-color-surface-container: #f1f3f9;
    --md-sys-color-surface-container-high: #ebeef4;
    --md-sys-color-surface-container-highest: #e0e2e9;
    
    /* Elevation layers */
    --md-sys-elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
    --md-sys-elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.3);
    --md-sys-elevation-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.15), 0px 1px 3px 0px rgba(0, 0, 0, 0.3);
    
    /* Shapes */
    --md-sys-shape-corner-extra-small: 4px;
    --md-sys-shape-corner-small: 8px;
    --md-sys-shape-corner-medium: 12px;
    --md-sys-shape-corner-large: 16px;
    --md-sys-shape-corner-extra-large: 28px;
    --md-sys-shape-corner-full: 9999px;
    
    --transition-fast: 0.15s cubic-bezier(0.2, 0, 0, 1);
    --transition-standard: 0.25s cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Google Material Design 3 Tokens - Dark Gamer Theme */
        --md-sys-color-primary: #9ecaff;
        --md-sys-color-on-primary: #003258;
        --md-sys-color-primary-container: #00497d;
        --md-sys-color-on-primary-container: #d1e4ff;
        
        --md-sys-color-secondary: #bbc7db;
        --md-sys-color-on-secondary: #253140;
        --md-sys-color-secondary-container: #3b4858;
        --md-sys-color-on-secondary-container: #d7e3f7;
        
        --md-sys-color-tertiary: #d6bee4;
        --md-sys-color-on-tertiary: #3b2948;
        --md-sys-color-tertiary-container: #523f5f;
        --md-sys-color-on-tertiary-container: #f2daff;
        
        --md-sys-color-error: #ffb4ab;
        --md-sys-color-on-error: #690005;
        --md-sys-color-error-container: #93000a;
        --md-sys-color-on-error-container: #ffdad6;
        
        --md-sys-color-background: #0f1115; /* Slate Gamer background */
        --md-sys-color-on-background: #e2e2e6;
        
        --md-sys-color-surface: #141822; /* Pure MD3 Dark Surface */
        --md-sys-color-on-surface: #e2e2e6;
        --md-sys-color-surface-variant: #43474e;
        --md-sys-color-on-surface-variant: #c3c7d0;
        
        --md-sys-color-outline: #8d9199;
        --md-sys-color-outline-variant: #43474e;
        
        --md-sys-color-surface-container-lowest: #0c0d12;
        --md-sys-color-surface-container-low: #181d28;
        --md-sys-color-surface-container: #202636;
        --md-sys-color-surface-container-high: #2a3144;
        --md-sys-color-surface-container-highest: #353d53;
    }
}

/* Reset & Base HTML Rules */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    transition: background-color var(--transition-standard), color var(--transition-standard);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--md-sys-color-outline);
}

/* Layout App Shell */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Google MD3 Navigation Drawer */
.md-navigation-drawer {
    width: 290px;
    background-color: var(--md-sys-color-surface-container-low);
    border-right: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    padding: 2.5rem 1.25rem;
    z-index: 100;
    transition: var(--transition-standard);
}

.md-drawer-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    padding-left: 0.75rem;
}

.md-drawer-header .logo-icon {
    font-size: 2.25rem;
    color: var(--md-sys-color-primary);
}

.md-drawer-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--md-sys-color-on-background);
    letter-spacing: -0.04em;
    text-transform: uppercase;
}

.md-drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

/* MD3 Drawer Item specs (Pill shape) */
.md-drawer-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    border-radius: var(--md-sys-shape-corner-full);
    font-weight: 600;
    font-size: 0.925rem;
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.md-drawer-item i, 
.md-drawer-item .material-symbols-outlined {
    font-size: 1.4rem;
    color: var(--md-sys-color-on-surface-variant);
    transition: var(--transition-fast);
}

.md-drawer-item:hover {
    background-color: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
}

.md-drawer-item.active {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.md-drawer-item.active i,
.md-drawer-item.active .material-symbols-outlined {
    color: var(--md-sys-color-on-primary-container);
}

.md-drawer-footer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    padding-top: 1.5rem;
}

/* Main Content Wrapper */
.main-content {
    flex: 1;
    margin-left: 290px;
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition-standard);
}

/* MD3 Top App Bar */
.md-top-app-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.md-top-app-bar .page-title-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.md-top-app-bar h2 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--md-sys-color-on-background);
}

/* Profile Pill component */
.md-profile-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    padding-right: 1.25rem;
    background-color: var(--md-sys-color-surface-container-high);
    border-radius: var(--md-sys-shape-corner-full);
    border: 1px solid var(--md-sys-color-outline-variant);
    cursor: pointer;
    transition: var(--transition-fast);
}

.md-profile-pill:hover {
    background-color: var(--md-sys-color-surface-container-highest);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.md-profile-pill .avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--md-sys-shape-corner-full);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--md-sys-color-on-primary);
    background-color: var(--md-sys-color-primary);
    border: 2px solid var(--md-sys-color-outline-variant);
}

.md-profile-pill img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.md-profile-pill .info {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.md-profile-pill .name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
}

.md-profile-pill .role {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--md-sys-color-primary);
    margin-top: 1px;
}

/* Mobile Bottom Navigation */
.md-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    background-color: var(--md-sys-color-surface-container-high);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    z-index: 999;
    justify-content: space-around;
    align-items: center;
    padding: 0 1rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.md-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.725rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    flex: 1;
    padding: 0.4rem 0;
    transition: var(--transition-fast);
}

.md-bottom-nav .nav-item .icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 32px;
    border-radius: var(--md-sys-shape-corner-full);
    transition: var(--transition-fast);
}

.md-bottom-nav .nav-item i,
.md-bottom-nav .nav-item .material-symbols-outlined {
    font-size: 1.35rem;
}

.md-bottom-nav .nav-item:hover {
    color: var(--md-sys-color-on-surface);
}

.md-bottom-nav .nav-item.active {
    color: var(--md-sys-color-on-surface);
}

.md-bottom-nav .nav-item.active .icon-wrapper {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

/* Mobile Drawer Backdrop */
.md-drawer-backdrop {
    display: none;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.md-drawer-backdrop.active {
    display: block;
    opacity: 1;
}

/* MD3 Responsive Layout Rules */
@media (max-width: 1024px) {
    .md-navigation-drawer {
        transform: translateX(-100%);
        display: flex !important;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 290px;
        z-index: 10000;
        transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
        box-shadow: 0 16px 32px rgba(0, 0, 0, 0.3);
    }
    
    .md-navigation-drawer.drawer-open {
        transform: translateX(0);
    }
    
    #mobile-menu-toggle {
        display: flex !important;
    }
    
    .md-profile-pill {
        display: none !important;
    }
    
    .md-top-app-bar h2 {
        font-size: 1.45rem !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 1.5rem 1.5rem 6.5rem 1.5rem !important;
    }
    
    .md-bottom-nav {
        display: flex !important;
    }
}

@media (min-width: 1025px) {
    .md-navigation-drawer {
        transform: translateX(0);
        display: flex !important;
    }
    
    .md-bottom-nav {
        display: none !important;
    }
}

/* Dashboard Sections Visibility Control */
.dashboard-section {
    display: none !important;
}

.dashboard-section.active {
    display: block !important;
}

/* Custom 2-column grid layout for Torneios section */
@media (min-width: 1024px) {
    .tournaments-layout-grid {
        display: grid !important;
        grid-template-columns: 5fr 7fr !important;
        gap: 2rem !important;
        align-items: start !important;
    }
}
