/* ====================================================================
   Master MAID — Design System v2.0
   Premium Blue Theme (#043c99) — Full Glassmorphism
   ==================================================================== */

/* -------- Google Fonts (also loaded via HTML) -------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ===================== CSS VARIABLES ===================== */
:root {
    /* BRAND COLORS */
    --blue-900: #021f52;
    --blue-800: #032d73;
    --blue-700: #043c99;       /* PRIMARY */
    --blue-600: #0a52cc;
    --blue-500: #1a6ae8;
    --blue-400: #4d8ef5;
    --blue-300: #7eb4ff;
    --blue-200: #b3d1ff;
    --blue-100: #e0ecff;

    /* SEMANTIC */
    --primary:       #043c99;
    --primary-dark:  #032d73;
    --primary-light: #1a6ae8;
    --blue-pale:     #7eb4ff;
    --blue-lighter:  #4d8ef5;

    /* STATUS */
    --success:       #10b981;
    --success-dark:  #059669;
    --warning:       #f59e0b;
    --warning-dark:  #d97706;
    --danger:        #ef4444;
    --danger-dark:   #dc2626;
    --info:          #06b6d4;
    --info-dark:     #0891b2;

    /* GRADIENTS */
    --grad-primary:  linear-gradient(135deg, #043c99 0%, #1a6ae8 100%);
    --grad-deep:     linear-gradient(135deg, #021f52 0%, #043c99 60%, #0a52cc 100%);
    --grad-glow:     linear-gradient(135deg, #4d8ef5 0%, #7eb4ff 60%, #b3d1ff 100%);
    --grad-success:  linear-gradient(135deg, #10b981 0%, #059669 100%);
    --grad-danger:   linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --grad-warning:  linear-gradient(135deg, #f59e0b 0%, #d97706 100%);

    /* BACKGROUNDS */
    --bg-body:       #060d1f;
    --bg-card:       rgba(8, 15, 34, 0.85);
    --bg-hover:      rgba(4, 60, 153, 0.06);
    --bg-input:      rgba(10, 20, 50, 0.6);
    --bg-sidebar:    rgba(6, 11, 28, 0.95);

    /* TEXT */
    --text-white:    #ffffff;
    --text-bright:   #f1f5ff;
    --text-body:     #b8c7e8;
    --text-muted:    #7a8db5;
    --text-dim:      #4a5a82;
    --text-link:     #7eb4ff;

    /* BORDERS */
    --border-light:  rgba(4, 60, 153, 0.12);
    --border-default: rgba(4, 60, 153, 0.25);
    --border-strong: rgba(4, 60, 153, 0.5);

    /* SHADOWS */
    --shadow-sm:      0 2px 8px rgba(0,0,0,0.3);
    --shadow-md:      0 8px 24px rgba(0,0,0,0.4);
    --shadow-lg:      0 20px 60px rgba(0,0,0,0.5);
    --shadow-card:    0 8px 32px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.03);
    --shadow-blue-sm: 0 4px 16px rgba(4,60,153,0.25);
    --shadow-blue-md: 0 8px 32px rgba(4,60,153,0.35);
    --shadow-blue-lg: 0 16px 48px rgba(4,60,153,0.45);

    /* RADII */
    --radius-xs:   4px;
    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   20px;
    --radius-2xl:  24px;
    --radius-full: 9999px;

    /* TRANSITIONS */
    --transition-fast:   0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow:   0.4s ease;

    /* SPACING */
    --sidebar-width: 260px;
    --header-height: 64px;
    --content-pad:   28px;
}

/* ===================== LIGHT MODE ===================== */
[data-theme="light"] {
    --bg-body:       #f3f7fc;
    --bg-card:       #ffffff;
    --bg-header:     rgba(255, 255, 255, 0.92);
    --bg-hover:      rgba(4, 60, 153, 0.045);
    --bg-input:      #f4f7fb;
    --bg-input-focus:#ffffff;
    --bg-option:     #ffffff;
    --bg-sidebar:    #f9fbff;

    --text-white:    #0f172a;
    --text-bright:   #10213a;
    --text-body:     #334155;
    --text-muted:    #52627a;
    --text-dim:      #6b7a90;
    --text-link:     #0f4fb8;

    --border-light:  rgba(15, 23, 42, 0.08);
    --border-default: rgba(15, 23, 42, 0.14);
    --border-strong: rgba(15, 23, 42, 0.22);

    --shadow-card:    0 6px 24px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-md:      0 10px 28px rgba(15, 23, 42, 0.08);

    /* Light mode modal override */
    --bg-modal:       #ffffff;
    /* Alert text in light mode */
    --alert-success-text: #065f46;
    --alert-danger-text:  #991b1b;
    --alert-warning-text: #92400e;
    --alert-info-text:    #1e3a8a;
}

/* ===================== RESET ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--text-link); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--text-bright); }

h1,h2,h3,h4,h5 {
    color: var(--text-bright);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

img { max-width: 100%; display: block; }

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(4,60,153,0.35); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(4,60,153,0.55); }

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

/* ===================== SIDEBAR ===================== */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 90;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition-normal);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 200px;
    background: radial-gradient(ellipse at top, rgba(4,60,153,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 40px; height: 40px;
    background: var(--grad-primary);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-blue-sm);
    overflow: hidden;
    padding: 2px;
}

.sidebar-logo-text h2 {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-bright);
    letter-spacing: -0.01em;
    line-height: 1.1;
}

.sidebar-logo-text p {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-weight: 400;
    margin-top: 1px;
}

/* Sidebar Progress */
.sidebar-progress {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.sidebar-progress-label span:last-child {
    font-weight: 700;
    color: var(--blue-pale);
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 12px 12px 4px;
    margin-top: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.83rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
    cursor: pointer;
}

.nav-item:hover {
    background: rgba(4,60,153,0.12);
    color: var(--text-bright);
    transform: translateX(3px);
}

.nav-item.active {
    background: rgba(4,60,153,0.2);
    color: var(--blue-pale);
    font-weight: 600;
    box-shadow: inset 2px 0 0 var(--primary);
}

.nav-icon {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(4,60,153,0.1);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: background var(--transition-fast);
}

.nav-item:hover .nav-icon { background: rgba(4,60,153,0.2); }
.nav-item.active .nav-icon { background: rgba(4,60,153,0.25); }

.nav-check {
    margin-left: auto;
    color: var(--success);
    font-size: 0.8rem;
}

.nav-check--pending { color: var(--danger); }

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 10px 16px;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

/* Overlay for mobile */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 89;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.overlay.active { display: block; opacity: 1; }

/* ===================== MAIN CONTENT ===================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
}

/* Top Header */
.top-header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-header, rgba(6,13,31,0.9));
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 80;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: -0.01em;
}

.menu-toggle {
    width: 36px; height: 36px;
    background: rgba(4,60,153,0.1);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.menu-toggle:hover { background: rgba(4,60,153,0.2); color: var(--text-bright); }

.header-right { display: flex; align-items: center; gap: 14px; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    background: rgba(4,60,153,0.1);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
}

.user-avatar {
    width: 32px; height: 32px;
    background: var(--grad-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    font-weight: 800;
    color: white;
}

.user-chip-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-bright);
    line-height: 1.1;
}

.user-chip-role {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: capitalize;
}

/* Page Content */
.page-content {
    padding: var(--content-pad);
    flex: 1;
}

/* ===================== PAGE HEADER ===================== */
.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-bright);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.page-header-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===================== CARDS ===================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-fast);
}

