@import url('tokens.css');
@import url('animations.css');

/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Tokens */
:root {
    --primary-color: var(--color-primary);
    --primary-hover: #0b1220;
    --secondary-color: #9ca3af;
    --accent-color: var(--color-accent);
    --success-color: var(--color-success);
    --warning-color: var(--color-warning);
    --white: var(--color-bg);
    --surface: var(--color-surface);
    --text-color: var(--color-text);
    --text-light: var(--color-text-muted);
    --border-color: var(--color-border);
    --radius-md: var(--radius-3);
    --radius-lg: var(--radius-5);
    --shadow-sm: var(--shadow-sm);
    --shadow: var(--shadow-md);
    --shadow-hover: var(--shadow-lg);
    --sp-1: var(--space-2);
    --sp-2: var(--space-3);
    --sp-3: var(--space-4);
    --sp-4: var(--space-5);
    --sp-5: var(--space-6);
    --font-sans: var(--font-family-sans);
    --transition-fast: var(--duration-fast);
    --transition: var(--duration);
    --nav-tab-width: clamp(110px, 12vw, 160px);
    --nav-tab-gap: 0.5rem;
}

/* Base Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translate3d(0, 20px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Base */
body { 
    margin: 0; 
    font-family: var(--font-sans); 
    background-color: var(--color-surface); 
    background-image: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%); 
    min-height: 100vh; 
    color: var(--text-color); 
    line-height: var(--line-height-body); 
    transition: background-color var(--transition) ease, color var(--transition) ease; 
}

h1, h2, h3, h4, h5, h6 { 
    font-weight: 800; 
    color: var(--primary-color); 
    line-height: var(--line-height-heading); 
    margin-bottom: 0.75em; 
    letter-spacing: -0.025em;
}
h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }
h4 { font-size: 1.25rem; }

/* Animation Classes */
.animate-fade-in-up { animation: fadeInUp 0.5s ease-out forwards; }
.animate-fade-in { animation: fadeIn 0.4s ease-out forwards; }

/* Staggered Animation for Grid Items */
.grid > * { animation: fadeInUp 0.5s ease-out forwards; opacity: 0; }
.grid > *:nth-child(1) { animation-delay: 0.1s; }
.grid > *:nth-child(2) { animation-delay: 0.2s; }
.grid > *:nth-child(3) { animation-delay: 0.3s; }
.grid > *:nth-child(4) { animation-delay: 0.4s; }
.grid > *:nth-child(5) { animation-delay: 0.5s; }
.grid > *:nth-child(6) { animation-delay: 0.6s; }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Page Tabs (Custom for Teams Page) */
.page-tabs-container {
    border-bottom: 2px solid var(--border-color);
    margin-bottom: var(--sp-4);
    display: flex;
    gap: var(--sp-4);
}

.page-tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: var(--sp-2) var(--sp-1);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -2px; /* Overlap border */
}

.page-tab-btn:hover {
    color: var(--primary-color);
}

.page-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content-panel {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content-panel.active {
    display: block;
}

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.mt-3 { margin-top: var(--sp-4); }
.mb-3 { margin-bottom: var(--sp-4); }
.gap-2 { gap: var(--sp-3); }

/* ===========================
   NAVBAR
   =========================== */
.navbar {
    /* Base opacity */
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    
    /* SPECIFIC DARK BLUE REQUESTED (RGB: 20, 41, 73 -> HEX: #142949) */
    background: #142949 !important;
    background: linear-gradient(135deg, #142949 0%, #10223d 100%) !important;
    
    /* Floating Island Positioning */
    width: 96%;
    max-width: none;
    margin: 1rem auto 2rem auto;
    border-radius: 24px;
    top: 1rem;
    
    /* Enhanced Border & Shadow */
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 20px 40px -5px rgba(20, 41, 73, 0.4),
        0 8px 16px -4px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
        
    padding: 0.75rem 2rem;
    position: sticky;
    z-index: 1000;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--sp-2);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Force text to be white in the specific dark blue navbar */
.navbar-brand, 
.navbar-navigation a, 
.user-info,
.nav-scroll-btn {
    color: #ffffff !important;
}

.navbar-navigation a {
    color: rgba(255, 255, 255, 0.85) !important;
}

.navbar-navigation a:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.15) !important;
}

/* Active tab style for Specific Dark Blue Navbar */
.navbar-navigation .active,
.navbar-navigation a.active:hover,
.navbar-navigation .active:focus { 
    background: #ffffff !important;
    color: #142949 !important; /* Specific Dark Blue text on white background */
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Dark Mode Floating Navbar - Consistent Specific Dark Blue */
body[data-theme="dark"] .navbar {
    /* Keep the same specific blue in dark mode as requested, maybe slightly darker gradient end */
    background: linear-gradient(135deg, #142949 0%, #0d1b30 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

/* Mobile Reset */
@media (max-width: 768px) {
    .navbar {
        width: 100%;
        max-width: 100%;
        margin: 0;
        top: 0;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        padding: var(--sp-2) var(--sp-3);
        background: rgba(255, 255, 255, 0.95);
    }
    body[data-theme="dark"] .navbar {
        border-bottom: 1px solid rgba(255,255,255,0.08);
        background: rgba(15, 23, 42, 0.95);
    }
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    justify-self: start;
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

body[data-theme="dark"] .navbar-brand {
    color: var(--white);
    background: none;
    -webkit-text-fill-color: initial;
}

.navbar-brand:hover { opacity: 0.8; }

.navbar-navigation {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex: 1;
    min-width: 0;
    justify-self: center;
    width: 100%;
    justify-content: center;
}
.navbar-tabs-container { display: flex; align-items: center; gap: var(--sp-1); justify-content: center; flex: 1; min-width: 0; }
.navbar-tabs-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    width: calc((var(--nav-tab-width) * 4) + (var(--nav-tab-gap) * 3));
    max-width: 100%;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
}
.navbar-tabs-viewport::-webkit-scrollbar { display: none; }
.navbar-tabs-viewport.is-dragging { cursor: grabbing; }
.navbar-tabs {
    display: flex;
    list-style: none;
    gap: var(--nav-tab-gap);
    padding: 0;
    margin: 0;
    white-space: nowrap;
    scroll-behavior: smooth;
}
.navbar-tabs li { flex: 0 0 auto; }
.navbar-tabs a {
    width: var(--nav-tab-width);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-light); /* Gray in light mode */
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.6rem 1rem;
    border-radius: 99px;
    font-size: 0.95rem;
}

body[data-theme="dark"] .navbar-tabs a {
    color: rgba(255, 255, 255, 0.7);
}

.navbar-navigation a:hover { 
    background: rgba(0, 0, 0, 0.04); 
    color: var(--primary-color); 
    transform: translateY(-1px);
}

body[data-theme="dark"] .navbar-navigation a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

/* FIX: Ensure active tab is always visible and overrides hover styles */
.navbar-navigation .active,
.navbar-navigation a.active:hover,
.navbar-navigation .active:focus { 
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    color: #ffffff !important; 
    font-weight: 700;
    box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.4);
    transform: translateY(0);
}

/* Ensure active text is white in both modes */
body[data-theme="dark"] .navbar-navigation .active {
    color: #fff !important;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
}

.navbar-menu { display: none; }

.user-info {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    color: var(--text-color); /* Dark text in light mode */
    justify-self: end;
    flex-shrink: 0;
}

body[data-theme="dark"] .user-info {
    color: var(--white);
}
.user-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0f2fe 0%, #7dd3fc 100%);
    color: #0369a1;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}
.user-avatar:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2), 0 0 0 4px rgba(255, 255, 255, 0.15);
}
.nav-scroll-btn {
    background: rgba(255, 255, 255, 0.10);
    border: none;
    color: var(--white);
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast);
    flex-shrink: 0; opacity: 0; pointer-events: none; position: relative; z-index: 1;
}
.nav-scroll-btn.visible { opacity: 1; pointer-events: auto; }
.nav-scroll-btn:hover { background: rgba(255, 255, 255, 0.18); transform: scale(1.08); }
.nav-scroll-btn.prev { left: auto; }
.nav-scroll-btn.next { right: auto; }
.nav-scroll-btn .ti { display: none; }
.nav-scroll-btn::before {
    content: "";
    display: inline-block;
    width: 22px;
    height: 22px;
    background-color: currentColor;
}
.nav-scroll-btn.prev::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23000' d='M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23000' d='M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
}
.nav-scroll-btn.next::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23000' d='M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23000' d='M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
}

