body {
    background-color: #0f172a;
    color: #f8fafc;
    background-image: radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
}

:root {
    --dark-900: #0f172a;
    --dark-800: #1e293b;
    --dark-700: #334155;
    --dark-600: #475569;

    /* Tailwind-like spacing/radius tokens (for our UI utility classes) */
    --p-2: 0.5rem;
    --rounded: 0.25rem;

    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-cyan: #22d3ee;
    --accent-success: #10b981;
    --accent-error: #ef4444;
    --accent-expert: #ec4899;
    --accent-warning: #f59e0b;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;

    --white: #ffffff;
}

.katex {
    vertical-align: -0.1em;
}
.katex { font-size: 1.25em; }
.correction-math .katex { font-size: 1.5em; }

.card {
    background-color: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.card:hover {
    background-color: rgba(30, 41, 59, 0.9);
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-4px);
    box-shadow: 0 10px 40px -10px rgba(99, 102, 241, 0.3);
}

.btn-active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-color: transparent;
    color: white !important;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

/* Reusable UI primitives (no Tailwind build needed) */
.glass-panel {
    background-color: rgba(30, 41, 59, 0.55);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.app-shell {
    width: 100%;
    max-width: 96rem;
    margin: 0 auto;
}

.app-header {
    margin-bottom: 3rem;
    text-align: center;
}

.app-header__eyebrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.app-header__title {
    margin: 0;
    color: var(--white);
    font-size: clamp(2rem, 4vw, 3.75rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.app-header__description {
    max-width: 56rem;
    margin: 1rem auto 0;
    color: var(--slate-400);
    font-size: 1rem;
    line-height: 1.65;
}

.app-header__actions {
    max-width: 56rem;
    margin: 2rem auto 0;
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
}

.ui-cta-panel {
    display: block;
    width: 100%;
    padding: 1.25rem 1.5rem;
    text-align: left;
    border-radius: 1rem;
    border: 1px solid rgba(71, 85, 105, 0.75);
    background: rgba(15, 23, 42, 0.55);
    box-shadow: 0 16px 40px -24px rgba(15, 23, 42, 0.85);
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.ui-cta-panel:hover {
    transform: translateY(-2px);
    background: rgba(15, 23, 42, 0.72);
}

.ui-cta-panel__content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.ui-cta-panel__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 0.9rem;
    background: rgba(51, 65, 85, 0.55);
    color: var(--accent-primary);
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.ui-cta-panel:hover .ui-cta-panel__icon {
    transform: scale(1.04);
}

.ui-cta-panel__title {
    color: var(--white);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
}

.ui-cta-panel__description {
    margin-top: 0.35rem;
    color: var(--slate-400);
    font-size: 0.875rem;
    line-height: 1.5;
}

.ui-cta-panel--primary {
    border-color: rgba(99, 102, 241, 0.35);
}

.ui-cta-panel--primary:hover {
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 20px 44px -24px rgba(99, 102, 241, 0.45);
}

.ui-cta-panel--primary .ui-cta-panel__icon {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-primary);
}

.ui-cta-panel--primary:hover .ui-cta-panel__icon {
    background: var(--accent-primary);
    color: var(--white);
}

.ui-cta-panel--secondary {
    border-color: rgba(139, 92, 246, 0.35);
}

.ui-cta-panel--secondary:hover {
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 20px 44px -24px rgba(139, 92, 246, 0.45);
}

.ui-cta-panel--secondary .ui-cta-panel__icon {
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-secondary);
}

.ui-cta-panel--secondary:hover .ui-cta-panel__icon {
    background: var(--accent-secondary);
    color: var(--white);
}

.ui-cta-panel--warning {
    border-color: rgba(245, 158, 11, 0.35);
}

.ui-cta-panel--warning:hover {
    border-color: rgba(245, 158, 11, 0.6);
    box-shadow: 0 20px 44px -24px rgba(245, 158, 11, 0.45);
}

.ui-cta-panel--warning .ui-cta-panel__icon {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-warning);
}

.ui-cta-panel--warning:hover .ui-cta-panel__icon {
    background: var(--accent-warning);
    color: var(--white);
}

.ui-cta-panel--danger {
    border-color: rgba(239, 68, 68, 0.35);
}

.ui-cta-panel--danger:hover {
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 20px 44px -24px rgba(239, 68, 68, 0.45);
}

.ui-cta-panel--danger .ui-cta-panel__icon {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-error);
}