.card:hover { border-color: var(--border-default); }

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.card-title-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.mb-4 { margin-bottom: 20px; }

/* ===================== STATS GRID ===================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    backdrop-filter: blur(20px);
    transition: all var(--transition-normal);
    cursor: default;
}

.stat-card:hover {
    border-color: var(--border-default);
    transform: translateY(-2px);
    box-shadow: var(--shadow-blue-sm);
}

.stat-card.stat-green { border-color: rgba(16,185,129,0.2); }
.stat-card.stat-green:hover { box-shadow: 0 4px 16px rgba(16,185,129,0.15); }
.stat-card.stat-orange { border-color: rgba(245,158,11,0.2); }
.stat-card.stat-cyan { border-color: rgba(6,182,212,0.2); }
.stat-card.stat-red { border-color: rgba(239,68,68,0.2); }

.stat-icon-box {
    font-size: 1.4rem;
    line-height: 1;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-bright);
    letter-spacing: -0.04em;
    line-height: 1;
}

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

.stat-change {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    width: fit-content;
}

.stat-change.up { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-change.down { background: rgba(239,68,68,0.1); color: var(--danger); }
.stat-change.neutral { background: rgba(4,60,153,0.1); color: var(--blue-pale); }

/* ===================== PROGRESS BAR ===================== */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(4,60,153,0.12);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--grad-primary);
    border-radius: var(--radius-full);
    transition: width 0.8s cubic-bezier(0.34,1.56,0.64,1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2.5s ease infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ===================== BADGES ===================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-brouillon {
    background: rgba(100,116,139,0.15);
    color: #94a3b8;
    border: 1px solid rgba(100,116,139,0.2);
}

.badge-en_cours {
    background: rgba(4,60,153,0.15);
    color: var(--blue-pale);
    border: 1px solid var(--border-default);
}

.badge-soumis {
    background: rgba(245,158,11,0.15);
    color: #fbbf24;
    border: 1px solid rgba(245,158,11,0.25);
}

.badge-valide {
    background: rgba(16,185,129,0.15);
    color: #34d399;
    border: 1px solid rgba(16,185,129,0.25);
}

.badge-rejete {
    background: rgba(239,68,68,0.15);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.25);
}

