/* ============================================================
   FASU Platform - Custom CSS
   Design: Glassmorphism | Colors: Black → Green #1E8449 + Gold
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
    --color-bg-1: #040d0e;
    --color-bg-2: #071a10;
    --color-bg-3: #0a2415;
    --color-green: #1E8449;
    --color-green-light: #27ae60;
    --color-green-dark: #145a32;
    --color-gold: #D4AC0D;
    --color-gold-light: #f0c30d;
    --color-white: #ffffff;
    --color-text-primary: #e8f5e9;
    --color-text-secondary: #a8d5b5;
    --color-text-muted: #6aab7e;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-bg-hover: rgba(255, 255, 255, 0.09);
    --glass-border: rgba(30, 132, 73, 0.25);
    --glass-border-hover: rgba(30, 132, 73, 0.5);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-h: 64px;
    --radius: 14px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-ar: 'Cairo', 'Segoe UI', sans-serif;
    --font-en: 'Inter', 'Segoe UI', sans-serif;

    /* Theme specific backgrounds */
    --sidebar-bg: rgba(4, 13, 14, 0.85);
    --topbar-bg: rgba(4, 13, 14, 0.7);
    --input-bg: rgba(255, 255, 255, 0.04);
    --scrollbar-thumb: rgba(30, 132, 73, 0.3);
    --scrollbar-thumb-hover: rgba(30, 132, 73, 0.5);
}

/* Light Theme Variables */
html[data-theme="light"] {
    --color-bg-1: #f4f7f5;
    --color-bg-2: #ffffff;
    --color-bg-3: #e2e8e4;
    --color-white: #111c15; /* Fully highlight text color */
    --color-text-primary: #1e2d24;
    --color-text-secondary: #3a4e42;
    --color-text-muted: #5c7566;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-bg-hover: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(30, 132, 73, 0.18);
    --glass-border-hover: rgba(30, 132, 73, 0.4);
    --glass-shadow: 0 8px 32px rgba(30, 132, 73, 0.08);
    --sidebar-bg: rgba(255, 255, 255, 0.85);
    --topbar-bg: rgba(255, 255, 255, 0.7);
    --input-bg: rgba(0, 0, 0, 0.02);
    --scrollbar-thumb: rgba(30, 132, 73, 0.2);
    --scrollbar-thumb-hover: rgba(30, 132, 73, 0.4);
}

/* Sun and Moon Icons Visibility Switcher based on theme */
#theme-sun-icon { display: inline-block !important; }
#theme-moon-icon { display: none !important; }

html[data-theme="light"] #theme-sun-icon { display: none !important; }
html[data-theme="light"] #theme-moon-icon { display: inline-block !important; }

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html[dir="rtl"] { font-family: var(--font-ar); }
html[dir="ltr"] { font-family: var(--font-en); }

body {
    background: var(--color-bg-1);
    color: var(--color-text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.6;
}

/* ─── Animated Background ───────────────────────────────────── */
.bg-animated {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 60% at 10% 20%, rgba(30,132,73,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 80% at 90% 80%, rgba(212,172,13,0.06) 0%, transparent 60%),
        linear-gradient(135deg, var(--color-bg-1) 0%, var(--color-bg-2) 40%, var(--color-bg-3) 100%);
    pointer-events: none;
}

.bg-animated::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(30,132,73,0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(212,172,13,0.04) 0%, transparent 40%);
    animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* ─── App Layout ────────────────────────────────────────────── */
.app-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-inline-end: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    overflow: hidden;
}

html[dir="rtl"] .sidebar { right: 0; }
html[dir="ltr"] .sidebar { left: 0; }

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--topbar-h);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-green), var(--color-gold));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    font-weight: 900;
    color: #fff;
    box-shadow: 0 4px 15px rgba(30,132,73,0.4);
}

.sidebar-title {
    flex: 1;
    overflow: hidden;
}

.sidebar-title h1 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-gold);
    white-space: nowrap;
    line-height: 1.2;
}

.sidebar-title p {
    font-size: 0.65rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 2px; }

