:root {
    /* Default (Dark / Cyber) vars */
    --primary-color: #00fff2;
    --primary-rgb: 0, 255, 242;
    --secondary-color: #d500f9;
    --secondary-rgb: 213, 0, 249;
    --accent-color: #ff6b35;
    --accent-rgb: 255, 107, 53;
    --success-color: #00e676;
    --warning-color: #ffc107;
    --danger-color: #ff5252;
    --danger-rgb: 255, 82, 82;
    --bg-color: #0a0a0f;
    --bg-rgb: 10, 10, 15;
    --bg-secondary: #121218;
    --card-bg: rgba(255, 255, 255, 0.04);
    --card-bg-hover: rgba(255, 255, 255, 0.07);
    --text-color: #f0f0f0;
    --text-muted: #8a8a9a;
    --border-color: rgba(255, 255, 255, 0.08);
    --gradient-primary: linear-gradient(135deg, var(--primary-color), #00b4d8);
    --gradient-secondary: linear-gradient(135deg, var(--secondary-color), #9c27b0);
    --gradient-accent: linear-gradient(135deg, var(--accent-color), #ff9800);
    --gold: #ffd700;
    --gold-glow: rgba(255, 215, 0, 0.15);
    --aurora-1: rgba(0, 255, 242, 0.15);
    --aurora-2: rgba(213, 0, 249, 0.15);
    --input-bg: rgba(0, 0, 0, 0.3);
}

/* --- Base Styles --- */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    /* Fallback */
    color: var(--text-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}



/* ===================
   MODERN AURORA BACKGROUND
   =================== */
.aurora-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    background-color: var(--bg-color);
    overflow: hidden;
}

.aurora-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/background-app.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.08;
    /* Very subtle transparency */
    filter: grayscale(100%) contrast(120%);
    mix-blend-mode: soft-light;
}

.aurora-mesh {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(circle at 50% 50%, black, transparent 80%);
}

.aurora-blob {
    position: absolute;
    width: 60vmax;
    height: 60vmax;
    filter: blur(100px);
    border-radius: 50%;
    opacity: 0.5;
    mix-blend-mode: screen;
    animation: drift 20s infinite alternate ease-in-out;
}

.aurora-blob--1 {
    background: var(--aurora-1);
    top: -10%;
    left: -10%;
    animation-duration: 25s;
}

.aurora-blob--2 {
    background: var(--aurora-2);
    bottom: -10%;
    right: -10%;
    animation-duration: 30s;
    animation-delay: -5s;
}

.aurora-blob--3 {
    background: rgba(0, 180, 216, 0.1);
    top: 40%;
    left: 30%;
    width: 40vmax;
    height: 40vmax;
    animation-duration: 20s;
    animation-delay: -10s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }

    33% {
        transform: translate(10%, 15%) scale(1.1) rotate(10deg);
    }

    66% {
        transform: translate(-5%, 10%) scale(0.9) rotate(-10deg);
    }

    100% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
}


/* ===================
   APP LAYOUT
   =================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ===================
   SIDEBAR
   =================== */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1001;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--primary-color);
    text-decoration: none;
    text-transform: uppercase;
}

.navbar-brand img {
    height: 32px;
    width: auto;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav-label {
    padding: 1.2rem 2rem 0.5rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
}

.sidebar-nav a,
.nav-logout-vertical,
.nav-login-vertical {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 2rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.nav-logout-vertical:hover,
.nav-login-vertical:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-nav a.active {
    color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.08);
    border-left-color: var(--primary-color);
}

.nav-logout-vertical {
    color: var(--danger-color) !important;
}

.nav-login-vertical {
    color: var(--success-color) !important;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1rem 0;
}

.theme-switcher-vertical {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

/* ===================
   MOBILE HEADER
   =================== */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.sidebar-toggle,
.sidebar-close {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.5rem;
}

.d-none {
    display: none !important;
}


.header-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}


@media (min-width: 768px) {
    .d-md-none {
        display: none !important;
    }
}


/* ===================
   MAIN CONTENT
   =================== */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2.5rem;
    width: calc(100% - 260px);
    transition: margin 0.3s;
}