/* Notifications (header) */
.notification-bell {
    position: relative; background: transparent; border: none; color: var(--white);
    width: 42px; height: 42px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background var(--transition-fast);
}
.notification-bell:hover { background: rgba(255, 255, 255, 0.12); }
.notification-bell:active {
    animation: bell-ring 0.4s ease-in-out;
}

@keyframes bell-ring {
    0% { transform: rotate(0); }
    20% { transform: rotate(15deg); }
    40% { transform: rotate(-15deg); }
    60% { transform: rotate(10deg); }
    80% { transform: rotate(-10deg); }
    100% { transform: rotate(0); }
}

.notification-badge {
    position: absolute; top: -2px; right: -2px;
    min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
    background: var(--accent-color); color: #fff; font-size: 12px; font-weight: 700; line-height: 18px; text-align: center;
    box-shadow: var(--shadow-sm);
}

/* ===========================
   CONTAINERS & CARDS
   =========================== */
.container { width: 100%; max-width: none; margin: 0; padding: 0 clamp(20px, 5vw, 60px); }

.auth-container, .dashboard-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: var(--sp-5);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--sp-5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.dashboard-container:hover { transform: translateY(-4px); box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }

.card {
    background: var(--white);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.3s ease;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
}
.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.1rem;
    background: rgba(248, 250, 252, 0.5);
}
.card-body { padding: 1.5rem; }
.card-footer {
    margin-top: 0;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(248, 250, 252, 0.5);
}

/* Titles */
.page-title {
    font-size: 2.5rem; 
    font-weight: 800; 
    color: var(--primary-color);
    margin-bottom: 2rem; 
    text-align: center; 
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.section-title {
    font-size: 1.75rem; 
    font-weight: 700; 
    color: var(--primary-color);
    margin-bottom: 1.5rem; 
    padding-bottom: 0.5rem;
    border-bottom: none;
    position: relative;
    display: inline-block;
}
.section-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 60px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 2px;
}

/* ===========================
   FORMS
   =========================== */
.form-group { margin-bottom: 1.5rem; }
.form-group label { 
    display: block; 
    margin-bottom: 0.5rem; 
    font-weight: 600; 
    color: var(--text-color);
    font-size: 0.95rem;
}
.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    background-color: var(--white);
    transition: all 0.2s ease;
    color: var(--text-color);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}
.form-control.error { border-color: var(--accent-color); }
.error-message { color: var(--accent-color); font-size: 0.875rem; margin-top: var(--sp-2); display: block; }

/* ===========================
   BUTTONS
   =========================== */
.btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    border-radius: 9999px; /* Pill shape for modern look */
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    user-select: none;
    letter-spacing: 0.01em;
}
.btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }
.btn-block { width: 100%; display: flex; }

.btn-primary { 
    background: var(--primary-color);
    color: var(--white); 
    border: 1px solid rgba(255,255,255,0.1);
}
.btn-primary:hover { 
    background: #0f172a; /* Slightly darker than primary */
    transform: translateY(-2px); 
    box-shadow: var(--shadow-md); 
}

.btn-secondary { 
    background: var(--white); 
    color: var(--text-color); 
    border: 1px solid var(--border-color);
}
.btn-secondary:hover { 
    background: var(--color-surface); 
    border-color: var(--text-muted);
    transform: translateY(-2px); 
    box-shadow: var(--shadow-md); 
}

.btn-success { 
    background: var(--color-success); 
    color: var(--white); 
}
.btn-success:hover { 
    filter: brightness(110%);
    transform: translateY(-2px); 
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); 
}

.btn-danger { 
    background: var(--color-danger); 
    color: var(--white); 
}
.btn-danger:hover { 
    filter: brightness(110%);
    transform: translateY(-2px); 
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); 
}

.btn-sm { 
    padding: 0.4rem 0.875rem; 
    font-size: 0.85rem; 
}

.btn-lg { 
    padding: 1rem 2rem; 
    font-size: 1.125rem; 
}
.btn-icon { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }

/* ===========================
   TABLES
   =========================== */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.table thead { background: var(--primary-color); color: var(--white); }
.table th, .table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border-color); }
.table tbody tr:nth-child(even) { background-color: rgba(0, 50, 98, 0.03); }
.table tbody tr:hover { background-color: rgba(0, 50, 98, 0.06); }
.table thead.sticky { position: sticky; top: 0; z-index: 1; }

/* ===========================
   GRID
   =========================== */
.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-5 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid-6 { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

/* ===========================
   STATS
   =========================== */
/* ===========================
   NEW TOURNAMENT LAYOUT (tu- prefix)
   =========================== */
.tu-layout-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.tu-page-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3rem;
}

.tu-page-headline {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0;
    letter-spacing: -0.02em;
}

.tu-btn-create {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s, transform 0.2s;
    font-size: 1rem;
}

.tu-btn-create:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.tu-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
}

.tu-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 2rem;
}

@media (min-width: 768px) {
    .tu-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .tu-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.tu-card {
    background: var(--white);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.tu-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.1);
}