.ui-cta-panel--danger:hover .ui-cta-panel__icon {
    background: var(--accent-error);
    color: var(--white);
}

.ui-cta-panel--expert {
    border-color: rgba(236, 72, 153, 0.35);
}

.ui-cta-panel--expert:hover {
    border-color: rgba(236, 72, 153, 0.6);
    box-shadow: 0 20px 44px -24px rgba(236, 72, 153, 0.45);
}

.ui-cta-panel--expert .ui-cta-panel__icon {
    background: rgba(236, 72, 153, 0.12);
    color: var(--accent-expert);
}

.ui-cta-panel--expert:hover .ui-cta-panel__icon {
    background: var(--accent-expert);
    color: var(--white);
}

/* Checkbox grid (favorite topics) */
.ui-checkbox-grid {
    display: grid;
    gap: 0.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ui-checkbox-grid li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(51, 65, 85, 0.6);
    color: var(--slate-200);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.ui-checkbox-grid li:hover {
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(30, 41, 59, 0.7);
}

.ui-checkbox-grid input[type="checkbox"] {
    margin-top: 0.2rem;
    accent-color: var(--accent-primary);
}

.ui-checkbox-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.875rem;
    line-height: 1.3;
}

.ui-checkbox-grid label span {
    color: var(--slate-400);
    font-size: 0.75rem;
}


/* ACCORDION ANIMATIONS */
details>summary {
    list-style: none;
}

details>summary::-webkit-details-marker {
    display: none;
}

/* Rotation du chevron quand ouvert */
details[open]>summary .chevron {
    transform: rotate(180deg);
}

.chevron {
    transition: transform 0.2s ease-in-out;
}

/* Animation d'ouverture douce (hack CSS simple) */
details[open] summary~* {
    animation: sweep .3s ease-in-out;
}

@keyframes sweep {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0f172a;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}


/* TABLE: Style global du tableau */
.custom-table {
    width: 100%;
    text-align: left;
    font-size: 0.875rem;
    /* text-sm */
    color: #94a3b8;
    /* text-slate-400 */
    border-collapse: collapse;
    /* Essentiel pour les bordures */
}

/* THEAD: En-tête du tableau (Fond 900 demandé) */
.custom-thead {
    background-color: #0f172a;
    /* bg-dark-900 */
    color: #cbd5e1;
    /* text-slate-300 */
    font-size: 0.75rem;
    /* text-xs */
    text-transform: uppercase;
    border-bottom: 1px solid #475569;
    /* border-dark-600 */
}

/* TH: Cellules d'en-tête */
.custom-th {
    padding: 1rem 1.5rem;
    /* px-6 py-4 */
    font-weight: 600;
    /* font-semibold */
    letter-spacing: 0.025em;
    /* tracking-wide */
}

/* TR: Lignes du tableau */
.custom-tr {
    border-bottom: 1px solid #334155;
    /* divide-dark-700 */
    transition: background-color 150ms;
}

/* Suppression de la bordure pour la dernière ligne */
.custom-tr:last-child {
    border-bottom: none;
}

/* Effet Hover */
.custom-tr:hover {
    background-color: rgba(30, 41, 59, 0.5);
    /* hover:bg-dark-800/50 */
}