.badge-en_attente {
    background: rgba(245,158,11,0.1);
    color: #fbbf24;
    border: 1px solid rgba(245,158,11,0.2);
}

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all var(--transition-normal);
    white-space: nowrap;
    font-family: inherit;
    letter-spacing: 0.01em;
    line-height: 1;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, #043c99 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(4,60,153,0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(4,60,153,0.4);
    color: white;
}

.btn-secondary {
    background: rgba(4,60,153,0.12);
    color: var(--blue-pale);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(4,60,153,0.2);
    color: var(--text-bright);
    transform: translateY(-1px);
}

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

.btn-outline:hover:not(:disabled) {
    border-color: var(--border-default);
    color: var(--text-bright);
    background: rgba(4,60,153,0.06);
}

.btn-success {
    background: var(--grad-success);
    color: white;
    box-shadow: 0 4px 16px rgba(16,185,129,0.25);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16,185,129,0.35);
    color: white;
}

.btn-danger {
    background: var(--grad-danger);
    color: white;
    box-shadow: 0 4px 16px rgba(239,68,68,0.2);
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(239,68,68,0.35);
    color: white;
}

.btn-warning {
    background: var(--grad-warning);
    color: white;
    box-shadow: 0 4px 16px rgba(245,158,11,0.2);
}

.btn-warning:hover:not(:disabled) {
    transform: translateY(-2px);
    color: white;
}

.btn-sm { padding: 7px 14px; font-size: 0.78rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 13px 28px; font-size: 0.95rem; border-radius: var(--radius-lg); }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; border-radius: var(--radius-sm); }

/* ===================== FORMS ===================== */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-body);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.required { color: var(--danger); margin-left: 2px; }

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 0.85rem;
    z-index: 1;
    pointer-events: none;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 11px 14px 11px 42px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: #060d1f;
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 400;
    transition: all var(--transition-fast);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.form-input.no-icon, .form-select.no-icon, .form-textarea.no-icon {
    padding-left: 14px;
}

.form-textarea {
    resize: vertical;
    min-height: 90px;
    padding: 11px 14px;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: #ffb703;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(255,183,3,0.15), 0 0 20px rgba(255,183,3,0.1);
    color: #060d1f;
}

.form-input::placeholder, .form-textarea::placeholder {
    color: var(--text-dim);
}

.form-select option {
    background: var(--bg-option, #0a1630);
    color: var(--text-bright);
}

.form-select.no-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a8db5' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a8db5' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.field-error {
    color: #f87171;
    font-size: 0.75rem;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Form Layout helpers */
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

@media (max-width: 640px) {
    .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

/* Form Section */
.form-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.form-section:last-of-type { border-bottom: none; margin-bottom: 0; }

.form-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--blue-pale);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===================== ALERTS ===================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    margin-bottom: 12px;
    border: 1px solid transparent;
    animation: slide-down 0.3s ease;
}

.alert-icon { font-size: 1.1rem; flex-shrink: 0; line-height: 1.3; }
.alert-content { flex: 1; line-height: 1.5; }

.alert-success {
    background: rgba(16,185,129,0.08);
    border-color: rgba(16,185,129,0.2);
    color: #6ee7b7;
}

[data-theme="light"] .alert-success {
    background: rgba(16,185,129,0.1);
    border-color: rgba(16,185,129,0.35);
    color: #065f46;
}

.alert-danger, .alert-error {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.2);
    color: #fca5a5;
}

[data-theme="light"] .alert-danger, [data-theme="light"] .alert-error {
    background: rgba(239,68,68,0.07);
    border-color: rgba(239,68,68,0.3);
    color: #991b1b;
}