.tu-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.tu-card-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    background: rgba(0, 50, 98, 0.08);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.tu-status {
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tu-status.approved {
    background: #d1fae5;
    color: #065f46;
}

.tu-status.ongoing {
    background: #dbeafe;
    color: #1e40af;
}

.tu-card-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.tu-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.tu-card-meta i {
    font-size: 1.1rem;
    opacity: 0.8;
}

.tu-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 1.25rem 0;
}

.tu-dates {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.tu-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
}

.tu-btn {
    flex: 1;
    padding: 0.75rem;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tu-btn-primary {
    background: var(--primary-color);
    color: white;
}

.tu-btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 6px rgba(0, 50, 98, 0.2);
}

.tu-btn-danger {
    background: var(--color-danger);
    color: white;
}

.tu-btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.2);
}

.tu-btn-secondary {
    background: #f8fafc;
    color: var(--primary-color);
    border: 1px solid #e2e8f0;
}

.tu-btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Dark mode overrides for TU components */
body[data-theme="dark"] .tu-card {
    background: var(--surface);
    border-color: var(--border-color);
}

body[data-theme="dark"] .tu-title,
body[data-theme="dark"] .tu-section-header,
body[data-theme="dark"] .tu-card-title {
    color: var(--text-color);
}

body[data-theme="dark"] .tu-btn-secondary {
    background: #1e293b;
    color: #e5e7eb;
    border-color: #334155;
}

body[data-theme="dark"] .tu-btn-secondary:hover {
    background: #334155;
}

body[data-theme="dark"] .tu-card-icon {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary-color);
}

body[data-theme="dark"] .tu-divider {
    background: var(--border-color);
}
/* ===========================
   MODALS
   =========================== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    inset: 0;
    background: rgba(0, 50, 98, 0.68);
    backdrop-filter: blur(4px);
}
.modal.active { display: flex; align-items: center; justify-content: center; }
.modal-content {
    background: var(--white);
    padding: var(--sp-5);
    border-radius: var(--radius-lg);
    max-width: 560px; width: 92%; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    border-top: 5px solid var(--primary-color);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-3); padding-bottom: var(--sp-2); border-bottom: 2px solid var(--border-color); }
.modal-title { font-size: 1.5rem; font-weight: 700; color: var(--primary-color); }
.close { font-size: 1.75rem; cursor: pointer; color: var(--color-danger); transition: color var(--transition-fast); }
.close:hover { color: #c0392b; }

/* ===========================
   ABOUT SECTION (Footer Pre-section)
   =========================== */
.tu-about-section {
    background-color: var(--surface); /* Light background using theme variable */
    padding: 4rem 1rem;
    font-family: inherit;
    color: var(--text-color);
    border-top: 1px solid var(--border-color);
}

.tu-container { width: 100%; max-width: none; margin: 0; padding: 0 clamp(20px, 3vw, 40px); }

.tu-header {
    text-align: center;
    margin-bottom: 3rem;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

.tu-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color); /* Using theme primary color */
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.tu-subtitle {
    font-size: 1.125rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* Grid Layout */
.tu-grid-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Left Column */
.tu-col-vision {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.tu-image {
    width: 100%;
    height: 300px; /* Limit height */
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.tu-info-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}

.tu-info-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.tu-vision-card .tu-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.75rem;
}

.tu-vision-card .tu-card-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--accent-color); /* Using theme accent color */
    border-radius: 2px;
}

.tu-card-text p {
    margin-bottom: 1rem;
    line-height: 1.7;
    font-size: 0.95rem;
}

.tu-card-text p:last-child {
    margin-bottom: 0;
}

/* Right Column: Mission Grid */
.tu-grid-mission {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.tu-mission-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.tu-icon-box {
    width: 48px;
    height: 48px;
    background: rgba(231, 76, 60, 0.1); /* Light version of accent color #e74c3c */
    color: var(--accent-color); /* Orange/Red accent */
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.tu-icon-box svg {
    width: 24px;
    height: 24px;
}

.tu-mission-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.tu-mission-text {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 1024px) {
    .tu-grid-main {
        grid-template-columns: 1fr; /* Stack columns on tablet */
    }
    .tu-image {
        height: 250px;
    }
}

@media (max-width: 640px) {
    .tu-grid-mission {
        grid-template-columns: 1fr; /* Stack mission cards on mobile */
    }
    .tu-title {
        font-size: 1.75rem;
    }
    .tu-about-section {
        padding: 3rem 1rem;
    }
}

/* Dark Mode for About Section */
body[data-theme="dark"] .tu-about-section {
    background-color: #0f172a;
    border-top-color: #1e293b;
    color: #f1f5f9;
}

body[data-theme="dark"] .tu-title {
    color: #f1f5f9;
}

body[data-theme="dark"] .tu-subtitle {
    color: #94a3b8;
}

body[data-theme="dark"] .tu-info-card {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}
body[data-theme="dark"] .tu-mission-card {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body[data-theme="dark"] .tu-vision-card .tu-card-title,
body[data-theme="dark"] .tu-mission-title {
    color: #f1f5f9;
}

body[data-theme="dark"] .tu-mission-text,
body[data-theme="dark"] .tu-card-text p {
    color: #cbd5e1;
}

body[data-theme="dark"] .tu-icon-box {
    background-color: rgba(231, 76, 60, 0.2);
}

/* ===========================
   FOOTER
   =========================== */
.site-footer {
    background: #0F172A; /* Dark Slate */
    color: #F1F5F9;
    padding: var(--sp-5) 0 var(--sp-3);
    margin-top: auto; /* Push to bottom if flex column */
    font-size: 0.95rem;
    border-top: 2px solid rgba(255,255,255,0.08);
    box-shadow: 0 -8px 24px rgba(0,0,0,0.35);
}
.footer-container { width: 100%; max-width: none; margin: 0; padding: 0 clamp(20px, 3vw, 40px); }
.footer-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-5);
    margin-bottom: var(--sp-5);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: var(--sp-5);
}
.footer-col {
    flex: 1;
    min-width: 200px;
}
.footer-col.about { flex: 1.5; }

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.footer-logo-img { height: 40px; }
.footer-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
}
.footer-desc {
    color: #94A3B8;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    max-width: 320px;
}

.footer-col h4 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
    position: relative;
    padding-bottom: 0.5rem;
}
.footer-col h4::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 3px;
    background: var(--accent-color);
    border-radius: 2px;
}

.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 0.75rem; }