.qb-row-actions,
.table-row-actions {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.custom-tr:hover .qb-row-actions,
.custom-tr:focus-within .qb-row-actions,
.custom-tr:hover .table-row-actions,
.custom-tr:focus-within .table-row-actions {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.table-action-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    color: rgba(255, 255, 255, 0.92);
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    opacity: 0.78;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.table-action-icon:hover,
.table-action-icon:focus-visible {
    opacity: 1;
    background-color: rgba(148, 163, 184, 0.16);
    outline: none;
}

.table-action-icon svg {
    width: 0.95rem;
    height: 0.95rem;
}

.table-action-tooltip {
    pointer-events: none;
    position: absolute;
    left: 50%;
    top: -2.1rem;
    transform: translateX(-50%);
    white-space: nowrap;
    border-radius: 0.45rem;
    border: 1px solid #334155;
    background: #0f172a;
    padding: 0.1rem 0.45rem;
    font-size: 0.62rem;
    font-weight: 700;
    color: #e2e8f0;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.table-action-icon:hover .table-action-tooltip,
.table-action-icon:focus-visible .table-action-tooltip {
    opacity: 1;
}

/* TD: Cellules de données */
.custom-td {
    padding: 1rem 1.5rem;
    /* px-6 py-4 */
    vertical-align: middle;
}

/* Alignement à droite pour la colonne Actions */
.custom-td.actions {
    text-align: right;
}

/* --- NOUVEAU STYLE : EN-TÊTE DU TABLEAU --- */
.table-header-container {
    padding: 1.25rem 1.5rem;
    /* p-5 p-6 */
    border-bottom: 1px solid #334155;
    /* border-dark-700 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.3);
    /* Fond légèrement plus foncé */
}

.table-heading-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.table-action-btn {
    display: flex; align-items: center; gap: 0.5rem; color: #94a3b8; font-size: 0.875rem; font-weight: 500; transition: color 0.2s;
}
.table-action-btn:hover { color: #f8fafc; }

.table-icon-btn { color: rgb(148 163 184 / var(--tw-text-opacity, 1)); transition: color 0.2s; display: flex; align-items: center; justify-content: center; }
.table-icon-btn:hover { color: #f8fafc; }
.table-icon-btn.warning:hover { color: #eab308; }
.table-icon-btn.danger:hover { color: #ef4444; }

.title-main {
    font-size: 0.875rem;
    /* text-sm */
    font-weight: 700;
    /* font-bold */
    color: #cbd5e1;
    /* text-slate-300 */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    /* tracking-wider */

    position: relative;
    padding-left: 0.75rem;
}

/* La petite barre verticale colorée à gauche du titre */
.title-main::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 1.25rem;
    width: 4px;
    background: linear-gradient(to bottom, #6366f1, #8b5cf6);
    /* Gradient indigo/violet */
    border-radius: 2px;
}

.table-badge-count {
    background-color: rgba(99, 102, 241, 0.1);
    /* accent-primary/10 */
    color: #818cf8;
    /* accent-primary light */
    border: 1px solid rgba(99, 102, 241, 0.2);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
}

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

/* --- MODERN SPREADSHEET STYLES --- */
.spreadsheet-container {
    border: 1px solid #2a3655; /* dark-600 */
    border-radius: 0.75rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #0f1525;
}

.spreadsheet-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.spreadsheet-th {
    background-color: #151e32; /* dark-800 */
    color: #94a3b8; /* slate-400 */
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #2a3655;
    border-right: 1px solid #1f2942;
    position: sticky;
    top: 0;
    z-index: 10;
}
.spreadsheet-th:last-child { border-right: none; }

.spreadsheet-tr {
    transition: background-color 0.2s;
    border-bottom: 1px solid #1f2942; /* dark-700 */
}
.spreadsheet-tr:hover {
    background-color: rgba(31, 41, 66, 0.5); /* dark-700/50 */
}
.spreadsheet-tr:last-child { border-bottom: none; }

.spreadsheet-td {
    border-right: 1px solid #1f2942;
    position: relative;
    padding: 0; /* Important for full-cell input */
    vertical-align: top;
}
.spreadsheet-td:last-child { border-right: none; }
.spreadsheet-container {
    scrollbar-gutter: stable;
}

.spreadsheet-container::-webkit-scrollbar {
    height: 12px;
}

.spreadsheet-container::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.85);
    border-radius: 9999px;
}

.spreadsheet-container::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.95);
    border-radius: 9999px;
}

.spreadsheet-container::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 1);
}

/* Seamless Input inside cell */
.cell-input {
    width: 100%;
    height: 100%;
    min-height: 44px;
    background: transparent;
    border: 2px solid transparent;
    padding: 0.5rem 0.75rem;
    color: #cbd5e1;
    font-size: 0.875rem;
    outline: none;
    resize: vertical;
    line-height: 1.4;
    transition: border-color 0.2s, background-color 0.2s;
}
/* Style spécifique pour les formules */
.cell-input.math-font {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #a5b4fc; /* indigo-300 */
}

/* Focus state wraps the cell */
.cell-input:focus {
    border-color: #6366f1;
    background-color: rgba(99, 102, 241, 0.05);
    z-index: 5;
    position: relative;
    border-radius: 4px;
}

.filters-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.75rem;
    padding: 0 1.5rem 1rem 1.5rem;
}

.filters-toolbar__search {
    position: relative;
    min-width: 240px;
    flex: 1 1 240px;
    max-width: 320px;
}