.nav-section {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    margin: 0.1rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--glass-bg-hover);
    color: var(--color-white);
    border-color: var(--glass-border-hover);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(30,132,73,0.3), rgba(30,132,73,0.1));
    color: #fff;
    border: 1px solid rgba(30,132,73,0.4);
    box-shadow: 0 4px 15px rgba(30,132,73,0.15);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: linear-gradient(to bottom, var(--color-green), var(--color-gold));
    border-radius: 2px;
}

.nav-item i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    color: var(--color-green-light);
}

.nav-item.active i { color: var(--color-gold); }

.sidebar-footer {
    border-top: 1px solid var(--glass-border);
    padding: 0.75rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-green), var(--color-gold));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-info { flex: 1; overflow: hidden; }
.user-info .name { font-size: 0.78rem; font-weight: 600; color: var(--color-text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .role-badge { font-size: 0.6rem; color: var(--color-gold); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* ─── Main Content ──────────────────────────────────────────── */
.main-content {
    flex: 1;
    min-height: 100vh;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

html[dir="rtl"] .main-content { margin-right: var(--sidebar-width); }
html[dir="ltr"] .main-content { margin-left: var(--sidebar-width); }

/* ─── Topbar ────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--topbar-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

/* ─── Page Content ──────────────────────────────────────────── */
.page-content {
    padding: 1.5rem;
    flex: 1;
}

/* ─── Glass Card ────────────────────────────────────────────── */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: var(--transition);
}

.glass-card:hover {
    border-color: var(--glass-border-hover);
    box-shadow: var(--glass-shadow);
}

/* ─── Stat Cards ────────────────────────────────────────────── */
.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset-inline-end: -20px;
    top: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-color, rgba(30,132,73,0.2)) 0%, transparent 70%);
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--glass-border-hover);
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.green { background: linear-gradient(135deg, rgba(30,132,73,0.3), rgba(30,132,73,0.1)); color: var(--color-green-light); border: 1px solid rgba(30,132,73,0.3); }
.stat-icon.gold { background: linear-gradient(135deg, rgba(212,172,13,0.3), rgba(212,172,13,0.1)); color: var(--color-gold); border: 1px solid rgba(212,172,13,0.3); }
.stat-icon.blue { background: linear-gradient(135deg, rgba(52,152,219,0.3), rgba(52,152,219,0.1)); color: #5dade2; border: 1px solid rgba(52,152,219,0.3); }
.stat-icon.red { background: linear-gradient(135deg, rgba(231,76,60,0.3), rgba(231,76,60,0.1)); color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); }

.stat-body { flex: 1; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--color-white); line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 0.2rem; font-weight: 500; }

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-green), var(--color-green-dark));
    color: #fff;
    box-shadow: 0 4px 15px rgba(30,132,73,0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-green-light), var(--color-green));
    box-shadow: 0 6px 20px rgba(30,132,73,0.5);
    transform: translateY(-1px);
    color: #fff;
}