body[data-theme="dark"] .site-footer {
    background: #0a0f1a;
    border-top: 1px solid #1e293b;
    box-shadow: 0 -12px 28px rgba(0,0,0,0.6);
}
.footer-col ul li a {
    color: #CBD5E1;
    text-decoration: none;
    transition: color 0.2s, padding-left 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.footer-col ul li a:hover {
    color: #fff;
    padding-left: 5px;
}
.footer-col ul li i { color: var(--accent-color); font-size: 1.1em; }



.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    color: #64748B;
    font-size: 0.85rem;
}
.footer-version { display: flex; align-items: center; gap: 0.5rem; }
.footer-version .dot { width: 4px; height: 4px; background: #64748B; border-radius: 50%; }
.scroll-top { color: #94A3B8; text-decoration: none; transition: color 0.2s; display: inline-flex; align-items: center; gap: 0.25rem; }
.scroll-top:hover { color: #fff; }

@media (max-width: 768px) {
    .footer-row { flex-direction: column; gap: 2rem; }
    .footer-bottom { flex-direction: column; text-align: center; }
}

/* ===========================
   ALERTS
   =========================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-4);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    border-left: 5px solid currentColor;
}
.alert-success { background: #D1FAE5; color: #15803D; }
.alert-error { background: #FEE2E2; color: #B91C1C; }
.alert-warning { background: #FEF3C7; color: #B45309; }
.alert-info { background: #DBEAFE; color: #1D4ED8; }
.alert::before {
    content: "";
    display: inline-block;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.25;
}

/* ===========================
   CALENDAR/TIMELINE (base)
   =========================== */
.calendar-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.calendar-nav-meta { flex: 1; min-width: 220px; text-align: center; }
.timeline::before { background: var(--primary-color); }
.timeline-item::before { background: var(--primary-color); }

/* ===========================
   TOURNAMENT BRACKET (base)
   =========================== */
.bracket { display: flex; gap: var(--sp-3); overflow-x: auto; padding-bottom: var(--sp-2); }
.bracket-round { min-width: 220px; display: flex; flex-direction: column; gap: 0.75rem; }
.bracket-round-title { font-weight: 700; color: var(--primary-color); padding: 0.25rem 0.25rem 0; }
.match-card { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow); padding: 0.75rem; display: flex; flex-direction: column; gap: var(--sp-2); }
.match-team { padding: 0.5rem 0.6rem; background: rgba(0, 50, 98, 0.06); border-radius: var(--radius-md); font-weight: 600; }
.match-team.winner { background: rgba(39, 174, 96, 0.14); }
.match-footer { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.tournament-match-row { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border-color); align-items: center; }
.tournament-match-row:last-child { border-bottom: none; }
.match-card.pending { border-left: 6px solid #f59e0b; }

.tournament-completed .card-body { border-left: 6px solid #27ae60; }
.tournament-winner { font-size: 1.125rem; color: #27ae60; }
.tournament-winner .trophy { margin-left: .25rem; }

/* ===========================
   LOADING
   =========================== */
.loading {
    display: inline-block; width: 40px; height: 40px;
    border: 4px solid #E5E7EB; border-top-color: var(--primary-color);
    border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 1024px) {
    .container { padding: var(--sp-4) var(--sp-3); }
}
@media (max-width: 768px) {
    .navbar { display: flex; flex-wrap: wrap; padding: var(--sp-3) var(--sp-3); }
    .user-info { margin-top: var(--sp-2); }
    .grid, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .container { padding: var(--sp-3) var(--sp-2); }
    .dashboard-container, .auth-container { padding: var(--sp-4); }
}

/* Dashboard Layout */
.dashboard-split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--sp-4);
    margin-bottom: var(--sp-4);
}

@media (max-width: 1024px) {
    .dashboard-split {
        grid-template-columns: 1fr;
    }
}

/* Upcoming events always-open list */
.upcoming-panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--sp-2);
    border: 1px solid rgba(0,0,0,0.05);
}
.upcoming-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    height: 400px;
    overflow-y: auto;
    padding: var(--sp-1);
    scrollbar-width: thin;
    scrollbar-color: var(--secondary-color) transparent;
}
.upcoming-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3);
    border-radius: var(--radius-md);
    background: var(--white);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}
.upcoming-item:hover,
.upcoming-item:focus-within {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
    background: #fff;
    z-index: 1;
}
.upcoming-title {
    font-weight: 800;
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
    letter-spacing: -0.01em;
}
.upcoming-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 500;
}
.upcoming-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}
.upcoming-meta i {
    color: var(--accent-color);
    font-size: 1rem;
}
.upcoming-time {
    white-space: nowrap;
}
.upcoming-location {
    white-space: nowrap;
}
@media (max-width: 768px) {
    .upcoming-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sp-2);
    }
    .upcoming-item .badge {
        align-self: flex-start;
    }
    .upcoming-list { height: 280px; }
}

/* AS Activities condensed component */
.as-list {
    display: grid;
    gap: var(--sp-2);
}
.as-list--cards {
    grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 1024px) { .as-list--cards { grid-template-columns: repeat(2, 1fr);} }
@media (max-width: 768px) { .as-list--cards { grid-template-columns: 1fr; } }
@media (max-width: 320px) { .as-list--cards { grid-template-columns: 1fr; } }
.as-list--list, .as-list--accordion {
    grid-template-columns: 1fr;
}
.as-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    will-change: transform;
    transform-origin: center;
    position: relative;
}
.as-item:hover,
.as-item:focus-within {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-color: var(--primary-color);
    background: #f8fafc;
    z-index: 1;
}
.as-item__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-height: 120px;
    padding: var(--sp-2) var(--sp-3);
}
.as-item__meta { min-width: 0; }
.as-item__title {
    font-weight: 700;
    color: var(--text-color);
    font-size: 1rem;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.as-item__subtitle {
    display: flex;
    gap: var(--sp-3);
    flex-wrap: wrap;
    color: var(--text-light);
    font-size: 0.9rem;
}
.as-item__toggle {
    appearance: none;
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-color);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.as-item__toggle:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}
.as-item__toggle:hover {
    background: #eef2f6;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.12);
}
.as-item__details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    border-top: 1px solid var(--border-color);
    background: var(--surface);
}
.as-item__details.is-open { max-height: 400px; opacity: 1; }
.as-item__details-inner {
    padding: var(--sp-3);
    color: var(--text-color);
    font-size: 0.95rem;
}
.as-empty {
    color: var(--text-light);
    background: var(--surface);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--sp-3);
    text-align: center;
}

/* ===========================
   ACCESSIBILITÉ & MOTION
   =========================== */
:focus-visible { outline: 2px solid rgba(0, 50, 98, 0.45); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ===========================
   THEME TOGGLE (base)
   =========================== */
.theme-toggle { position: relative; width: 56px; height: 28px; }
.theme-toggle__track {
    position: absolute; inset: 0; background: #E5E7EB; border-radius: 28px; transition: background var(--transition-fast);
}
.theme-toggle__thumb {
    position: absolute; top: 50%; left: 4px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--white); box-shadow: var(--shadow-sm); transition: transform var(--transition-fast), background var(--transition-fast); transform: translateY(-50%);
}
html[data-theme="dark"] .theme-toggle__thumb,
body[data-theme="dark"] .theme-toggle__thumb { transform: translate(28px, -50%); }