.filters-toolbar__search .ui-input {
    width: 100%;
    padding-right: 2.5rem;
}

.filters-toolbar__search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgb(100 116 139);
    pointer-events: none;
}

.filters-toolbar__group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.filters-toolbar__label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgb(148 163 184);
}

.filters-toolbar__levels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.filters-toolbar__reset {
    margin-left: auto;
    display: flex;
    align-items: center;
}

@media (max-width: 768px) {
    .filters-toolbar {
        padding: 0 1rem 1rem 1rem;
    }

    .filters-toolbar__search {
        max-width: 100%;
        width: 100%;
    }

    .filters-toolbar__reset {
        margin-left: 0;
        width: 100%;
    }
}

/* Pill Selectors for Correct Answer */
.answer-pill {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    background-color: transparent;
    border: 1px solid #334155;
    cursor: pointer;
    transition: all 0.2s;
}
.answer-pill:hover { background-color: #1f2942; color: #cbd5e1; }
.answer-pill.active {
    background-color: #10b981; /* success */
    border-color: #10b981;
    color: white;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

 details > summary { list-style: none; outline: none; }
        details > summary::-webkit-details-marker { display: none; }
        .tree-chevron { transition: transform 0.2s ease; }
        details[open] > summary > .tree-chevron { transform: rotate(90deg); }

        .tree-counter-badge {
            font-size: 0.7rem;
            font-weight: 600;
            color: #94a3b8;
            background: rgba(15, 23, 42, 0.9);
            border: 1px solid rgba(51, 65, 85, 0.9);
            border-radius: 9999px;
            padding: 0.12rem 0.45rem;
            line-height: 1.2;
        }

        .tree-menu-trigger {
            color: #94a3b8;
            border: 1px solid transparent;
            border-radius: 0.5rem;
            padding: 0.22rem;
            transition: all 0.2s ease;
        }

        .tree-menu-trigger:hover,
        .tree-menu-trigger[aria-expanded="true"] {
            color: #f8fafc;
            border-color: rgba(51, 65, 85, 0.9);
            background: rgba(15, 23, 42, 0.9);
        }

        .tree-menu-panel {
            position: absolute;
            right: 0;
            top: calc(100% + 0.35rem);
            min-width: 12rem;
            background: rgba(15, 23, 42, 0.98);
            border: 1px solid rgba(51, 65, 85, 0.9);
            border-radius: 0.7rem;
            box-shadow: 0 18px 28px rgba(2, 6, 23, 0.45);
            z-index: 40;
            overflow: hidden;
            padding: 0.25rem;
        }

        .tree-menu-item {
            width: 100%;
            display: block;
            font-size: 0.75rem;
            font-weight: 500;
            color: #cbd5e1;
            text-align: left;
            border-radius: 0.5rem;
            padding: 0.38rem 0.55rem;
            transition: background 0.16s ease, color 0.16s ease;
        }

        .tree-menu-form {
            margin: 0;
        }

        .tree-menu-item:hover {
            background: rgba(30, 41, 59, 0.9);
            color: #ffffff;
        }

        .tree-menu-item-danger {
            color: #fca5a5;
        }

        .tree-menu-item-danger:hover {
            background: rgba(127, 29, 29, 0.35);
            color: #fecaca;
        }
        
        .tree-item-active {
            
            border: 1px solid #22d3ee !important;
            color: #22d3ee !important;
            font-weight: 600;
        }
        


/* Modal primitives */
.modal-overlay,
.premium-modal-overlay {
    background-color: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(8px);
}

.modal-card,
.premium-modal-panel {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.96) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(51, 65, 85, 0.78);
    border-radius: 1.25rem;
    box-shadow: 0 32px 70px -32px rgba(2, 6, 23, 0.95);
}

.modal-container {
    width: 100%;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-size-sm { max-width: 32rem; }
.modal-size-md { max-width: 40rem; }
.modal-size-lg { max-width: 64rem; }
.modal-size-xl { max-width: 74rem; }

.modal-content-shell {
    overflow-y: auto;
    min-height: 0;
}

.modal-header,
.premium-modal-header {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.88) 0%, rgba(15, 23, 42, 0.62) 100%);
    border-bottom: 1px solid rgba(51, 65, 85, 0.72);
}

.premium-modal-body {
    overflow-y: auto;
    min-height: 0;
}