/* ===================
   FLASH MESSAGES
   =================== */
.flash {
    width: 100%;
    max-width: 800px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

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

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

.flash--success {
    background: rgba(var(--primary-rgb), 0.12);
    /* Use primary for success too if we want themed flashes, but actually success should stay green usually. Let's stick to success color. */
    color: var(--success-color);
    border: 1px solid rgba(0, 230, 118, 0.25);
}

.flash--error,
.flash--danger {
    background: rgba(255, 82, 82, 0.12);
    color: var(--danger-color);
    border: 1px solid rgba(255, 82, 82, 0.25);
}

.flash--warning {
    background: rgba(255, 193, 7, 0.12);
    color: var(--warning-color);
    border: 1px solid rgba(255, 193, 7, 0.25);
}

.flash--info {
    background: rgba(0, 255, 242, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(0, 255, 242, 0.2);
}

.flash__close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.flash__close:hover {
    opacity: 1;
}

/* ===================
   DASHBOARD
   =================== */
.dashboard {
    width: 100%;
}

.dashboard h1 {
    text-align: left;
    font-size: 1.8rem;
    margin-bottom: 2rem;
    margin-top: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.8rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 16px 16px 0 0;
}

.stat-card--athletes::before {
    background: var(--gradient-primary);
}

.stat-card--categories::before {
    background: var(--gradient-secondary);
}

.stat-card--subscriptions::before {
    background: var(--gradient-accent);
}

.stat-card:hover {
    background: var(--card-bg-hover);
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.stat-card__icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card__info {
    display: flex;
    flex-direction: column;
    color: #c29b00;
}

.stat-card__value {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-card__label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.dashboard-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.8rem;
}

.panel h2 {
    text-align: left;
    font-size: 1.1rem;
    margin-bottom: 1.2rem;
    color: var(--text-color);
}

.panel-chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 350px;
}

.chart-container {
    position: relative;
    width: 100%;
    margin: auto;
}

.chart-container--doughnut {
    max-width: 300px;
}

.chart-container--bar {
    height: 280px;
}

/* Category Bars */
.category-bars {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.category-bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.category-bar__label {
    min-width: 100px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.category-bar__track {
    flex: 1;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.category-bar__fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 4px;
}

.category-bar__count {
    min-width: 30px;
    text-align: right;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--primary-color);
}

/* Recent List */
.recent-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.recent-list__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    background: var(--card-bg);
    transition: background 0.2s;
}

.recent-list__item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.recent-list__name {
    font-weight: 500;
    font-size: 0.92rem;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
}

.badge--success {
    background: rgba(0, 230, 118, 0.12);
    color: var(--success-color);
    border-color: rgba(0, 230, 118, 0.25);
}

.badge--warning {
    background: rgba(255, 193, 7, 0.12);
    color: var(--warning-color);
    border-color: rgba(255, 193, 7, 0.25);
}

.badge--danger {
    background: rgba(255, 82, 82, 0.12);
    color: var(--danger-color);
    border-color: rgba(255, 82, 82, 0.25);
}

.badge--secondary {
    background: rgba(213, 0, 249, 0.1);
    color: var(--secondary-color);
    border-color: rgba(213, 0, 249, 0.2);
}

/* Dashboard Actions */
.dashboard-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===================
   FORMS
   =================== */
.login-container,
.registration-container,
.form-container {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 520px;
    align-self: center;
}

h1,
h2,
h3 {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.25s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 255, 242, 0.15);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a8a9a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

select.form-control option {
    background: var(--bg-secondary);
    color: var(--text-color);
}

/* ===================
   BUTTONS
   =================== */
.btn {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.25s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    text-align: center;
}

.btn+.btn,
a.btn+a.btn,
button.btn+button.btn {
    margin-left: 0.5rem;
}

@media (max-width: 768px) {

    .btn+.btn,
    a.btn+a.btn,
    button.btn+button.btn {
        margin-left: 0;
    }
}

.btn-primary {
    background: var(--gradient-primary);
    color: #0a0a0f;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 242, 0.25);
}

.btn-secondary {
    background: var(--gradient-secondary);
    color: white;
}

.btn-secondary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(213, 0, 249, 0.25);
}

.btn-accent {
    background: var(--gradient-accent);
    color: white;
}

.btn-accent:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.25);
}