/* ===========================
   DARK THEME (html/body[data-theme="dark"])
   =========================== */
:is(html[data-theme="dark"], body[data-theme="dark"]) {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #0b1220;
    --accent-color: #ff4d4f;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --white: #0f172a;
    --surface: #0f172a;
    --text-color: #e5e7eb;
    --text-light: #9ca3af;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
    --shadow-hover: 0 12px 24px rgba(0, 0, 0, 0.55);
}
:is(html[data-theme="dark"], body[data-theme="dark"]) {
    background-color: var(--secondary-color);
    background-image: linear-gradient(135deg, #0b1220 0%, #0f172a 100%);
}

:is(html[data-theme="dark"], body[data-theme="dark"]) .navbar { background: #0b1220; border-bottom: 1px solid #1e293b; }
:is(html[data-theme="dark"], body[data-theme="dark"]) .navbar-navigation a { color: rgba(229, 231, 235, 0.85); }
:is(html[data-theme="dark"], body[data-theme="dark"]) .navbar-navigation a:hover { background: rgba(255, 255, 255, 0.10); color: #fff; }
:is(html[data-theme="dark"], body[data-theme="dark"]) .navbar-navigation .active { background: rgba(255, 255, 255, 0.18); color: #fff; }
:is(html[data-theme="dark"], body[data-theme="dark"]) .card-header,
:is(html[data-theme="dark"], body[data-theme="dark"]) .page-title,
:is(html[data-theme="dark"], body[data-theme="dark"]) .section-title { color: var(--text-color); }
:is(html[data-theme="dark"], body[data-theme="dark"]) .dashboard-container,
:is(html[data-theme="dark"], body[data-theme="dark"]) .card,
:is(html[data-theme="dark"], body[data-theme="dark"]) .modal-content { background: var(--surface); color: var(--text-color); border-color: var(--border-color); }
:is(html[data-theme="dark"], body[data-theme="dark"]) .form-control { background-color: #1f2937; border-color: var(--border-color); color: var(--text-color); }
:is(html[data-theme="dark"], body[data-theme="dark"]) .form-control:focus { background-color: #111827; border-color: #3b82f6; }
:is(html[data-theme="dark"], body[data-theme="dark"]) .btn-primary { background: var(--primary-color); border: 1px solid transparent; }
:is(html[data-theme="dark"], body[data-theme="dark"]) .btn-primary:hover { background: var(--primary-hover); }

/* End of TeamUP Modern CSS */

/* ===========================
   NAVIGATION
   =========================== */
.navbar {
    background: var(--primary-color); /* Barre de nav en bleu */
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--white); /* Texte blanc sur fond bleu */
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-self: start;
    flex-shrink: 0;
}

.navbar-brand:hover {
    color: var(--secondary-color);
}

/* New Navigation Wrapper */
.navbar-navigation {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0; /* Important for flex child with overflow */
    justify-self: center;
    width: 100%;
    justify-content: center;
}

/* Tabs Container */
.navbar-tabs-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.navbar-tabs-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    width: calc((var(--nav-tab-width) * 4) + (var(--nav-tab-gap) * 3));
    max-width: 100%;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
}

.navbar-tabs-viewport::-webkit-scrollbar {
    display: none;
}

.navbar-tabs-viewport.is-dragging {
    cursor: grabbing;
}

.navbar-tabs {
    display: flex;
    list-style: none;
    gap: var(--nav-tab-gap);
    padding: 0;
    margin: 0;
    white-space: nowrap;
    scroll-behavior: smooth;
}

.navbar-tabs li {
    flex: 0 0 auto;
}

/* Scroll Buttons */
.nav-scroll-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--white);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    opacity: 0;
    pointer-events: none;
    position: relative;
    z-index: 1;
}

.nav-scroll-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.nav-scroll-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.nav-scroll-btn.prev { left: auto; }
.nav-scroll-btn.next { right: auto; }

.navbar-navigation a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    display: inline-block;
}

.navbar-tabs a {
    width: var(--nav-tab-width);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.navbar-navigation a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.navbar-navigation .active {
    background: var(--white);
    color: var(--primary-color);
    font-weight: bold;
}

/* Old .navbar-menu fallback/cleanup if needed, but we replace it */
.navbar-menu {
    display: none; /* Hide old menu structure if it still exists somewhere */
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--white);
    justify-self: end;
    flex-shrink: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.notification-bell {
    position: relative;
    background: transparent;
    border: none;
    color: var(--white);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.notification-bell .ti {
    font-size: 22px;
    line-height: 1;
}

.notification-bell:hover {
    background: rgba(255, 255, 255, 0.12);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--accent-color);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: var(--shadow);
}

.notification-panel {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 360px;
    max-height: 70vh;
    background: var(--white);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform 200ms ease, opacity 200ms ease;
    z-index: 10000;
}

.notification-panel.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.notification-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.notification-panel-title {
    font-weight: 800;
    color: var(--primary-color);
}

.notification-panel-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification-list {
    overflow-y: auto;
    max-height: calc(70vh - 48px);
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background: rgba(255, 77, 79, 0.08);
}

.notification-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    flex-shrink: 0;
}

.notification-item-content {
    flex: 1;
}

.notification-item-title {
    font-weight: 700;
    color: var(--primary-color);
}

.notification-item-meta {
    color: var(--text-light);
    font-size: 0.85rem;
}

.notification-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 6px;
}

.notification-empty {
    padding: 18px;
    text-align: center;
    color: var(--text-light);
}

.notification-loadmore {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    background: var(--secondary-color);
    color: var(--text-color);
    cursor: pointer;
}
/* ===========================
   CONTAINERS & LAYOUTS
   =========================== */
.container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 clamp(20px, 3vw, 40px);
}

/* Conteneur login/register centré */
.auth-container {
    max-width: 450px;
    margin: 4rem auto;
    background: var(--white);
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 50, 98, 0.15); /* Ombre bleutée */
    border-top: 5px solid var(--primary-color);
}

.dashboard-container {
    background: var(--white);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border-left: 5px solid var(--primary-color); /* Accent bleu sur le côté */
}

/* ===========================
   CARDS
   =========================== */
.card {
    background: var(--white);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0,0,0,0.05);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.card-header {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--secondary-color);
}

.card-body {
    padding: 1rem 0;
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--light-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ===========================
   FORMS
   =========================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
    background-color: #f9f9f9;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(0, 50, 98, 0.1);
}

.form-control.error {
    border-color: var(--accent-color);
}