.premium-modal-footer {
    border-top: 1px solid rgba(51, 65, 85, 0.72);
    background: rgba(15, 23, 42, 0.65);
}

.premium-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(51, 65, 85, 0.8);
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.7);
    transition: all 0.2s ease;
}

.premium-modal-close:hover {
    color: #e2e8f0;
    border-color: rgba(34, 211, 238, 0.5);
}

.premium-modal-sm { max-width: 28rem; }
.premium-modal-md { max-width: 36rem; }
.premium-modal-lg { max-width: 56rem; }
.premium-modal-xl { max-width: 72rem; }

.modal-breadcrumb {
    font-size: 0.75rem;
    color: var(--slate-500);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

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

.modal-body {
    max-height: 80vh;
    overflow-y: auto;
}

.btn-ghost {
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-ghost:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

/* Code snippets in glossary */
.latex-code {
    font-family: 'Courier New', Courier, monospace;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    color: #a5b4fc;
    font-size: 0.75rem;
    cursor: pointer;
}

.latex-code:hover {
    background-color: rgba(99, 102, 241, 0.2);
    color: white;
}


        /* Tab Badges */
        .tab-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-width: 1.75rem;
            padding: 0.2rem 0.55rem;
            border-radius: 9999px;
            border: 1px solid rgba(71, 85, 105, 0.85);
            background-color: rgba(30, 41, 59, 0.9);
            color: #cbd5e1;
            font-size: 0.75rem;
            line-height: 1rem;
            font-weight: 700;
        }
        /* Tab Navigation */
        .tab-btn {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.9rem 1.1rem;
            color: #94a3b8;
            font-weight: 600;
            border-bottom: 2px solid transparent;
            transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
        }
        .tab-btn:hover {
            color: white;
            background-color: rgba(30, 41, 59, 0.28);
        }
        .tab-btn.active {
            color: rgb(34 211 238);
            border-bottom-color: rgb(34 211 238);
        }
        .tab-btn.active .tab-badge {
            background-color: rgba(34, 211, 238, 0.15);
            border-color: rgba(34, 211, 238, 0.3);
            color: rgb(103, 232, 249);
        }

@media (max-width: 767px) {
    .table-header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }

    .table-heading-group {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .app-header {
        margin-bottom: 2.5rem;
    }

    .app-header__description {
        font-size: 0.95rem;
    }
}

        /* Progress Bar Animation */
        @keyframes load {
            0% { width: 0; }
        }
        .progress-animate {
            animation: load 1.5s ease-out forwards;
        }


/* Checkbox Custom pour la bonne réponse */
.custom-radio {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #475569;
    border-radius: 50%;
    display: grid;
    place-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-radio::before {
    content: "";
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em white;
}

.custom-radio:checked {
    border-color: #10b981;
    background-color: #10b981;
}

.custom-radio:checked::before {
    transform: scale(1);
}

.ui-radio-card {
    display: block;
    cursor: pointer;
}

.ui-radio-card__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ui-radio-card__panel {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid #1f2942;
    background-color: #0b1120;
    transition: all 0.2s ease;
}

.ui-radio-card:hover .ui-radio-card__panel {
    border-color: #2a3655;
    transform: translateY(-1px);
}

.ui-radio-indicator {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 9999px;
    border: 2px solid #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
    transition: all 0.2s ease;
}

.ui-radio-indicator::after {
    content: "";
    width: 0.46rem;
    height: 0.46rem;
    border-radius: 9999px;
    background-color: #fff;
    transform: scale(0);
    transition: transform 0.2s ease;
}

.ui-radio-card__input:checked + .ui-radio-card__panel {
    border-color: #818cf8;
    background-color: rgba(99, 102, 241, 0.13);
}

.ui-radio-card__input:checked + .ui-radio-card__panel .ui-radio-indicator {
    border-color: #6366f1;
    background-color: #6366f1;
}

.ui-radio-card__input:checked + .ui-radio-card__panel .ui-radio-indicator::after {
    transform: scale(1);
}

.ui-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--slate-400);
    margin-bottom: 0.375rem;
}


.ui-filter-toolbar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(51, 65, 85, 0.9);
    border-radius: 1rem;
    background: rgba(30, 41, 59, 0.4);
    box-shadow: 0 8px 24px -18px rgba(15, 23, 42, 0.9);
}

.ui-filter-toolbar--embedded {
    border-top: 1px solid rgba(51, 65, 85, 0.9);
    background: rgba(30, 41, 59, 0.3);
}