.btn-gold {
    background: linear-gradient(135deg, var(--color-gold), #b8960b);
    color: #1a1a1a;
    box-shadow: 0 4px 15px rgba(212,172,13,0.3);
}

.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(212,172,13,0.5); color: #1a1a1a; }

.btn-ghost {
    background: var(--glass-bg);
    color: var(--color-text-secondary);
    border: 1px solid var(--glass-border);
}

.btn-ghost:hover { background: var(--glass-bg-hover); color: var(--color-white); border-color: var(--glass-border-hover); }

.btn-danger {
    background: linear-gradient(135deg, rgba(231,76,60,0.3), rgba(192,57,43,0.2));
    color: #e74c3c;
    border: 1px solid rgba(231,76,60,0.3);
}

.btn-danger:hover { background: linear-gradient(135deg, #e74c3c, #c0392b); color: #fff; }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.75rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.95rem; }
.btn-icon { padding: 0.4rem 0.5rem; }

/* ─── Tables ────────────────────────────────────────────────── */
.table-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.table-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.fasu-table {
    width: 100%;
    border-collapse: collapse;
}

.fasu-table thead th {
    padding: 0.75rem 1rem;
    background: rgba(30,132,73,0.08);
    color: var(--color-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}

html[dir="rtl"] .fasu-table thead th { text-align: right; }
html[dir="ltr"] .fasu-table thead th { text-align: left; }

.fasu-table tbody tr {
    border-bottom: 1px solid rgba(30,132,73,0.08);
    transition: var(--transition);
}

.fasu-table tbody tr:hover { background: rgba(30,132,73,0.06); }
.fasu-table tbody tr:last-child { border-bottom: none; }

.fasu-table tbody td {
    padding: 0.85rem 1rem;
    color: var(--color-text-secondary);
    font-size: 0.83rem;
    vertical-align: middle;
}

/* ─── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-green { background: rgba(30,132,73,0.2); color: var(--color-green-light); border: 1px solid rgba(30,132,73,0.3); }
.badge-gold { background: rgba(212,172,13,0.2); color: var(--color-gold); border: 1px solid rgba(212,172,13,0.3); }
.badge-blue { background: rgba(52,152,219,0.2); color: #5dade2; border: 1px solid rgba(52,152,219,0.3); }
.badge-red { background: rgba(231,76,60,0.2); color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); }
.badge-gray { background: rgba(127,127,127,0.2); color: #aaa; border: 1px solid rgba(127,127,127,0.3); }

/* ─── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--color-green);
    background: rgba(30,132,73,0.07);
    box-shadow: 0 0 0 3px rgba(30,132,73,0.15);
}

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

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

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

/* ─── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.show { display: flex; animation: fadeIn 0.2s ease; }

.modal-box {
    background: var(--color-bg-2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title { font-size: 0.95rem; font-weight: 700; color: var(--color-white); }

.modal-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: var(--transition);
}

.modal-close:hover { background: rgba(231,76,60,0.2); color: #e74c3c; border-color: rgba(231,76,60,0.3); }

.modal-body { padding: 1.25rem; }
.modal-footer { padding: 0.75rem 1.25rem; border-top: 1px solid var(--glass-border); display: flex; gap: 0.5rem; justify-content: flex-end; }

/* ─── Flash Alerts ──────────────────────────────────────────── */
.flash-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.84rem;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

.flash-success { background: rgba(30,132,73,0.2); border: 1px solid rgba(30,132,73,0.4); color: #2ecc71; }
.flash-error { background: rgba(231,76,60,0.2); border: 1px solid rgba(231,76,60,0.4); color: #e74c3c; }
.flash-warning { background: rgba(212,172,13,0.2); border: 1px solid rgba(212,172,13,0.4); color: var(--color-gold); }

/* ─── Lang Switcher ─────────────────────────────────────────── */
.lang-switcher {
    display: flex;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    overflow: hidden;
}

.lang-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: var(--transition);
    border: none;
    background: transparent;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lang-btn:hover { background: var(--glass-bg-hover); color: var(--color-white); }
.lang-btn.active { background: rgba(30,132,73,0.3); color: var(--color-green-light); }

/* ─── Charts Container ──────────────────────────────────────── */
.chart-container {
    position: relative;
    padding: 0.5rem;
}

/* ─── Avatar ────────────────────────────────────────────────── */
.athlete-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--glass-border);
    object-fit: cover;
    background: linear-gradient(135deg, var(--color-green-dark), var(--color-bg-3));
}

.athlete-avatar-lg {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 3px solid var(--color-green);
    object-fit: cover;
    box-shadow: 0 8px 25px rgba(30,132,73,0.4);
}

/* ─── Profile Card ──────────────────────────────────────────── */
.profile-card {
    background: linear-gradient(135deg, rgba(30,132,73,0.15), rgba(212,172,13,0.05));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* ─── Document Card ─────────────────────────────────────────── */
.doc-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.doc-card:hover { border-color: var(--glass-border-hover); background: var(--glass-bg-hover); }

.doc-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(30,132,73,0.2), rgba(30,132,73,0.05));
    border: 1px solid rgba(30,132,73,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--color-green-light);
    flex-shrink: 0;
}

.doc-card.has-doc .doc-icon {
    background: linear-gradient(135deg, rgba(30,132,73,0.3), rgba(30,132,73,0.1));
    border-color: rgba(30,132,73,0.4);
}

.doc-info { flex: 1; overflow: hidden; }
.doc-name { font-size: 0.8rem; font-weight: 600; color: var(--color-text-primary); }
.doc-meta { font-size: 0.7rem; color: var(--color-text-muted); }

/* ─── Achievement Item ──────────────────────────────────────── */
.achievement-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.achievement-item:hover { border-color: rgba(212,172,13,0.3); background: rgba(212,172,13,0.05); }

.ach-medal {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-gold), #8b6914);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
}

/* ─── Search & Filter Bar ───────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input i {
    position: absolute;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}

html[dir="rtl"] .search-input i { right: 0.7rem; }
html[dir="ltr"] .search-input i { left: 0.7rem; }

.search-input input {
    padding-inline-start: 2rem;
}

/* ─── Page Header ───────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-white);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.breadcrumb a { color: var(--color-text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-green-light); }
.breadcrumb-sep { color: var(--color-text-muted); opacity: 0.4; }

/* ─── Toggle Switch ─────────────────────────────────────────── */
.toggle-switch {
    position: relative;
    width: 38px;
    height: 20px;
    display: inline-block;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-track {
    position: absolute;
    inset: 0;
    background: rgba(127,127,127,0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(127,127,127,0.2);
}

.toggle-track::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #aaa;
    top: 2px;
    transition: var(--transition);
}

html[dir="rtl"] .toggle-track::before { right: 2px; }
html[dir="ltr"] .toggle-track::before { left: 2px; }

input:checked + .toggle-track {
    background: rgba(30,132,73,0.4);
    border-color: rgba(30,132,73,0.5);
}

input:checked + .toggle-track::before {
    background: var(--color-green-light);
    box-shadow: 0 2px 8px rgba(30,132,73,0.5);
}

html[dir="rtl"] input:checked + .toggle-track::before { right: calc(100% - 16px); }
html[dir="ltr"] input:checked + .toggle-track::before { left: calc(100% - 16px); }

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* ─── Animations ────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

.animate-in { animation: fadeInUp 0.4s ease forwards; }
.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }
    .sidebar { transform: translateX(100%); }
    html[dir="ltr"] .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); width: 260px; }
    .main-content { margin-inline-start: 0 !important; }

    .page-content { padding: 1rem; }
    .stat-cards-grid { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 480px) {
    .stat-cards-grid { grid-template-columns: 1fr !important; }
}