.error-message {
    color: var(--accent-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: block;
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: #95a5a6; /* Un gris un peu plus foncé pour le contraste bouton */
    color: var(--white);
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.12);
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-success:hover {
    background: #219150;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.12);
}

.btn-danger {
    background: var(--accent-color);
    color: var(--white);
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.12);
}

.btn-block {
    width: 100%;
    display: block;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===========================
   BADGES & TAGS
   =========================== */
.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-block;
}

.badge-pending {
    background: var(--warning-color);
    color: var(--white);
}

.badge-approved {
    background: var(--success-color);
    color: var(--white);
}

.badge-rejected {
    background: var(--accent-color);
    color: var(--white);
}

.badge-scheduled {
    background: var(--primary-color);
    color: var(--white);
}

.badge-completed {
    background: var(--dark-color);
    color: var(--white);
}
.badge-secondary {
    background: #9ca3af;
    color: var(--white);
}
.badge-ongoing {
    background: #f59e0b;
    color: var(--white);
}

/* ===========================
   TABLES
   =========================== */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table thead {
    background: var(--primary-color);
    color: var(--white);
    font-weight: 700;
}

.table th {
    font-weight: 700;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--light-color);
}

.table tbody tr:hover {
    background-color: rgba(0, 50, 98, 0.05); /* Léger bleu au survol */
}

/* ===========================
   GRID LAYOUTS
   =========================== */
.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ===========================
   STATS CARDS
   =========================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background: var(--white);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0,0,0,0.05);
    /* Removed thick border-left for a cleaner look */
    border-left: 3px solid var(--primary-color); 
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.stat-card .icon {
    font-size: 1.25rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(52, 152, 219, 0.1);
    color: var(--primary-color);
    border-radius: 10px;
    transition: all 0.3s ease;
    margin-bottom: 0;
    flex-shrink: 0;
    animation: float 3s ease-in-out infinite;
}

.stat-card:nth-child(odd) .icon {
    animation-delay: 0.5s;
}

.stat-card:nth-child(2n) .icon {
    animation-delay: 1s;
}

.stat-card:nth-child(3n) .icon {
    animation-delay: 1.5s;
}

.stat-card:hover .icon {
    background: var(--primary-color);
    color: var(--white);
}

.stat-card .stat-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card .value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-color);
    margin-bottom: 0.1rem;
}