.ui-filter-toolbar__input,
.ui-filter-toolbar__select {
    min-height: 2.75rem;
    border-radius: 0.75rem;
}

.ui-filter-toolbar__reset {
    font-size: 0.75rem;
    color: var(--slate-500);
    text-decoration: underline;
    text-decoration-style: dashed;
    text-underline-offset: 0.25rem;
    white-space: nowrap;
}

.ui-filter-toolbar__reset:hover {
    color: var(--slate-300);
}

@media (max-width: 767px) {
    .ui-filter-toolbar {
        padding: 0.875rem;
    }

    .ui-filter-toolbar__input,
    .ui-filter-toolbar__select {
        min-height: 2.625rem;
    }
}

.ui-input-profile {
  width: 100%;
    background-color: var(--dark-900);
    border: 1px solid var(--dark-600);
  color: white;
  border-radius: 0.75rem;            /* rounded-xl */
  padding: 0.75rem 1rem;             /* px-4 py-3 */
  transition: all 0.2s ease-in-out;
}

.ui-input-profile:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.ui-input-mail {
  width: 100%;
    background-color: var(--dark-900);
    border: 1px solid var(--dark-600);
    color: var(--white);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem 0.75rem 3rem; /* py-3 pr-4 pl-12 */
  transition: all 0.2s ease-in-out;
}

.ui-input-mail:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.ui-select-profile{ 
 width: 100%;
    background-color: var(--dark-900);
    border: 1px solid var(--dark-600);
    color: var(--white);
  border-radius: 0.75rem;            /* rounded-xl */
  padding: 0.75rem 1rem;             /* py-3 px-4 */

  appearance: none;                  /* appearance-none */
  cursor: pointer;

  transition: all 0.2s ease-in-out;  /* transition-all */
}

.ui-select-profile:focus {
  outline: none;                     /* focus:outline-none */
  border-color: #6366f1;             /* accent-primary (à adapter si besoin) */
  box-shadow: 0 0 0 1px #6366f1;      /* focus:ring-1 focus:ring-accent-primary */
}

.ui-input,
.ui-select {
    width: 100%;
    background-color: var(--dark-900);
    border: 1px solid var(--dark-600);
    color: var(--white);
    font-size: 0.875rem;
    border-radius: var(--rounded);
    padding: var(--p-2);
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease, color 150ms ease;
}

.ui-input-icon-right {
    padding-right: 2.5rem;
}

.ui-input::placeholder {
    color: var(--slate-500);
}

.ui-input:focus,
.ui-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background-color: var(--dark-900);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.7);
}

/* Keep input background stable when browser autofills (Chrome/Edge) */
.ui-input:-webkit-autofill,
.ui-input:-webkit-autofill:hover,
.ui-input:-webkit-autofill:focus,
.ui-input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--white);
    caret-color: var(--white);
    -webkit-box-shadow: 0 0 0px 1000px var(--dark-900) inset;
    box-shadow: 0 0 0px 1000px var(--dark-900) inset;
    transition: background-color 9999s ease-out, color 9999s ease-out;
}

.ui-select {
    appearance: none;
    cursor: pointer;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem 1rem;
}

.ui-select option,
.ui-select optgroup {
    background-color: var(--dark-900);
    color: var(--white);
}

.ui-input:disabled,
.ui-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ui-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.ui-btn-outline {
    background-color: var(--dark-800);
    border: 1px solid var(--dark-600);
    color: var(--slate-300);
    font-weight: 500;
}

.ui-btn-outline:hover {
    background-color: var(--dark-700);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--white);
}

.ui-btn-primary {
    background-color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    color: var(--white);
    font-weight: 800;
    box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.35);
}

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

/* Small inline action button (used e.g. in tables) */
.ui-btn-small {
    font-size: 0.75rem; /* text-xs */
    font-weight: 700; /* font-bold */
    color: currentColor;
    padding: 0.25rem; /* p-1 */
    background: transparent;
    border: none;
    border-radius: 0; /* hover:rounded */
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease, border-radius 150ms ease;
}

.ui-btn-small:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--white);
    border-radius: var(--rounded);
}

/* Variants */
.ui-btn-small--green {
    color: var(--accent-success);
}

.ui-btn-small--green:hover {
    background-color: var(--accent-success);
    color: var(--white);
}