/* ─── Utility ───────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat-cards-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

@media (max-width: 1200px) {
    .stat-cards-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 0.75rem; }
.gap-3 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-muted { color: var(--color-text-muted) !important; }
.text-gold { color: var(--color-gold) !important; }
.text-green { color: var(--color-green-light) !important; }
.text-white { color: #fff !important; }
.text-sm { font-size: 0.78rem; }
.text-xs { font-size: 0.7rem; }
.fw-bold { font-weight: 700; }
.fw-600 { font-weight: 600; }
.w-100 { width: 100%; }
.d-none { display: none; }
.cursor-pointer { cursor: pointer; }

/* ─── Divider ───────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--glass-border);
    margin: 1rem 0;
}

/* ─── Empty State ───────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--color-text-muted);
    text-align: center;
}

.empty-state i { font-size: 2.5rem; margin-bottom: 0.75rem; color: var(--color-green-dark); }
.empty-state p { font-size: 0.85rem; }

/* ─── RTL / Arabic Letter-Spacing Reset ─────────────────────── */
/* Positive letter-spacing breaks Arabic cursive joining (ligatures). */
/* We reset it to normal in RTL mode to ensure letters stay connected. */
html[dir="rtl"] *, 
html[dir="rtl"] ::placeholder {
    letter-spacing: normal !important;
}