.btn-danger {
    background: rgba(255, 82, 82, 0.15);
    color: var(--danger-color);
    border: 1px solid rgba(255, 82, 82, 0.3);
}

.btn-danger:hover {
    background: rgba(255, 82, 82, 0.25);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.78rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ===================
   TABLES
   =================== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

th,
td {
    padding: 0.9rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: rgba(0, 0, 0, 0.3);
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    font-size: 0.9rem;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.bg-card {
    background: var(--card-bg) !important;
}

.border-color {
    border-color: var(--border-color) !important;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

/* Responsive Grid System */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

.col,
[class*="col-"] {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
    width: 100%;
}

.sticky-top {
    position: sticky;
    top: 0;
    z-index: 100;
}

.order-1 {
    order: 1 !important;
}

.order-2 {
    order: 2 !important;
}

.list-unstyled {
    list-style: none;
    padding-left: 0;
}

.w-100 {
    width: 100% !important;
}

.small {
    font-size: 0.875rem;
}

.italic {
    font-style: italic;
}

.badge--danger {
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
}

@media (min-width: 768px) {
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .col-md-7 {
        flex: 0 0 58.333333%;
        max-width: 58.333333%;
    }

    .col-md-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }

    .order-md-1 {
        order: 1 !important;
    }

    .order-md-2 {
        order: 2 !important;
    }
}

/* Spacing Utilities */
.mt-0 {
    margin-top: 0 !important;
}

.mt-1 {
    margin-top: 0.25rem !important;
}

.mt-2 {
    margin-top: 0.5rem !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 0.25rem !important;
}

.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.p-0 {
    padding: 0 !important;
}

.p-4 {
    padding: 1.5rem !important;
}

.py-4 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
}

.px-4 {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-flex {
    display: flex !important;
}

.justify-content-center {
    justify-content: center !important;
}

.align-items-center {
    align-items: center !important;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.border-0 {
    border: 0 !important;
}

.h-100 {
    height: 100% !important;
}

.gap-2 {
    gap: 0.5rem !important;
}

/* ===================
   FORM FIELDS (Global)
   =================== */
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-color);
}

.form-control,
.form-select,
.form-container input[type="text"],
.form-container input[type="email"],
.form-container input[type="password"],
.form-container input[type="number"],
.form-container input[type="date"],
.form-container input[type="time"],
.form-container input[type="tel"],
.form-container input[type="url"],
.form-container input[type="file"],
.form-container textarea,
.form-container select {
    display: block;
    width: 100%;
    padding: 0.65rem 0.9rem;
    font-size: 0.92rem;
    font-family: inherit;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-sizing: border-box;
}

.form-control:focus,
.form-select:focus,
.form-container input:focus,
.form-container textarea:focus,
.form-container select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
    cursor: pointer;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Input Group (e.g. password with toggle button) */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    flex: 1;
}

.input-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border: 1px solid var(--border-color);
    border-left: 0;
    background: var(--card-bg);
    color: var(--text-color);
    padding: 0.65rem 0.9rem;
    display: flex;
    align-items: center;
}

.input-group .btn:hover {
    background: rgba(var(--primary-rgb), 0.1);
}

/* Toggle password eye button – compact size */
.toggle-password-btn {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    padding: 0.4rem 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0;
    line-height: 1;
    cursor: pointer;
}

.toggle-password-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* D-grid for full-width submit buttons */
.d-grid {
    display: grid;
}

/* Form container card body */
.card-body {
    padding: 1.5rem;
}

