/* =============================================
   FLEXCAMPUS ADMIN - STYLES
   ============================================= */

:root {
    /* Couleurs Primaires - Bleu Marine */
    --primary: #0d3865;
    --primary-dark: #092847;
    --primary-light: #1a4a7a;

    /* Couleurs Secondaires - Cyan/Turquoise */
    --secondary: #6dcbdd;
    --secondary-light: #8ed8e6;
    --secondary-dark: #4fb8cc;

    /* Couleurs Fonctionnelles */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Couleurs de Base */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;

    /* Alias */
    --bg-primary: var(--gray-50);
    --bg-secondary: var(--white);
    --text-primary: var(--gray-800);
    --text-secondary: var(--gray-600);
    --text-muted: var(--gray-500);
    --border: var(--gray-200);

    /* Layout */
    --sidebar-width: 260px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
}

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

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

/* =============================================
   LOGIN PAGE
   ============================================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: all var(--transition-base);
}

.login-form input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(109, 203, 221, 0.2);
}

.error-message {
    color: var(--danger);
    font-size: 14px;
    margin-top: 16px;
    text-align: center;
}

/* =============================================
   ADMIN APP LAYOUT
   ============================================= */

.admin-app {
    display: flex;
    min-height: 100vh;
}

/* =============================================
   SIDEBAR
   ============================================= */

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--white);
}

.admin-badge {
    background: var(--secondary);
    color: var(--primary-dark);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all var(--transition-base);
    margin-bottom: 4px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.nav-item.active {
    background: var(--secondary);
    color: var(--primary-dark);
    font-weight: 600;
}

.nav-icon {
    font-size: 18px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    font-size: 24px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: var(--white);
    font-weight: 500;
    font-size: 14px;
}

.user-role {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    text-transform: capitalize;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 18px;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Hide superadmin-only elements for non-superadmins */
body:not(.is-superadmin) .superadmin-only {
    display: none !important;
}

/* Hide admin-only elements for editors */
body.is-editor .admin-only {
    display: none !important;
}

/* Hide admin-above-only elements for editors (visible for admin and superadmin) */
body.is-editor .admin-above-only {
    display: none !important;
}

/* Hide admin-required elements for editors (visible for admin and superadmin) */
body.is-editor .admin-required {
    display: none !important;
}

/* Role-specific restrictions */
body.is-editor .btn-delete-formation,
body.is-editor .btn-delete-bloc,
body.is-editor .btn-create-formation,
body.is-editor .btn-create-bloc {
    display: none !important;
}

/* =============================================
   MAIN CONTENT
   ============================================= */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-height: 100vh;
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn var(--transition-base);
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.section-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* =============================================
   BUTTONS
   ============================================= */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(109, 203, 221, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(109, 203, 221, 0.4);
}

.btn-secondary {
    background: var(--white);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

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

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
}

/* =============================================
   STATS GRID
   ============================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 32px;
    background: var(--gray-100);
    padding: 12px;
    border-radius: var(--radius-sm);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 13px;
}

/* =============================================
   CARDS
   ============================================= */

.card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-list {
    min-height: 200px;
}

.activity-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-text {
    font-size: 14px;
    color: var(--text-primary);
}

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
}

/* =============================================
   THEMES LIST
   ============================================= */

.themes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.theme-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid var(--border);
    transition: all var(--transition-base);
    position: relative;
}

.theme-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--theme-color, var(--secondary));
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.theme-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.theme-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.theme-icon {
    font-size: 32px;
}

.theme-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.theme-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.theme-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.theme-actions {
    display: flex;
    gap: 8px;
}

/* =============================================
   FILTERS BAR
   ============================================= */

.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.filter-select {
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--white);
    min-width: 180px;
    cursor: pointer;
    transition: all var(--transition-base);
}

.filter-select:focus {
    outline: none;
    border-color: var(--secondary);
}

/* =============================================
   TABLES
   ============================================= */

.exercises-table,
.students-table,
.users-table {
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

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

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

th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    font-size: 14px;
}