.ui-btn-small--red {
    color: var(--accent-error);
}

.ui-btn-small--red:hover {
    background-color: var(--accent-error);
    color: var(--white);
}

.ui-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(71, 85, 105, 0.75);
    background: rgba(15, 23, 42, 0.9);
    color: var(--slate-300);
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.ui-icon-button:hover {
    color: var(--white);
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(30, 41, 59, 0.95);
    transform: translateY(-1px);
}

.ui-icon-button--success {
    color: var(--accent-success);
}

.ui-icon-button--success:hover {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.14);
}

.ui-icon-button--warning {
    color: var(--accent-warning);
}

.ui-icon-button--warning:hover {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.14);
}

.ui-icon-button--danger {
    color: var(--accent-error);
}

.ui-icon-button--danger:hover {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.14);
}

.ui-action-menu {
    position: relative;
}

.ui-action-menu__summary {
    list-style: none;
}

.ui-action-menu__summary::-webkit-details-marker {
    display: none;
}

.ui-action-menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    z-index: 20;
    width: 15rem;
    padding: 0.5rem;
    border-radius: 1rem;
    border: 1px solid rgba(71, 85, 105, 0.85);
    background: rgba(15, 23, 42, 0.98);
    box-shadow: 0 24px 48px -24px rgba(15, 23, 42, 0.95);
}

.ui-action-menu__item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.8rem;
    border-radius: 0.75rem;
    color: var(--slate-300);
    font-size: 0.875rem;
    text-align: left;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.ui-action-menu__item:hover {
    background: rgba(30, 41, 59, 0.95);
    color: var(--white);
}

.ui-action-menu__item--danger {
    color: #fca5a5;
}

.ui-action-menu__item--danger:hover {
    background: rgba(127, 29, 29, 0.25);
    color: #fecaca;
}

/* Submit button style */
.ui-btn-submit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--accent-primary);
    color: var(--white);
    padding: 0.625rem 2rem;
    border-radius: 0.75rem;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.2);
    border: none;
    cursor: pointer;
}

.ui-btn-submit:hover {
    background-color: var(--accent-secondary);
    box-shadow: 0 15px 35px -5px rgba(99, 102, 241, 0.3);
    transform: scale(1.05);
}

.ui-btn-submit:active {
    transform: scale(0.95);
}

/* Cancel button style */
.ui-btn-cancel {
    padding: 0.625rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 0.5rem;
    color: #94a3b8;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ui-btn-cancel:hover {
    color: var(--white);
    background-color: rgba(99, 102, 241, 0.1);
}

/* Square icon button (matches common Tailwind utilities used in templates) */
.ui-button {
    position: relative;
    width: 2.25rem;
    /* w-9 */
    height: 2.25rem;
    /* h-9 */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    /* rounded-lg */
    border: 1px solid var(--dark-600);
    background-color: var(--dark-900);
    font-size: 0.75rem;
    /* text-xs */
    color: var(--slate-400);
    transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.ui-button:hover {
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--white);
}

.ui-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ui-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 500;
    border-radius: 0.25rem;
    color: var(--slate-400);
    background-color: var(--dark-800);
    border: 1px solid var(--dark-600);
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease;
}

.ui-page-btn:hover {
    background-color: var(--dark-700);
    color: var(--white);
}

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

.ui-page-btn-active:hover {
    background-color: var(--accent-secondary);
    border-color: var(--accent-secondary);
}

.ui-page-btn-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.toggle-pill {
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid #1e293b;
    color: #94a3b8;
    background-color: rgba(11, 16, 30, 0.5);
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    position: relative;
}

.toggle-pill:hover {
    border-color: #475569;
    color: #f8fafc;
    background-color: #1e293b;
}

.toggle-pill.active {
    background-color: rgba(99, 102, 241, 0.15);
    border-color: #6366f1;
    color: #a5b4fc;
}

.toggle-pill.alert {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
    background-color: rgba(239, 68, 68, 0.05);
}

.toggle-pill.alert:hover {
    border-color: rgba(239, 68, 68, 0.5);
}

.toggle-pill.alert.active {
    background-color: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #fca5a5;
}

.toggle-pill-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

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

::-webkit-scrollbar-track {
    background: #0f172a;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

.katex,
.katex .base,
.katex-display>.katex {
    color: #f8fafc;
}

.katex-display {
    margin: 1em 0;
}