/* Small form helper text */
.form-container small,
.form-container .text-muted {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Custom Form Container Adjustments */
@media (max-width: 768px) {
    .form-container {
        padding: 1.5rem;
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
}

/* ===================
   PAGE HEADER
   =================== */
.page-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    margin-bottom: 0;
    font-size: 1.5rem;
}

/* ===================
   SEARCH BAR
   =================== */
.search-bar {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 500px;
    flex-direction: column;
}


.search-bar--large {
    max-width: 100%;
    margin-bottom: 2rem;
}

.search-bar--large input {
    font-size: 1.1rem;
    padding: 0.9rem 1.5rem;
    flex: 3;
    min-width: 350px;
    /* Ensure it stays long */
    /* Take 3 times more space than others if possible */
}

.search-bar input {
    flex: 1;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.9rem;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.search-bar select {
    padding: 0.7rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.9rem;
    min-width: 160px;
}

.search-bar--multi {
    max-width: 100%;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-group {
    flex: 1;
    min-width: 180px;
}

.search-group--date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.search-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.search-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-outline {
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.img-avatar--sm {
    width: 35px;
    height: 35px;
    border-radius: 50%;
}

.athlete-avatar--sm {
    font-size: 1.2rem;
}

.athlete-photo img {
    border-radius: 50%;
}

/* ===================
   DETAIL / SHOW CARD
   =================== */
.detail-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 600px;
}

.detail-card__row {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-card__row:last-child {
    border-bottom: none;
}

.detail-card__label {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.88rem;
}

.detail-card__value {
    font-weight: 600;
}

.detail-card__actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
    justify-content: center;
}

/* ===================
   ALERT
   =================== */
.alert {
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
    border-radius: 10px;
    background: rgba(255, 82, 82, 0.12);
    color: var(--danger-color);
    border: 1px solid rgba(255, 82, 82, 0.25);
}

/* ===================
   TEXT UTILITIES
   =================== */
.text-muted {
    color: var(--text-muted);
}

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

/* ===================
   EMPTY STATE
   =================== */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
}

.empty-state__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state__text {
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* ===================
   RESPONSIVE
   =================== */
/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-panels {
        grid-template-columns: 1fr;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1.5rem;
        margin-top: 70px;
        /* Space for mobile header */
    }

    .dashboard h1 {
        font-size: 1.5rem;
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .flex-stack-mobile {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: center;
        gap: 1rem;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    /* Actions & Buttons Responsiveness */
    .btn,
    .btn-sm,
    .pro-btn,
    .pro-text-btn,
    .pagination-link,
    button[type="submit"] {
        width: 100%;
        margin-bottom: 0.5rem;
        display: block;
        box-sizing: border-box;
        justify-content: center;
    }

    /* Form controls in search bar must take full width to prevent 'width: auto' from shrinking them on mobile */
    .search-bar .form-control {
        width: 100% !important;
    }

    /* Container adjustments to force vertically stacked actions with spacing */
    .table-actions,
    .detail-card__actions,
    .dashboard-actions,
    .search-actions,
    .page-header>div,
    .action-buttons,
    .search-bar {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.8rem;
    }

    .table-actions .btn,
    .detail-card__actions .btn,
    .dashboard-actions .btn,
    .search-actions .btn,
    .search-bar .btn {
        margin-bottom: 0;
        /* L'espacement est géré par gap */
    }

    /* Exceptions where width should NOT be 100% */
    .flash__close,
    .mode-toggle,
    .sidebar-toggle,
    .sidebar-close,
    .theme-dot,
    .toggle-password-btn,
    .input-group .btn {
        width: auto;
        display: inline-flex;
        margin-bottom: 0;
    }
}

/* ===================
   MODERN SCROLLBARS
   =================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), 0.2);
    border-radius: 10px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-rgb), 0.5);
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--primary-rgb), 0.2) transparent;

}

/* --- THEMES & MODES (Bottom of file for cascade) --- */
html[data-theme="emerald"] {
    --primary-color: #2ecc71;
    --primary-rgb: 46, 204, 113;
    --secondary-color: #1abc9c;
    --aurora-1: rgba(46, 204, 113, 0.25);
}

html[data-theme="gold"] {
    --primary-color: #f1c40f;
    --primary-rgb: 241, 196, 15;
    --secondary-color: #e67e22;
    --aurora-1: rgba(241, 196, 15, 0.25);
}

html[data-theme="midnight"] {
    --primary-color: #3498db;
    --primary-rgb: 52, 152, 219;
    --secondary-color: #9b59b6;
    --aurora-1: rgba(52, 152, 219, 0.25);
}

html[data-theme="rose"] {
    --primary-color: #ff4757;
    --primary-rgb: 255, 71, 87;
    --secondary-color: #ffa502;
    --aurora-1: rgba(255, 71, 87, 0.25);
}

html[data-mode="light"] {
    --bg-color: #f8f9fa;
    --bg-rgb: 248, 249, 250;
    --bg-secondary: #ffffff;
    --card-bg: rgba(0, 0, 0, 0.04);
    --card-bg-hover: rgba(0, 0, 0, 0.08);
    --text-color: #2d3436;
    --text-muted: #636e72;
    --border-color: rgba(0, 0, 0, 0.1);
    --input-bg: #ffffff;
    --aurora-1: rgba(0, 0, 0, 0.05);
    --aurora-2: rgba(0, 0, 0, 0.03);
}

html[data-mode="light"] .sidebar,
html[data-mode="light"] .mobile-header {
    background: var(--bg-secondary) !important;
}

html[data-mode="light"] .sidebar-nav a:hover {
    background: rgba(0, 0, 0, 0.05);
}

html[data-mode="light"] .aurora-container::before {
    opacity: 0.03;
}

html[data-mode="light"] table th {
    background: rgba(0, 0, 0, 0.05);
}

/* Global transition for theme switching */
body,
.sidebar,
.mobile-header,
.stat-card,
.panel,
.btn,
.form-control,
.card,
.aurora-blob,
.sidebar-nav a {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

/* ===================
   METIS MENU STYLES
   =================== */
.metismenu .has-arrow {
    position: relative;
}

.metismenu .has-arrow::after {
    position: absolute;
    content: '';
    width: 0.5em;
    height: 0.5em;
    border-width: 1px 0 0 1px;
    border-style: solid;
    border-color: initial;
    right: 1.5em;
    transform: rotate(-135deg) translateY(-50%);
    transform-origin: top;
    top: 50%;
    transition: all .3s;
}

.metismenu .mm-active>.has-arrow::after,
.metismenu .has-arrow[aria-expanded="true"]::after {
    transform: rotate(45deg) translateY(-50%);
}

.metismenu ul {
    background: rgba(0, 0, 0, 0.1);
    list-style: none;
    padding: 0;
}

.metismenu ul a {
    padding-left: 3rem !important;
    font-size: 0.85rem !important;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
}

/* AJAX Loader */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 2000;
    display: none;
}

#loader::after {
    content: '';
    display: block;
    width: 0%;
    height: 100%;
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
    animation: loading 2s infinite linear;
}

@keyframes loading {
    0% {
        width: 0%;
        left: 0%;
    }

    50% {
        width: 50%;
        left: 25%;
    }

    100% {
        width: 0%;
        left: 100%;
    }
}

.main-content.loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s;
}

.dropdown-actions {
    flex-direction: column;
}

.stat-card__value {
    color: var(--text-color);
}

.bloc-prochaines a {
    color: var(--text-color);
}

.btn-group {
    display: flex;
}


@media (min-width: 768px) {

    .search-bar {
        flex-direction: row;
    }

    .header-actions {
        flex-direction: row;
        align-items: center;
    }

    .dropdown-actions {
        flex-direction: row;
    }
}

#ctadouble {
    display: flex !important;
    flex-direction: column;
    margin-top: 15px;
}

@media (min-width: 1300px) {
    #ctadouble {
        flex-direction: row;
        margin-top: 30px;
    }

}