tr:hover {
    background: var(--gray-50);
}

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

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.published {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.draft {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.3;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.inactive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.role-badge.superadmin {
    background: rgba(109, 203, 221, 0.2);
    color: var(--primary);
}

.role-badge.editor {
    background: rgba(100, 116, 139, 0.1);
    color: var(--gray-600);
}

.table-actions {
    display: flex;
    gap: 8px;
}

.table-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.table-actions button:hover {
    background: var(--gray-100);
}

/* =============================================
   EXERCISE ROW
   ============================================= */

.exercise-row {
    display: grid;
    grid-template-columns: 1fr 150px 100px 120px 100px;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    transition: all var(--transition-base);
}

.exercise-row:hover {
    background: var(--gray-50);
}

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

.exercise-title {
    font-weight: 500;
    color: var(--text-primary);
}

.exercise-theme {
    font-size: 13px;
    color: var(--text-secondary);
}

.difficulty-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.difficulty-badge.débutant {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.difficulty-badge.intermédiaire {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.difficulty-badge.avancé {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* =============================================
   SETTINGS
   ============================================= */

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.settings-grid .form-group {
    margin-bottom: 16px;
}

.settings-grid label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.settings-grid input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all var(--transition-base);
}

.settings-grid input:focus {
    outline: none;
    border-color: var(--secondary);
}

/* =============================================
   MODALS
   ============================================= */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn var(--transition-base);
}

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

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-base);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal form {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition-base);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--secondary);
}

.form-group input[type="color"] {
    height: 44px;
    padding: 4px;
    cursor: pointer;
}

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

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

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.3s ease;
    min-width: 280px;
    border-left: 4px solid var(--info);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

.toast-icon {
    font-size: 18px;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =============================================
   RESPONSIVE
   ============================================= */

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

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }

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

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .section-header {
        flex-direction: column;
        gap: 16px;
    }

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

    .filters-bar {
        flex-direction: column;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* =============================================
   SCROLLBAR
   ============================================= */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* =============================================
   SECTION DATA - SUPERADMIN
   ============================================= */

.data-tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.data-table-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.data-table-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.data-table-card .table-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.data-table-card .table-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.data-table-card .table-count {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.data-table-card .table-count strong {
    color: var(--primary);
    font-size: 1.25rem;
}

/* Data Table View */
.data-table-view {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.data-table-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.data-table-header h2 {
    flex: 1;
    margin: 0;
    font-size: 1.25rem;
}

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

.data-table-actions .search-input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    width: 200px;
}

.data-table-container {
    overflow-x: auto;
    margin-bottom: 1rem;
}

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

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
}

.data-table tr:hover td {
    background: var(--gray-50);
}

.data-table .pk-column {
    color: var(--primary);
    font-weight: 600;
}

.data-table .actions-cell {
    white-space: nowrap;
}

.data-table .btn-delete {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
}

.data-table .btn-delete:hover {
    background: #dc2626;
}

/* Data Pagination */
.data-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.data-pagination .pagination-info {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.data-pagination .pagination-buttons {
    display: flex;
    gap: 0.5rem;
}

.data-pagination .btn-page {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
}

.data-pagination .btn-page:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--primary);
}

.data-pagination .btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.data-pagination .btn-page.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Role badges */
.role-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.role-badge.superadmin {
    background: #fee2e2;
    color: #dc2626;
}

.role-badge.admin {
    background: #fef3c7;
    color: #d97706;
}

.role-badge.editor {
    background: #dbeafe;
    color: #2563eb;
}

.badge-current {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    background: #e0f2fe;
    color: #0284c7;
    border-radius: 4px;
}

/* =============================================
   FORMATIONS HIERARCHY - BREADCRUMB
   ============================================= */

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--white);
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.breadcrumb-item {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-item.active {
    color: var(--primary);
    font-weight: 600;
}

.breadcrumb-item.clickable {
    cursor: pointer;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.breadcrumb-item.clickable:hover {
    color: var(--secondary-dark);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-muted);
    font-weight: 300;
    font-size: 16px;
}

/* =============================================
   FORMATIONS HIERARCHY - CONTAINERS
   ============================================= */

.hierarchy-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.hierarchy-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.hierarchy-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    grid-column: 1 / -1;
}

/* =============================================
   FORMATIONS HIERARCHY - CARDS
   ============================================= */

.hierarchy-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

.hierarchy-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* Formation card styling */
.formation-card::before {
    background: var(--card-color, var(--secondary));
}

.formation-card:hover {
    border-color: var(--card-color, var(--secondary));
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* Bloc card styling */
.bloc-card::before {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.bloc-card:hover {
    border-color: #8b5cf6;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.15);
}

/* Module card styling */
.module-card::before {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.module-card:hover {
    border-color: #10b981;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.15);
}

.card-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.card-content {
    flex: 1;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.card-code {
    font-size: 12px;
    color: var(--text-muted);
    font-family: 'Monaco', 'Consolas', monospace;
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 8px;
}

.card-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-stats {
    display: flex;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.stat-item {
    font-size: 13px;
    color: var(--text-muted);
}

.card-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.hierarchy-card:hover .card-actions {
    opacity: 1;
}

.card-actions button {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 12px;
    transition: all var(--transition-fast);
}

/* =============================================
   EMPTY STATE CARD
   ============================================= */

.empty-state-card {
    background: var(--gray-50);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 48px 24px;
    text-align: center;
    grid-column: 1 / -1;
}

.empty-state-card .empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

/* =============================================
   EXERCISES TABLE IN MODULE VIEW
   ============================================= */

#module-exercises-list .exercises-table {
    margin-top: 16px;
}

#module-exercises-list .hierarchy-header {
    border-bottom: none;
    margin-bottom: 8px;
}

/* =============================================
   LOADING SPINNER
   ============================================= */

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    grid-column: 1 / -1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 14px;
}

.error-state {
    color: var(--danger);
    text-align: center;
    padding: 40px;
    font-size: 14px;
    grid-column: 1 / -1;
}

/* =============================================
   LABS SECTION
   ============================================= */

.labs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.lab-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition-base);
}