.stat-card .stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dark mode overrides for stats */
body[data-theme="dark"] .stat-card {
    background: var(--surface);
    border-color: var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

body[data-theme="dark"] .stat-card:hover {
    background: var(--surface-hover);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

body[data-theme="dark"] .stat-card .value {
    color: var(--text-color);
}

body[data-theme="dark"] .stat-card .icon {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary-color);
}

body[data-theme="dark"] .stat-card:hover .icon {
    background: var(--primary-color);
    color: var(--white);
}

/* Stat Card Color Variants */
.stat-card.stat-blue, body[data-theme="dark"] .stat-card.stat-blue { border-left-color: #3b82f6; }
.stat-card.stat-blue .icon, body[data-theme="dark"] .stat-card.stat-blue .icon { color: #3b82f6; background: rgba(59, 130, 246, 0.1); }
.stat-card.stat-blue:hover .icon, body[data-theme="dark"] .stat-card.stat-blue:hover .icon { background: #3b82f6; color: #fff; }

.stat-card.stat-orange, body[data-theme="dark"] .stat-card.stat-orange { border-left-color: #f59e0b; }
.stat-card.stat-orange .icon, body[data-theme="dark"] .stat-card.stat-orange .icon { color: #f59e0b; background: rgba(245, 158, 11, 0.1); }
.stat-card.stat-orange:hover .icon, body[data-theme="dark"] .stat-card.stat-orange:hover .icon { background: #f59e0b; color: #fff; }

.stat-card.stat-green, body[data-theme="dark"] .stat-card.stat-green { border-left-color: #10b981; }
.stat-card.stat-green .icon, body[data-theme="dark"] .stat-card.stat-green .icon { color: #10b981; background: rgba(16, 185, 129, 0.1); }
.stat-card.stat-green:hover .icon, body[data-theme="dark"] .stat-card.stat-green:hover .icon { background: #10b981; color: #fff; }

.stat-card.stat-purple, body[data-theme="dark"] .stat-card.stat-purple { border-left-color: #8b5cf6; }
.stat-card.stat-purple .icon, body[data-theme="dark"] .stat-card.stat-purple .icon { color: #8b5cf6; background: rgba(139, 92, 246, 0.1); }
.stat-card.stat-purple:hover .icon, body[data-theme="dark"] .stat-card.stat-purple:hover .icon { background: #8b5cf6; color: #fff; }

/* ===========================
   MODALS
   =========================== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    background: var(--white);
    padding: var(--sp-5);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-top: 5px solid var(--primary-color);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-color);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.close {
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
    display: inline-block; /* Nécessaire pour transform */
    line-height: 1;
    width: 32px;
    height: 32px;
    text-align: center;
}

.close:hover {
    color: var(--accent-color);
    transform: rotate(90deg) scale(1.1);
}

/* ===========================
   ALERTS
   =========================== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 5px solid;
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.alert-success { background: #d4edda; border-color: #27ae60; color: #155724; }
.alert-error { background: #f8d7da; border-color: #e74c3c; color: #721c24; }
.alert-warning { background: #fff3cd; border-color: #f39c12; color: #856404; }
.alert-info { background: #d1ecf1; border-color: var(--primary-color); color: #0c5460; }

/* ===========================
   CALENDAR & TIMELINE
   =========================== */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.calendar-nav-meta {
    flex: 1;
    min-width: 220px;
    text-align: center;
}

.calendar-nav-meta.is-current-week .calendar-nav-title {
    color: var(--accent-color);
}

.calendar-nav-title {
    font-weight: 800;
    color: var(--primary-color);
    text-transform: capitalize;
}

.calendar-nav-subtitle {
    color: var(--text-light);
    font-size: 0.95rem;
}

.calendar-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.calendar-week-viewport {
    overflow: hidden;
    width: 100%;
    touch-action: pan-y;
}

.calendar-week-slider {
    display: flex;
    width: 300%;
    transform: translateX(-33.333333%);
    will-change: transform;
}

.calendar-week-slider.is-animating {
    transition: transform 280ms ease;
}

.calendar-week-slider.fast-anim {
    transition: transform 150ms ease !important;
}

.calendar-week-slider.no-transition {
    transition: none !important;
}

.calendar-week-panel {
    width: 33.333333%;
    flex: 0 0 33.333333%;
    padding: 0.25rem 0.25rem 0;
}

.calendar-week-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

@media (max-width: 1100px) {
    .calendar-week-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .calendar-week-grid { grid-template-columns: 1fr; }
    .calendar-nav-meta { text-align: left; }
}

.calendar-day {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    min-height: 150px;
    border-top: 3px solid var(--primary-color);
}

.calendar-day-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    text-transform: capitalize;
}

.calendar-day-date {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-light);
    text-transform: none;
}

.calendar-day.is-today {
    border-top-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(243, 156, 18, 0.25), var(--shadow);
}

.team-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
    background: rgba(0, 50, 98, 0.08);
}

.team-logo-fallback {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--primary-color);
    background: rgba(0, 50, 98, 0.08);
}

.tournament-winner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 10px;
    background: rgba(39, 174, 96, 0.10);
    border: 1px solid rgba(39, 174, 96, 0.25);
}

.tournament-winner-name {
    font-weight: 900;
    color: #1e7e34;
    font-size: 1.05rem;
}

.tournament-meta {
    display: grid;
    gap: 0.35rem;
}

.list-group { list-style: none; padding: 0; margin: 0; }
.list-group-item { padding: 0.5rem; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; }

.calendar-event {
    background: var(--primary-color);
    color: var(--white);
    padding: 0.5rem;
    border-radius: 5px;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    border-left: 3px solid var(--accent-color);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.calendar-event:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.calendar-event::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.calendar-event:hover::after {
    opacity: 1;
}

.timeline::before {
    background: var(--primary-color);
}

.timeline-item::before {
    background: var(--primary-color);
}

/* ===========================
   LOGO STYLES
   =========================== */
.logo-auth {
    max-width: 120px;
    height: auto;
    margin-bottom: 1rem;
}

.logo-navbar {
    height: 40px;
    width: auto;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* ===========================
   LOADING & UTILITIES
   =========================== */
.loading {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--light-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.page-title {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color); /* Changé de blanc à bleu car le fond est gris clair */
    margin-bottom: 2rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--secondary-color);
}

.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none !important; }
.mt-3 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-2 { gap: 1rem; }

.bracket {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.bracket-round {
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bracket-round-title {
    font-weight: 700;
    color: var(--primary-color);
    padding: 0.25rem 0.25rem 0;
}

.match-card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.match-team {
    padding: 0.5rem 0.6rem;
    background: rgba(0, 50, 98, 0.04);
    border-radius: 8px;
    font-weight: 600;
}

.match-team.winner {
    background: rgba(39, 174, 96, 0.12);
}

.match-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tournament-match-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--light-color);
    align-items: center;
}

.tournament-match-row:last-child {
    border-bottom: none;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 0;
        padding-bottom: 0;
    }
    
    .navbar-brand {
        order: 1;
        margin-bottom: 0.5rem;
    }
    
    .user-info {
        order: 2;
        margin-bottom: 0.5rem;
    }
    
    .navbar-navigation {
        order: 3;
        width: 100%;
        background: transparent;
        padding-bottom: 0.5rem;
        justify-self: stretch;
        margin-top: 0.5rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .navbar-navigation a {
        display: inline-block;
        padding: 0.5rem 1rem;
        white-space: nowrap;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 20px;
    }

    .navbar-tabs-container {
        width: 100%;
        justify-content: center;
    }

    .navbar-tabs-viewport {
        width: 100%;
        max-width: 100%;
    }

    .nav-scroll-btn {
        width: 32px;
        height: 32px;
    }

    :root {
        --nav-tab-width: clamp(90px, 22vw, 140px);
    }

    .navbar-navigation .active {
        background: var(--white);
        color: var(--primary-color);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .page-title { font-size: 1.5rem; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ===========================
   THEME TOGGLE (iOS style)
   =========================== */
:root {
    --toggle-icon-sun: #f39c12;
    --toggle-icon-moon: #34495e;
    --toggle-icon-dim: rgba(255, 255, 255, 0.4);
    --toggle-bg: rgba(255, 255, 255, 0.25);
    --toggle-thumb: #ffffff;
    --toggle-width: 56px;
    --toggle-height: 28px;
    --thumb-size: 24px;
    --toggle-padding: 2px;
    /* Calculated distance for thumb translation */
    --toggle-x: calc(var(--toggle-width) - var(--thumb-size) - (2 * var(--toggle-padding)));
}

body[data-theme="dark"] {
    --toggle-icon-sun: rgba(255, 255, 255, 0.4);
    --toggle-icon-moon: #f1c40f;
    --toggle-icon-dim: rgba(255, 255, 255, 0.4);
    --toggle-bg: rgba(0, 0, 0, 0.35);
    --toggle-thumb: #f0f4f8;
}

.theme-toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: calc(var(--toggle-width) + 2rem);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--white);
    padding: 0;
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--white);
    outline-offset: 2px;
    border-radius: 12px;
}

.theme-toggle__icon {
    font-size: 1rem;
    line-height: 1;
    z-index: 2;
    transition: color 250ms ease, opacity 250ms ease;
    pointer-events: none; /* Prevent clicks on icons */
    position: absolute; /* Position absolute within track context if we move them, but here they are siblings. 
                           Wait, if they are siblings, they are NOT inside the track.
                           The user request says "Mettre les icônes dans le track en position: absolute".
                           BUT the HTML structure in previous steps (and user prompt) showed:
                           <button ...>
                             <span class="icon sun"></span>
                             <span class="track"></span>
                             <span class="thumb"></span>
                             <span class="icon moon"></span>
                           </button>
                           So icons are OUTSIDE the track.
                           However, the prompt asks to ensure thumb doesn't cover icons OR icons are above.
                           If icons are outside (left/right of track), thumb (inside track) can never cover them.
                           Let's check if the user wants icons INSIDE the track.
                           "En mode clair, le thumb n’est pas centré et passe sur l’icône soleil."
                           This implies icons MIGHT be inside or visual overlap is happening.
                           Let's stick to the prompt's suggestion: "Mettre les icônes dans le track en position: absolute...".
                           To do this without changing HTML, we can position them relative to the button (.theme-toggle).
                           
                           Let's position icons absolutely within .theme-toggle button, over the track.
                        */
    top: 50%;
    transform: translateY(-50%);
}

.theme-toggle__icon--sun {
    left: 6px; /* Inside the track, left side */
    color: #f1c40f;
    opacity: 1;
}

.theme-toggle__icon--moon {
    right: 6px; /* Inside the track, right side */
    color: #f1c40f;
    opacity: 0.5;
}

/* Adjust track width to accommodate icons if they were outside, but now we put them inside visually?
   Actually, the prompt says: "Mettre les icônes dans le track en position: absolute".
   But HTML is button > icon, track, thumb, icon.
   We can position icons absolute relative to BUTTON.
   And make the TRACK full width of the button?
   
   Better approach based on prompt "En mode clair, le thumb ... passe sur l’icône soleil":
   This means visual overlap.
   Let's make the track contain everything visually.
   
   Let's set .theme-toggle width to var(--toggle-width).
   And make icons sit inside.
*/

.theme-toggle {
    width: var(--toggle-width);
    height: var(--toggle-height);
}

.theme-toggle__track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--toggle-bg);
    border-radius: var(--toggle-height);
    transition: background 250ms ease;
}

body[data-theme="dark"] .theme-toggle__icon--sun {
    opacity: 0.5;
}

body[data-theme="dark"] .theme-toggle__icon--moon {
    opacity: 1;
}

.theme-toggle__thumb {
    position: absolute;
    top: 50%; /* Center vertically */
    left: var(--toggle-padding);
    width: var(--thumb-size);
    height: var(--thumb-size);
    border-radius: 50%;
    background: var(--toggle-thumb);
    box-shadow: var(--shadow);
    transition: transform 250ms ease, background 250ms ease;
    transform: translateY(-50%); /* Only Y centering */
    z-index: 1;
}

body[data-theme="dark"] .theme-toggle__thumb {
    transform: translate(var(--toggle-x), -50%); /* X translation + Y centering */
}

/* ===========================
   DARK THEME VARIABLES & OVERRIDES
   =========================== */
body[data-theme="dark"] {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #0b1220;
    --accent-color: #ff4d4f;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --dark-color: #111827;
    --light-color: #1f2937;
    --white: #0f172a; /* This swaps card bg to dark */
    --text-color: #e5e7eb;
    --text-light: #9ca3af;
    --border-color: #334155;
    --shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    --shadow-hover: 0 10px 20px rgba(0, 0, 0, 0.45);
    --surface: #1e293b;
}

body[data-theme="dark"] {
    background-color: var(--secondary-color);
    background-image: linear-gradient(135deg, #0b1220 0%, #0f172a 100%);
}

/* Fix for dark primary color backgrounds needing light text */
body[data-theme="dark"] .navbar-brand,
body[data-theme="dark"] .user-info,
body[data-theme="dark"] .page-title,
body[data-theme="dark"] .card-header,
body[data-theme="dark"] .calendar-day-header,
body[data-theme="dark"] .calendar-nav-title,
body[data-theme="dark"] .form-group label,
body[data-theme="dark"] .bracket-round-title,
body[data-theme="dark"] .table thead,
body[data-theme="dark"] .btn-primary {
    color: #e5e7eb;
}

body[data-theme="dark"] .card-header {
    border-bottom-color: var(--border-color);
}

body[data-theme="dark"] .navbar {
    background: #0b1220;
    border-bottom: 1px solid #1e293b;
}

body[data-theme="dark"] .nav-scroll-btn {
    color: #e5e7eb;
    background: rgba(255, 255, 255, 0.05);
}

body[data-theme="dark"] .nav-scroll-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

body[data-theme="dark"] .navbar-navigation a {
    color: rgba(229, 231, 235, 0.8);
}

body[data-theme="dark"] .navbar-navigation a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

body[data-theme="dark"] .navbar-navigation .active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Notifications: mode sombre lisibilité */
body[data-theme="dark"] .notification-bell {
    color: #e5e7eb;
}
body[data-theme="dark"] .notification-panel-title {
    color: var(--text-color);
}
body[data-theme="dark"] .notification-item-title {
    color: var(--text-color);
}
body[data-theme="dark"] .notification-item-icon {
    background: #1e293b;
    color: #e5e7eb;
}
body[data-theme="dark"] .notification-item.unread {
    background: rgba(255, 77, 79, 0.12);
}

/* Logo: inversion pour mode sombre (si image foncée) */
body[data-theme="dark"] .logo-navbar,
body[data-theme="dark"] .logo-auth {
    filter: invert(1) brightness(1.1);
}

body[data-theme="dark"] .user-avatar {
    background: var(--light-color);
    color: #e5e7eb;
    border-color: var(--border-color);
}

body[data-theme="dark"] .dashboard-container,
body[data-theme="dark"] .card,
body[data-theme="dark"] .modal-content {
    background: var(--surface);
    color: var(--text-color);
    border-color: var(--border-color);
}

body[data-theme="dark"] .section-title,
body[data-theme="dark"] .modal-title {
    color: var(--text-color);
    border-bottom-color: var(--light-color);
}

body[data-theme="dark"] .form-control {
    background-color: var(--light-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

body[data-theme="dark"] .form-control:focus {
    background-color: #111827;
    border-color: #3b82f6;
}

body[data-theme="dark"] .btn-primary {
    background: var(--primary-color);
    border: 1px solid transparent;
}

body[data-theme="dark"] .btn-primary:hover {
    background: var(--primary-hover);
}

body[data-theme="dark"] .btn-secondary {
    background: #374151;
    color: #e5e7eb;
}

body[data-theme="dark"] .btn-danger {
    background: #b91c1c;
}

body[data-theme="dark"] .modal-content h3 {
    color: var(--text-color);
}

/* Gear Icon Animation */
.settings-gear-icon {
    font-size: 1.3rem;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s ease;
    color: var(--white) !important;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin-right: 0.5rem;
}

.settings-gear-icon:hover {
    transform: rotate(180deg);
    color: var(--secondary-color) !important;
}

/* Explicit dark mode fix for gear icon */
body[data-theme="dark"] .settings-gear-icon {
    color: #ffffff !important;
    opacity: 1 !important;
}

/* Ensure modal animation is smooth */
.modal.active .modal-content {
    animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ===========================
   TU-TEAMS COMPACT GRID
   =========================== */
.tu-teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    width: 100%;
}

.tu-team-card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 12px;
    height: 80px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
    color: var(--text-color);
    position: relative;
    overflow: hidden;
}

.tu-team-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
    border-color: var(--primary-color);
    z-index: 1;
}

.tu-team-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(0, 50, 98, 0.08);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.tu-team-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.tu-team-name {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
}

.tu-team-sport {
    font-size: 0.75rem;
    color: var(--text-light);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tu-team-status {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* Dense Variant (--dense) */
.tu-teams-grid.tu-dense {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.tu-team-card.tu-dense {
    height: 64px;
    padding: 8px 10px;
    border-radius: 8px;
}

.tu-team-card.tu-dense .tu-team-icon {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
    border-radius: 8px;
}

.tu-team-card.tu-dense .tu-team-name {
    font-size: 0.85rem;
}

.tu-team-card.tu-dense .tu-team-sport {
    font-size: 0.7rem;
}

/* Dark Mode Adjustments */
body[data-theme='dark'] .tu-team-card {
    background-color: var(--dark-surface, #1e1e1e);
    border-color: var(--border-color, #333);
}

body[data-theme='dark'] .tu-team-icon {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-light, #60a5fa);
}

/* Responsive */
@media (max-width: 480px) {
    .tu-teams-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}