.alert-warning {
    background: rgba(245,158,11,0.08);
    border-color: rgba(245,158,11,0.2);
    color: #fcd34d;
}

[data-theme="light"] .alert-warning {
    background: rgba(245,158,11,0.08);
    border-color: rgba(245,158,11,0.3);
    color: #92400e;
}

.alert-info {
    background: rgba(4,60,153,0.1);
    border-color: var(--border-default);
    color: var(--blue-pale);
}

[data-theme="light"] .alert-info {
    background: rgba(4,60,153,0.06);
    border-color: rgba(4,60,153,0.2);
    color: #1e3a8a;
}

/* ===================== TABLE ===================== */
.table-container {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-responsive { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.data-table thead tr {
    background: rgba(4,60,153,0.15);
    border-bottom: 1px solid var(--border-default);
}

.data-table thead th {
    padding: 13px 16px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid rgba(4,60,153,0.06);
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover { background: var(--bg-hover); }

.data-table tbody td {
    padding: 13px 16px;
    vertical-align: middle;
}

.table-candidate-name {
    font-weight: 600;
    color: var(--text-bright);
    font-size: 0.83rem;
    line-height: 1.2;
}

.table-candidate-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1px;
}

/* ===================== PAGINATION ===================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 20px 0 4px;
}

.page-link {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(4,60,153,0.08);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.page-link:hover { background: rgba(4,60,153,0.18); color: var(--text-bright); border-color: var(--border-default); }
.page-link.active { background: var(--grad-primary); color: white; border-color: transparent; box-shadow: var(--shadow-blue-sm); }

/* ===================== FILTER BAR ===================== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
}

.filter-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-dim);
    margin-right: 4px;
}

/* ===================== DETAIL SECTIONS ===================== */
.detail-section {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: 16px;
    transition: border-color var(--transition-fast);
}

.detail-section:hover { border-color: var(--border-default); }

.detail-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(4,60,153,0.06);
    border-bottom: 1px solid var(--border-light);
    cursor: default;
}

.detail-section-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.detail-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-bright);
}

.detail-body {
    padding: 20px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.detail-field label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
    margin-bottom: 4px;
}

.detail-field .val {
    font-size: 0.875rem;
    color: var(--text-bright);
    font-weight: 500;
}

/* ===================== DOCUMENT ITEMS ===================== */
.doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(4,60,153,0.05);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    flex-wrap: wrap;
    gap: 10px;
}

.doc-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
}

.doc-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }

.doc-icon-box {
    width: 40px; height: 40px;
    background: rgba(4,60,153,0.1);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.doc-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-bright);
    line-height: 1.2;
}

.doc-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===================== CHECK ITEMS ===================== */
.check-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast);
}

.check-item.done {
    background: rgba(16,185,129,0.05);
    border-color: rgba(16,185,129,0.15);
}

.check-item-left { display: flex; align-items: center; gap: 10px; }
.check-item-icon { font-size: 1rem; }
.check-item-label { font-size: 0.8rem; font-weight: 500; color: var(--text-body); }
.check-item-status { font-size: 0.9rem; }

/* ===================== PARCOURS CARDS ===================== */
.parcours-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

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

.parcours-card {
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.parcours-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--grad-primary);
    transform: scaleX(0);
    transition: transform var(--transition-normal);
    transform-origin: left;
}

.parcours-card:hover {
    border-color: var(--border-default);
    transform: translateY(-4px);
    box-shadow: var(--shadow-blue-sm);
}

.parcours-card:hover::before, .parcours-card.selected::before {
    transform: scaleX(1);
}

.parcours-card.selected {
    border-color: var(--primary);
    background: rgba(4,60,153,0.08);
    box-shadow: 0 0 0 1px rgba(4,60,153,0.2), var(--shadow-blue-sm);
}

.parcours-icon { font-size: 2.5rem; line-height: 1; }
.parcours-title { font-size: 1.1rem; font-weight: 800; color: var(--text-bright); }
.parcours-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.7; }

.parcours-selected-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: rgba(4,60,153,0.15);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--blue-pale);
    width: fit-content;
}

/* Check group */
.check-group {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.check-group.selected {
    background: rgba(4,60,153,0.08);
    border-color: var(--border-default);
}

.check-group input[type=checkbox] {
    width: 18px; height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--primary);
}

/* ===================== UPLOAD ZONE ===================== */
.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-align: center;
    transition: all var(--transition-fast);
    padding: 24px 16px;
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--primary);
    background: rgba(4,60,153,0.06);
}