.lab-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.lab-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.lab-card-header .lab-icon {
    font-size: 32px;
}

.lab-card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.deploy-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.deploy-badge.deployed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.lab-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.lab-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.lab-actions .btn {
    flex: 1;
    min-width: 140px;
    text-align: center;
    text-decoration: none;
}

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

.btn-outline:hover {
    background: var(--gray-50);
}

/* Lab Card Featured */
.lab-card-featured {
    border: 2px solid var(--primary);
    background: linear-gradient(135deg, #f0f9ff 0%, #fff 100%);
}

.lab-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.lab-badge-new {
    background: #dcfce7;
    color: #15803d;
}

.lab-specs {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.lab-specs span {
    background: var(--gray-100);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.lab-credentials {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.lab-credentials small {
    color: var(--text-secondary);
    font-size: 12px;
}

.lab-credentials code {
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    color: var(--primary);
}

/* Labs Stats Card */
.labs-stats-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.labs-stats-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.labs-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 24px;
    margin-bottom: 16px;
}

.labs-stat-item {
    text-align: center;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.labs-stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.labs-stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

.labs-stats-note {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    margin-top: 12px;
}

/* Labs Preview Card */
.labs-preview-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.labs-preview-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.labs-iframe-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--gray-100);
}

.labs-iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Labs Sub-tabs */
.labs-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.labs-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.labs-tab:hover {
    color: var(--primary);
}

.labs-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* Template Tag */
.template-tag-row {
    margin-bottom: 12px;
}

.template-tag {
    display: inline-block;
    background: var(--gray-100);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Monaco', monospace;
    font-size: 12px;
    color: var(--primary);
    margin-right: 8px;
}

/* Templates Header */
.templates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.templates-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* AI Generate Section */
.ai-generate-section {
    background: linear-gradient(135deg, #f0f9ff 0%, #faf5ff 100%);
    border: 1px solid #c7d2fe;
    margin-bottom: 24px;
}

.ai-generate-header {
    margin-bottom: 16px;
}

.ai-generate-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
}

.ai-generate-header p {
    font-size: 13px;
    color: var(--text-secondary);
}

.ai-generate-form {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.ai-generate-form textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.ai-generate-form .btn {
    white-space: nowrap;
    margin-top: 2px;
}

/* AI Dockerfile Result */
.ai-dockerfile-result {
    margin-top: 16px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.dockerfile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.dockerfile-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.dockerfile-header .btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.dockerfile-code {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
    outline: none;
    margin-bottom: 12px;
}

.dockerfile-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ai-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.ai-loading .spinner {
    width: 20px;
    height: 20px;
}

/* Test Lab Modal (fullscreen) */
.test-lab-modal .modal-content,
.test-lab-content {
    width: 95vw;
    max-width: none;
    height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.test-lab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--primary);
    color: white;
}

.test-lab-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.test-lab-iframe {
    flex: 1;
    width: 100%;
    border: none;
}

/* Btn small helper */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* =============================================
   CLASSROOM SESSIONS
   ============================================= */

.classroom-create-section {
    margin-bottom: 1.5rem;
}

.classroom-create-section h3 {
    margin-bottom: 1rem;
}

.classroom-create-form .form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.classroom-create-form .form-group {
    flex: 1;
    min-width: 180px;
}

.classroom-create-form .form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.85rem;
    color: #64748b;
}

.classroom-create-form input,
.classroom-create-form select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
}

.classroom-sessions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.classroom-session-card {
    margin-bottom: 0.75rem;
    transition: border-color 0.2s;
}

.classroom-session-card.session-active {
    border-left: 4px solid #10b981;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.session-header h4 {
    margin: 0;
    font-size: 1rem;
}

.session-meta {
    font-size: 0.8rem;
    color: #64748b;
}

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

.session-error {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #fef2f2;
    border-radius: 6px;
    color: #dc2626;
    font-size: 0.85rem;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 6px;
}

.btn-danger:hover {
    background: #dc2626;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
}

/* Data table for classroom detail */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th,
.data-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}
