:root {
    /* Color Palette */
    --bg-dark: #0f1115;
    --glass-bg: rgba(22, 25, 33, 0.45);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary: #6d28d9;      /* Deep vibrant purple */
    --primary-hover: #5b21b6;
    --accent: #0ea5e9;       /* Light blue for accents */
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);

    /* Typography */
    --font-family: 'Plus Jakarta Sans', sans-serif;
    
    /* Layout */
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Gradients for depth */
.bg-grad-1, .bg-grad-2 {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.4;
    animation: drift 20s infinite alternate;
}
.bg-grad-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -200px;
    left: -100px;
}
.bg-grad-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    bottom: -150px;
    right: -100px;
    animation-delay: -10s;
}

@keyframes drift {
    100% { transform: translateY(50px) translateX(20px); }
}

/* Glassmorphism Panel Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
}

/* Layout */
.layout {
    display: flex;
    min-height: 100vh;
    padding: 1.5rem;
    gap: 1.5rem;
}

/* Sidebar */
.sidebar {
    width: 260px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    position: relative;
}

.brand-icon {
    font-size: 2rem;
    color: var(--accent);
}

.brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.badge-role {
    font-size: 0.65rem;
    background: var(--success-bg);
    color: var(--success);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    position: absolute;
    top: -10px;
    right: 0;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
    text-align: left;
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-left: 3px solid var(--accent);
}

.sidebar-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.tab-content {
    padding: 2.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.header-action {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(109, 40, 217, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(109, 40, 217, 0.4);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.w-full { width: 100%; }

/* Filters */
.filters-bar {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Forms & Inputs */
.input-field {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-family: inherit;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    width: 100%;
    transition: var(--transition);
    outline: none;
}

.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.filter-input {
    padding: 0.5rem 0.75rem;
    width: auto;
    font-size: 0.9rem;
}

select.input-field option {
    background: var(--bg-dark);
}

.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.row-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Table */
.table-container {
    flex-grow: 1;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

/* Custom Scrollbar for container */
.table-container::-webkit-scrollbar { width: 6px; }
.table-container::-webkit-scrollbar-track { background: transparent; }
.table-container::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 10px; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    padding: 1.25rem 1.5rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    background: rgba(22, 25, 33, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.data-table td {
    padding: 1.25rem 1.5rem;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.badge-daily { background: rgba(14, 165, 233, 0.15); color: var(--accent); }
.badge-monthly { background: rgba(109, 40, 217, 0.15); color: #a78bfa; }

.badge-cours { background: var(--warning-bg); color: var(--warning); }
.badge-fini { background: var(--success-bg); color: var(--success); }

/* Status Toggle (Clickable badge) */
.toggle-status {
    cursor: pointer;
    transition: transform 0.2s;
}
.toggle-status:hover {
    transform: scale(1.05);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    transform: translateY(20px) scale(0.95);
    transition: var(--transition);
    background: #13161c; /* slightly darker base */
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateY(100px);
    opacity: 0;
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Helpers */
.loading-state {
    text-align: center;
    padding: 3rem !important;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .layout { flex-direction: column; padding: 1rem; }
    .sidebar { width: 100%; padding: 1rem; flex-direction: row; justify-content: space-between; align-items: center; border-radius: var(--radius-lg); margin-bottom: 0.5rem; }
    .brand { margin-bottom: 0; }
    .nav-menu { flex-direction: row; justify-content: flex-end; }
    .nav-item { padding: 0.5rem 1rem; }
    .sidebar-footer { display: none; }
    .tab-content { padding: 1.5rem; }
    .filters-bar { flex-direction: column; align-items: stretch; gap: 1rem; }
}