.upload-zone-icon { font-size: 1.6rem; }
.upload-zone-title { font-size: 0.8rem; font-weight: 600; color: var(--text-body); }
.upload-zone-sub { font-size: 0.72rem; color: var(--text-dim); }

/* Uploaded state */
.upload-zone-uploaded {
    border-style: solid;
    border-color: rgba(16,185,129,0.3);
    background: rgba(16,185,129,0.04);
    flex-direction: row;
    text-align: left;
    align-items: flex-start;
    justify-content: flex-start;
}

.upload-zone-uploaded:hover {
    border-color: rgba(16,185,129,0.5);
    background: rgba(16,185,129,0.07);
}

[data-theme="light"] .upload-zone-uploaded {
    background: rgba(16,185,129,0.05);
    border-color: rgba(16,185,129,0.4);
}

/* ===================== MODULES (SEMESTRES) ===================== */
.module-row {
    display: grid;
    grid-template-columns: 1fr 100px auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
    transition: all var(--transition-fast);
}

.module-row:last-child { border-bottom: none; }

.module-delete-btn {
    width: 36px; height: 36px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius-sm);
    color: #f87171;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    margin-bottom: 16px;
}

.module-delete-btn:hover {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.4);
    transform: scale(1.05);
}

/* ===================== TABS ===================== */
.tabs-wrapper {
    display: flex;
    gap: 4px;
    background: rgba(4,60,153,0.06);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 4px;
    width: fit-content;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.tab-btn:hover { color: var(--text-bright); background: rgba(4,60,153,0.1); }
.tab-btn.active { background: var(--grad-primary); color: white; box-shadow: var(--shadow-blue-sm); }
.tab-btn.filled { color: var(--success); }

/* ===================== MODAL ===================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.show { display: flex; }

.modal-box {
    background: var(--bg-modal, rgba(8,15,34,0.98));
    border: 1px solid var(--border-default);
    border-radius: var(--radius-2xl);
    padding: 36px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-box h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-bright);
    margin-bottom: 10px;
}

.modal-box p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* ===================== EMPTY STATE ===================== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { color: var(--text-body); font-size: 1rem; margin-bottom: 6px; }
.empty-state p { font-size: 0.85rem; color: var(--text-dim); }

/* ===================== UTILITY CLASSES ===================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.text-muted { color: var(--text-muted) !important; }
.text-bright { color: var(--text-bright); }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ===================== ANIMATIONS ===================== */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes glow-pulse {
    0%,100% { box-shadow: 0 0 20px rgba(4,60,153,0.4); }
    50% { box-shadow: 0 0 40px rgba(4,60,153,0.7); }
}

@keyframes pulse {
    0%,100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bounce {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.animate-fade-in { animation: fadeIn 0.4s ease both; }
.animate-slide-down { animation: slide-down 0.3s ease both; }
.animate-slideIn { animation: slideUp 0.4s ease both; }

/* ===================== INPUT WRAPPER — no-icon ===================== */
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle { display: flex !important; }
}

@media (max-width: 768px) {
    :root {
        --content-pad: 16px;
    }

    .page-header h1 { font-size: 1.4rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr 1fr; }
    .parcours-grid { grid-template-columns: 1fr; }
    .module-row { grid-template-columns: 1fr 80px auto; }
    .form-row-2 { grid-template-columns: 1fr; }
    .tabs-wrapper { width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .filter-bar { gap: 6px; }
    .modal-box { padding: 24px 20px; }
}


/* ===================== REGISTRATION CLOSED ===================== */
.registration-closed-card {
    border: 1px solid rgba(4, 60, 153, 0.18);
    box-shadow: var(--shadow-card);
}

.registration-closed-kicker {
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}

.registration-closed {
    display: grid;
    gap: 14px;
    padding: 8px 2px 0;
    text-align: center;
}

.registration-closed__icon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    margin: 0 auto;
    border-radius: 18px;
    background: rgba(245, 158, 11, 0.14);
    color: #f59e0b;
    font-size: 1.15rem;
}

.registration-closed h2 {
    margin: 0;
    color: var(--text-bright);
    font-size: 1.4rem;
    line-height: 1.2;
}

.registration-closed p {
    margin: 0 auto;
    max-width: 44ch;
    color: var(--text-muted);
    line-height: 1.6;
}

.registration-closed__actions {
    display: grid;
    gap: 10px;
    margin-top: 8px;
}
