/**
 * KMDT - Thème KMDT authentique (fidèle à kmdt.fr)
 * Version : 2.11.0 | Date : 2026-04-22
 * Surcharge Bootstrap 5 — Palette noir/rouge/bleu, fond fumée, glassmorphism
 * Identité : Krav Maga Défense Tactique
 */

/* ============================================================
   VARIABLES CSS — PALETTE KMDT
   ============================================================ */
:root {
    --kmdt-black: #000000;
    --kmdt-dark: #0a0a0a;
    --kmdt-card: rgba(17, 17, 17, 0.85);
    --kmdt-card-solid: #111111;
    --kmdt-border: rgba(139, 0, 0, 0.25);
    --kmdt-border-subtle: rgba(255, 255, 255, 0.08);
    --kmdt-red: #8B0000;
    --kmdt-red-bright: #cc1533;
    --kmdt-red-glow: rgba(139, 0, 0, 0.4);
    --kmdt-blue-glow: rgba(0, 120, 220, 0.12);
    --kmdt-text: #ffffff;
    --kmdt-text-muted: rgba(255, 255, 255, 0.55);
    --kmdt-text-dim: rgba(255, 255, 255, 0.35);
    --kmdt-font-display: 'Orbitron', sans-serif;
    --kmdt-font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --kmdt-radius: 12px;
    --kmdt-radius-lg: 20px;
    --kmdt-blur: blur(12px);
}

/* ============================================================
   TYPOGRAPHIE & BASE
   ============================================================ */
body.kmdt-theme {
    background-color: var(--kmdt-black) !important;
    color: var(--kmdt-text) !important;
    font-family: var(--kmdt-font-body);
    min-height: 100vh;
}

/* Fond fumée uniquement sur le contenu principal, pas la sidebar */
.kmdt-theme .main-content {
    background-image: url('../img/smoke_bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* Overlay sombre + lueur bleue sur le fond */
.kmdt-theme .main-content::before {
    content: '';
    position: fixed;
    top: 0;
    left: 240px;
    width: calc(100% - 240px);
    height: 100%;
    background:
        radial-gradient(ellipse at 80% 20%, var(--kmdt-blue-glow) 0%, transparent 60%),
        radial-gradient(ellipse at 20% 80%, var(--kmdt-red-glow) 0%, transparent 50%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.85) 100%);
    pointer-events: none;
    z-index: 0;
}

/* S'assurer que tout le contenu passe au-dessus de l'overlay */
.kmdt-theme .main-content > * {
    position: relative;
    z-index: 1;
}

/* La navbar fixed doit rester au-dessus du main content */
.kmdt-theme > header {
    z-index: 1050;
}

h1,
h2,
h3,
h4,
h5,
h6,
.kmdt-logo,
.kmdt-footer-text {
    font-family: var(--kmdt-font-display);
    color: var(--kmdt-text);
}

h1,
h2 {
    text-shadow: 0 0 25px var(--kmdt-red-glow), 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ============================================================
   LOGO KMDT (navbar brand)
   ============================================================ */
.kmdt-logo {
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.kmdt-logo-img {
    height: 40px;
    width: auto;
    filter: drop-shadow(0 0 8px var(--kmdt-red-glow));
    transition: filter 0.3s ease;
}

.kmdt-logo-img:hover {
    filter: drop-shadow(0 0 15px var(--kmdt-red-bright));
}

/* ============================================================
   NAVBAR — Transparente + blur
   ============================================================ */
.navbar {
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: var(--kmdt-blur);
    -webkit-backdrop-filter: var(--kmdt-blur);
    border-bottom: 1px solid var(--kmdt-border) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
    transition: background 0.3s ease;
}

.navbar .nav-link {
    color: var(--kmdt-text-muted) !important;
    text-transform: uppercase;
    font-size: 0.82rem;
    letter-spacing: 1.5px;
    font-family: var(--kmdt-font-display);
    transition: all 0.3s ease;
    position: relative;
}

.navbar .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--kmdt-red);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.navbar .nav-link:hover::after,
.navbar .nav-link.active::after {
    width: 80%;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--kmdt-text) !important;
    text-shadow: 0 0 10px var(--kmdt-red-glow);
}

/* ============================================================
   CARDS & CONTENEURS — Glassmorphism sombre
   ============================================================ */
.card,
.card.bg-dark {
    background: var(--kmdt-card) !important;
    backdrop-filter: var(--kmdt-blur);
    -webkit-backdrop-filter: var(--kmdt-blur);
    border: 1px solid var(--kmdt-border) !important;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    color: var(--kmdt-text);
    border-radius: var(--kmdt-radius);
    transition: all 0.3s ease;
}

.card:hover {
    border-color: rgba(139, 0, 0, 0.4) !important;
    box-shadow:
        0 6px 30px rgba(0, 0, 0, 0.5),
        0 0 15px var(--kmdt-red-glow);
}

.card-header {
    border-bottom: 1px solid var(--kmdt-border) !important;
    background: rgba(139, 0, 0, 0.08) !important;
}

/* ============================================================
   FORMULAIRES
   ============================================================ */
.form-control,
.form-select {
    background-color: rgba(15, 15, 15, 0.9) !important;
    border: 1px solid rgba(139, 0, 0, 0.2) !important;
    color: var(--kmdt-text) !important;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    background-color: rgba(20, 20, 20, 0.95) !important;
    border-color: var(--kmdt-red) !important;
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.15) !important;
    color: var(--kmdt-text) !important;
}

::placeholder {
    color: rgba(255, 255, 255, 0.35) !important;
    opacity: 1;
}

.form-label {
    color: var(--kmdt-text-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-family: var(--kmdt-font-display);
    font-weight: 500;
}

/* ============================================================
   TABLES
   ============================================================ */
table.table,
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--kmdt-text);
    --bs-table-border-color: var(--kmdt-border);
    color: var(--kmdt-text) !important;
}

.table thead th {
    background: rgba(139, 0, 0, 0.1);
    border-color: var(--kmdt-border) !important;
    color: var(--kmdt-text-muted);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    font-family: var(--kmdt-font-display);
}

.table tbody tr:hover td {
    background-color: rgba(139, 0, 0, 0.08) !important;
}

/* ============================================================
   BOUTONS KMDT — Rouge signature
   ============================================================ */
.btn-primary {
    background: linear-gradient(135deg, var(--kmdt-red) 0%, var(--kmdt-red-bright) 100%) !important;
    border: 1px solid rgba(204, 21, 51, 0.5) !important;
    color: var(--kmdt-text) !important;
    text-transform: uppercase;
    font-family: var(--kmdt-font-display);
    font-size: 0.78rem;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, var(--kmdt-red-bright) 0%, #e01a40 100%) !important;
    border-color: var(--kmdt-red-bright) !important;
    box-shadow: 0 0 20px rgba(204, 21, 51, 0.4), 0 0 40px rgba(139, 0, 0, 0.2);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline-secondary {
    font-family: var(--kmdt-font-display);
    font-size: 0.72rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-color: var(--kmdt-border) !important;
    color: var(--kmdt-text-muted) !important;
    transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
    background: rgba(139, 0, 0, 0.15) !important;
    border-color: var(--kmdt-red) !important;
    color: var(--kmdt-text) !important;
}

/* ============================================================
   ALERTES
   ============================================================ */
.alert-dismissible .btn-close {
    filter: invert(1);
}

.alert {
    border-radius: var(--kmdt-radius);
    backdrop-filter: var(--kmdt-blur);
}

/* ============================================================
   CLASSES UTILITAIRES PARTAGÉES
   ============================================================ */

/* page-title */
.page-title {
    font-family: var(--kmdt-font-display);
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    color: var(--kmdt-text);
    text-shadow: 0 0 20px var(--kmdt-red-glow);
}

/* section-title */
.section-title {
    font-family: var(--kmdt-font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--kmdt-text);
    letter-spacing: 0.03em;
}

/* subsection-title */
.subsection-title {
    font-family: var(--kmdt-font-display);
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.8rem;
}

/* form-section — glassmorphism */
.form-section {
    background: var(--kmdt-card);
    backdrop-filter: var(--kmdt-blur);
    -webkit-backdrop-filter: var(--kmdt-blur);
    border: 1px solid var(--kmdt-border);
    border-radius: var(--kmdt-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.3s ease;
}

.form-section:hover {
    border-color: rgba(139, 0, 0, 0.4);
}

/* Accordéon — Sections repliables */
.section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0;
    margin-bottom: 1rem;
    user-select: none;
    -webkit-user-select: none;
}

.section-toggle .section-title {
    margin-bottom: 0;
}

.section-chevron {
    font-size: 0.9rem;
    color: var(--kmdt-text-muted);
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.form-section.collapsed .section-chevron {
    transform: rotate(-90deg);
}

.section-body {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 1;
}

.form-section.collapsed .section-body {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

.form-section.collapsed {
    padding-bottom: 1rem;
}

.form-section.collapsed .section-toggle {
    margin-bottom: 0;
}

/* Stats — Rouge KMDT pour les valeurs */
.stats-row {
    display: flex;
    gap: 1rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.8rem 1.5rem;
    background: var(--kmdt-card);
    backdrop-filter: var(--kmdt-blur);
    border: 1px solid var(--kmdt-border);
    border-radius: var(--kmdt-radius);
    min-width: 90px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: rgba(139, 0, 0, 0.5);
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.2);
    transform: translateY(-2px);
}

.stat-value {
    font-family: var(--kmdt-font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--kmdt-red-bright);
    line-height: 1;
    text-shadow: 0 0 10px rgba(204, 21, 51, 0.3);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--kmdt-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 0.2rem;
    font-family: var(--kmdt-font-display);
}

/* Dashboard header */
.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ============================================================
   SEARCH BAR & FILTRES
   ============================================================ */
.search-bar {
    margin-bottom: 2rem;
}

.search-input-wrap {
    display: flex;
    margin-bottom: 0.75rem;
}

.search-input {
    border-radius: 10px 0 0 10px !important;
}

.btn-search {
    padding: 0.65rem 1rem;
    background: linear-gradient(135deg, var(--kmdt-red) 0%, var(--kmdt-red-bright) 100%);
    color: var(--kmdt-text);
    border: 1px solid rgba(139, 0, 0, 0.3);
    border-radius: 0 10px 10px 0;
    transition: all 0.3s ease;
}

.btn-search:hover {
    background: linear-gradient(135deg, var(--kmdt-red-bright) 0%, #e01a40 100%);
    color: var(--kmdt-text);
    box-shadow: 0 0 10px rgba(139, 0, 0, 0.3);
}

.filters-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filters-row .form-select {
    min-width: 160px;
    flex: 1;
    font-size: 0.85rem;
    padding: 0.5rem 2.2rem 0.5rem 0.8rem;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    color: var(--kmdt-text);
    background: rgba(15, 15, 15, 0.9);
    border: 1px solid rgba(139, 0, 0, 0.2);
    border-radius: 10px;
    transition: all 0.2s ease;
    outline: none;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--kmdt-red);
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.15);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--kmdt-text-dim);
    margin-top: 0.3rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
    flex: 1;
}

.form-file {
    padding: 0.5rem;
}

.form-file::file-selector-button {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    background: linear-gradient(135deg, var(--kmdt-red), var(--kmdt-red-bright));
    color: var(--kmdt-text);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 0.5rem;
    transition: all 0.2s ease;
}

.form-file::file-selector-button:hover {
    box-shadow: 0 0 10px rgba(139, 0, 0, 0.3);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* ============================================================
   TOGGLE SWITCH — Dossier complet
   ============================================================ */
.toggle-switch {
    display: inline-flex !important;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
    padding: 0;
    margin: 0;
}

/* Masquer la checkbox native (résiste à Bootstrap 5) */
.toggle-switch input[type="checkbox"] {
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none;
    margin: 0 !important;
    padding: 0 !important;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--kmdt-border);
    border-radius: 13px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: var(--kmdt-text-muted);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--kmdt-red) 0%, var(--kmdt-red-bright) 100%) !important;
    border-color: rgba(204, 21, 51, 0.5) !important;
    box-shadow: 0 0 10px rgba(139, 0, 0, 0.3);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider::after {
    left: 25px;
    background: var(--kmdt-text);
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--kmdt-text-muted);
    font-family: var(--kmdt-font-display);
    letter-spacing: 0.03em;
    transition: color 0.3s ease;
}

.toggle-switch input[type="checkbox"]:checked ~ .toggle-label {
    color: var(--kmdt-text);
}

/* ============================================================
   VIEW TOGGLE
   ============================================================ */
.view-toggle {
    display: flex;
    gap: 0.25rem;
    background: var(--kmdt-card);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid var(--kmdt-border);
    margin-left: auto;
}

.btn-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--kmdt-text-dim);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-view:hover {
    color: var(--kmdt-text);
    background: rgba(139, 0, 0, 0.15);
}

.btn-view.active {
    background: var(--kmdt-red);
    color: var(--kmdt-text);
    border: none;
    box-shadow: 0 0 8px rgba(139, 0, 0, 0.4);
}

/* ============================================================
   GRILLE DES ÉLÈVES
   ============================================================ */
.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.students-grid[data-view="grid-large"] {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.5rem;
}

/* Vue cartes : grandes vignettes verticales (~3 par ligne en desktop) */
.students-grid[data-view="cards"] {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.students-grid[data-view="cards"] .obsidian-card {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
    overflow: visible;
}

.students-grid[data-view="cards"] .obsidian-card-avatar-wrapper {
    width: 100%;
    height: 320px;
    overflow: hidden;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.students-grid[data-view="cards"] .obsidian-card-avatar {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    object-fit: cover;
    object-position: center top;
}

.students-grid[data-view="cards"] .obsidian-card-status-badge {
    bottom: auto;
    top: 10px;
    right: 10px;
}

.students-grid[data-view="cards"] .obsidian-card-content {
    padding: 1rem 1.25rem 1.25rem;
}

.students-grid[data-view="cards"] .obsidian-card-name {
    font-size: 1.35rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    margin-bottom: 0.5rem;
}

.students-grid[data-view="cards"] .obsidian-card-meta {
    font-size: 0.7rem;
    margin-bottom: 0.6rem;
}

.students-grid[data-view="cards"] .ceinture-indicator {
    z-index: 10;
}

.students-grid[data-view="list"] {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.student-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--kmdt-card);
    backdrop-filter: var(--kmdt-blur);
    -webkit-backdrop-filter: var(--kmdt-blur);
    border: 1px solid var(--kmdt-border);
    border-radius: var(--kmdt-radius);
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--kmdt-text);
    overflow: visible;
}

.students-grid[data-view="list"] .student-card {
    flex-direction: row;
    align-items: center;
}

.student-card:hover {
    background: rgba(139, 0, 0, 0.1);
    border-color: rgba(139, 0, 0, 0.5);
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.15), 0 4px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
    color: var(--kmdt-text);
}

/* Indicateur ceinture — icône SVG arts martiaux à 45° haut-gauche */
.ceinture-indicator {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 44px;
    height: 24px;
    z-index: 5;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
    transform: rotate(-45deg);
    transform-origin: center center;
}

.ceinture-indicator:hover {
    transform: rotate(-45deg) scale(1.15);
}

.ceinture-svg {
    width: 100%;
    height: 100%;
}

/* Dot statut — positionné en haut à droite de la carte */
.card-status-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 3;
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.card-status-dot.dot-actif {
    background-color: #00e676;
    box-shadow: 0 0 6px rgba(0, 230, 118, 0.5);
}

.card-status-dot.dot-inactif {
    background-color: #ffab00;
    box-shadow: 0 0 6px rgba(255, 171, 0, 0.4);
}

.card-status-dot.dot-en-attente {
    background-color: #78909c;
    box-shadow: 0 0 6px rgba(120, 144, 156, 0.4);
}

.student-photo-wrap {
    position: relative;
    flex-shrink: 0;
}

.student-photo {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--kmdt-radius);
    border: 2px solid var(--kmdt-red);
    box-shadow: 0 0 8px rgba(139, 0, 0, 0.3);
}

.students-grid[data-view="grid-large"] .student-photo {
    width: 72px;
    height: 72px;
}

.student-info {
    min-width: 0;
    flex: 1;
}

.student-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.2rem;
    padding-right: 1.5rem;
}

.student-name {
    font-family: var(--kmdt-font-display);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.students-grid[data-view="grid-large"] .student-name {
    font-size: 1.05rem;
}

.student-status-dots {
    display: flex;
    gap: 0.35rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot-actif {
    background-color: #00e676;
    box-shadow: 0 0 6px rgba(0, 230, 118, 0.5);
}

.dot-inactif {
    background-color: #ffab00;
    box-shadow: 0 0 6px rgba(255, 171, 0, 0.4);
}

.dot-suspendu {
    background-color: #ff1744;
    box-shadow: 0 0 6px rgba(255, 23, 68, 0.5);
}

.dot-incomplet {
    background-color: #ff1744;
    box-shadow: 0 0 6px rgba(255, 23, 68, 0.5);
}

.student-meta {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.3rem;
}

.meta-item {
    font-size: 0.75rem;
    color: var(--kmdt-text-muted);
}

/* Infos étendues */
.student-details-extended {
    display: none;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--kmdt-border);
    font-size: 0.75rem;
    color: var(--kmdt-text-muted);
}

.students-grid[data-view="grid-large"] .student-details-extended {
    display: block;
}

.students-grid[data-view="list"] .student-details-extended {
    display: flex;
    gap: 1.5rem;
    border-top: none;
    margin-top: 0;
    padding-top: 0;
    border-left: 1px solid var(--kmdt-border);
    margin-left: 1rem;
    padding-left: 1.5rem;
    flex: 1;
    align-items: center;
}

.students-grid[data-view="list"] .student-header-inner {
    padding-right: 0;
}

.students-grid[data-view="list"] .ceinture-indicator {
    position: relative;
    top: auto;
    right: auto;
    flex-shrink: 0;
}

.extended-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}

.students-grid[data-view="list"] .extended-info {
    margin-bottom: 0;
}

/* Texte tronqué dans les infos étendues (email, etc.) */
.ei-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
    display: inline-block;
    vertical-align: middle;
}

/* Badge dossier incomplet — bas-droite, symbole interdit sur dossier */
.badge-dossier-incomplet {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

/* Cercle interdit par-dessus le dossier */
.badge-dossier-incomplet::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #ff1744;
    background: rgba(255, 23, 68, 0.08);
}

.badge-dossier-incomplet::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background: #ff1744;
    transform: rotate(-45deg);
    border-radius: 1px;
    z-index: 1;
}

/* ============================================================
   TABLEAU MEMBRES — Mode liste (dashboard unifié)
   ============================================================ */
.members-table-wrap {
    overflow-x: auto;
    border-radius: var(--kmdt-radius);
    border: 1px solid var(--kmdt-border);
    background: var(--kmdt-card);
    backdrop-filter: var(--kmdt-blur);
    -webkit-backdrop-filter: var(--kmdt-blur);
}

.members-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.members-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.members-table th {
    font-family: var(--kmdt-font-display);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--kmdt-text-muted);
    padding: 0.75rem 0.8rem;
    background: rgba(10, 10, 10, 0.95);
    border-bottom: 1px solid var(--kmdt-border);
    text-align: left;
    white-space: nowrap;
}

.members-table td {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--kmdt-border-subtle);
    vertical-align: middle;
    white-space: nowrap;
}

.member-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

.member-row:hover {
    background: rgba(139, 0, 0, 0.1);
    box-shadow: inset 0 0 0 1px rgba(139, 0, 0, 0.3);
}

.member-row:hover td {
    color: var(--kmdt-text);
}

/* Avatar mini dans le tableau */
.table-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--kmdt-radius);
    object-fit: cover;
    border: 1.5px solid var(--kmdt-red);
    box-shadow: 0 0 5px rgba(139, 0, 0, 0.2);
    display: block;
}

/* Avatar dans les tableaux obsidian (échéances, etc.) */
.obsidian-avatar {
    border-radius: var(--kmdt-radius);
}

/* Nom dans le tableau */
.member-name {
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

/* Pastille ceinture dans le tableau */
.belt-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: middle;
    box-shadow: 0 0 4px currentColor;
}

.belt-label {
    font-size: 0.8rem;
    vertical-align: middle;
}

/* Indicateurs dossier dans le tableau */
.folder-ok {
    color: #00e676;
    font-weight: 700;
    font-size: 1rem;
}

.folder-warning {
    color: #ff9800;
    font-size: 1rem;
}

/* Badges rôle — couleurs distinctes */
.badge-role-admin {
    background: rgba(255, 193, 7, 0.15);
    color: #ffd54f;
    border: 1px solid rgba(255, 193, 7, 0.3);
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 50px;
    padding: 0.2rem 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.badge-role-instructeur {
    background: rgba(0, 188, 212, 0.15);
    color: #4dd0e1;
    border: 1px solid rgba(0, 188, 212, 0.3);
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 50px;
    padding: 0.2rem 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.badge-role-president {
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.3);
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 50px;
    padding: 0.2rem 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.badge-role-eleve {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 50px;
    padding: 0.2rem 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* Colonne photo — largeur fixe */
.col-photo {
    width: 48px;
    text-align: center;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.badge-role {
    background: rgba(139, 0, 0, 0.15);
    color: #e88;
    border: 1px solid rgba(139, 0, 0, 0.3);
}

.badge-actif {
    background: rgba(0, 230, 118, 0.12);
    color: #00e676;
    border: 1px solid rgba(0, 230, 118, 0.2);
}

.badge-inactif {
    background: rgba(255, 171, 0, 0.12);
    color: #ffab00;
    border: 1px solid rgba(255, 171, 0, 0.2);
}

.badge-suspendu {
    background: rgba(255, 23, 68, 0.12);
    color: #ff1744;
    border: 1px solid rgba(255, 23, 68, 0.2);
}

.badge-categorie {
    background: rgba(120, 100, 255, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(120, 100, 255, 0.2);
}

/* Colonne "Compte" — reprend le pattern obsidian-status (dot + texte),
   transforme en bouton cliquable pour les etats actionnables (admin). */
button.compte-status {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    cursor: pointer;
    transition: filter 0.15s, transform 0.15s;
}

button.compte-status:hover {
    filter: brightness(1.2);
    transform: translateX(1px);
}

button.compte-status:focus-visible {
    outline: 2px solid var(--accent-secondary, #44d8f1);
    outline-offset: 2px;
    border-radius: 4px;
}

.badge-abo {
    background: rgba(255, 255, 255, 0.08);
    color: #aaa;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.badge-ceinture {
    color: #fff;
    border: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.badge-paiement-paye {
    background: rgba(0, 230, 118, 0.12);
    color: #00e676;
}

.badge-paiement-en_attente {
    background: rgba(255, 171, 0, 0.12);
    color: #ffab00;
}

.badge-paiement-echelonne {
    background: rgba(0, 212, 255, 0.12);
    color: #00d4ff;
}

/* ============================================================
   BOUTONS ADDITIONNELS
   ============================================================ */
.btn-ghost {
    background: transparent;
    color: var(--kmdt-text-muted);
    border: 1px solid var(--kmdt-border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-ghost:hover {
    border-color: var(--kmdt-red);
    color: var(--kmdt-text);
    background: rgba(139, 0, 0, 0.1);
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
}

.btn-danger {
    background: linear-gradient(135deg, #cc1533, #ff1744) !important;
    color: #fff !important;
    border: none !important;
}

.btn-danger:hover {
    box-shadow: 0 0 20px rgba(255, 23, 68, 0.4);
    transform: translateY(-1px);
}

.btn-full {
    width: 100%;
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.btn:hover .btn-glow {
    left: 100%;
}

/* ============================================================
   PROFIL ÉLÈVE
   ============================================================ */
.profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: var(--kmdt-card);
    backdrop-filter: var(--kmdt-blur);
    border: 1px solid var(--kmdt-border);
    border-radius: var(--kmdt-radius-lg);
    margin-bottom: 2rem;
    flex-wrap: wrap;
    transition: border-color 0.3s ease;
}

.profile-header:hover {
    border-color: rgba(139, 0, 0, 0.4);
}

.profile-photo-wrap {
    position: relative;
    flex-shrink: 0;
}

.profile-photo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--kmdt-radius-lg);
    border: 3px solid var(--kmdt-red);
    box-shadow: 0 0 15px rgba(139, 0, 0, 0.3);
}

.profile-ceinture-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 3px solid;
    border-radius: var(--kmdt-radius-lg);
}

.profile-identity {
    flex: 1;
    min-width: 200px;
}

.profile-name {
    font-family: var(--kmdt-font-display);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 15px var(--kmdt-red-glow);
}

.profile-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.profile-age {
    font-size: 0.9rem;
    color: var(--kmdt-text-muted);
}

.profile-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.profile-section {
    break-inside: avoid;
}

/* Info grid (fiche élève) */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-label {
    font-size: 0.75rem;
    color: var(--kmdt-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.2rem;
    font-family: var(--kmdt-font-display);
}

.info-value {
    font-size: 0.95rem;
    color: var(--kmdt-text);
}

/* Timeline grades */
.grade-timeline {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--kmdt-border);
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 0.3rem;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(139, 0, 0, 0.3);
}

.timeline-content {
    flex: 1;
}

.timeline-date {
    font-size: 0.8rem;
    color: var(--kmdt-text-muted);
    margin-left: 0.5rem;
}

.timeline-note {
    font-size: 0.85rem;
    color: var(--kmdt-text-muted);
    margin-top: 0.2rem;
}

/* Header sous-section (titre + bouton inline) */
.subsection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.subsection-header .subsection-title {
    margin-bottom: 0;
}

/* Bouton accent */
.btn-accent {
    background: var(--kmdt-red);
    color: var(--kmdt-text);
    border: 1px solid var(--kmdt-red-bright);
    font-weight: 600;
}

.btn-accent:hover {
    background: var(--kmdt-red-bright);
    box-shadow: 0 0 15px var(--kmdt-red-glow);
}

/* Formulaire ajout grade */
.grade-add-form {
    background: rgba(139, 0, 0, 0.06);
    border: 1px solid var(--kmdt-border);
    border-radius: var(--kmdt-radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
    animation: fadeInUp 0.3s ease;
}

.grade-form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.grade-form-row .form-group {
    flex: 1;
}

.grade-form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    justify-content: flex-end;
}

/* Bouton suppression grade (icône discrète) */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    font-size: 0.85rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0.4;
}

.btn-icon:hover {
    opacity: 1;
    background: rgba(255, 23, 68, 0.1);
}

.btn-delete-grade:hover {
    color: #ff1744;
}

/* Groupe date + bouton Aujourd'hui */
.date-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.date-input-group .form-input {
    flex: 1;
}

/* Utilitaire */
.hidden {
    display: none !important;
}

/* Notes */
.notes-content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================================
   TABLE UTILISATEURS
   ============================================================ */
.user-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--kmdt-text);
}

.user-table th,
.user-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--kmdt-border);
}

.user-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--kmdt-text-muted);
    background: rgba(139, 0, 0, 0.08);
    font-family: var(--kmdt-font-display);
}

.user-table tbody tr:hover {
    background: rgba(139, 0, 0, 0.06);
}

.row-inactive {
    opacity: 0.5;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
    margin-top: 2rem;
}

.page-link {
    padding: 0.5rem 0.85rem;
    background: var(--kmdt-card);
    border: 1px solid var(--kmdt-border);
    border-radius: 8px;
    color: var(--kmdt-text);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.page-link:hover {
    background: rgba(139, 0, 0, 0.2);
    border-color: var(--kmdt-red);
    color: var(--kmdt-text);
}

.page-link.active {
    background: var(--kmdt-red);
    border-color: var(--kmdt-red-bright);
    font-weight: 700;
    box-shadow: 0 0 10px rgba(139, 0, 0, 0.4);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 15px var(--kmdt-red-glow));
}

.empty-text {
    font-size: 1.1rem;
    color: var(--kmdt-text-muted);
    margin-bottom: 1.5rem;
}

/* ============================================================
   UTILITAIRES TEXTE
   ============================================================ */
.text-muted {
    color: var(--kmdt-text-muted) !important;
}

.text-danger {
    color: #ff1744 !important;
}

.text-warning {
    color: #ffab00 !important;
}

.link {
    color: var(--kmdt-red-bright);
    text-decoration: none;
    transition: all 0.2s ease;
}

.link:hover {
    color: var(--kmdt-text);
    text-shadow: 0 0 8px var(--kmdt-red-glow);
    text-decoration: underline;
}

/* Photo thumbnail (édition) */
.current-photo {
    margin-top: 0.5rem;
}

.thumb-preview {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid var(--kmdt-red);
    box-shadow: 0 0 8px rgba(139, 0, 0, 0.2);
}

/* ============================================================
   LOGIN PAGE — Fond fumée + glassmorphism
   ============================================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-image: url('../img/smoke_bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}

/* Overlay sombre + lueur pour la page login */
.login-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(139, 0, 0, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, var(--kmdt-blue-glow) 0%, transparent 60%),
        rgba(0, 0, 0, 0.5);
    z-index: 0;
}

.login-page>* {
    position: relative;
    z-index: 1;
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--kmdt-border);
    border-radius: var(--kmdt-radius-lg);
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(139, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: loginAppear 0.8s ease-out;
}

@keyframes loginAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

/* Logo dans la page de login */
.login-logo {
    width: 80px;
    height: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 15px var(--kmdt-red-glow));
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {

    0%,
    100% {
        filter: drop-shadow(0 0 15px rgba(139, 0, 0, 0.4));
    }

    50% {
        filter: drop-shadow(0 0 25px rgba(139, 0, 0, 0.6));
    }
}

.login-title {
    font-family: var(--kmdt-font-display);
    font-size: 3rem;
    font-weight: 700;
    color: var(--kmdt-text);
    letter-spacing: 0.2em;
    margin-bottom: 0.2rem;
    text-shadow:
        0 0 30px var(--kmdt-red-glow),
        0 0 60px rgba(139, 0, 0, 0.2);
}

.login-subtitle {
    font-family: var(--kmdt-font-display);
    font-size: 0.9rem;
    color: var(--kmdt-text-muted);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.login-desc {
    font-size: 0.85rem;
    color: var(--kmdt-text-dim);
    margin-top: 0.5rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-version {
    text-align: center;
    font-size: 0.7rem;
    color: var(--kmdt-text-dim);
    margin-top: 1.5rem;
    font-family: var(--kmdt-font-display);
    letter-spacing: 0.1em;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation d'apparition pour les cartes élèves */
.student-card {
    animation: fadeInUp 0.4s ease-out;
    animation-fill-mode: both;
}

.student-card:nth-child(1) {
    animation-delay: 0.02s;
}

.student-card:nth-child(2) {
    animation-delay: 0.04s;
}

.student-card:nth-child(3) {
    animation-delay: 0.06s;
}

.student-card:nth-child(4) {
    animation-delay: 0.08s;
}

.student-card:nth-child(5) {
    animation-delay: 0.1s;
}

.student-card:nth-child(6) {
    animation-delay: 0.12s;
}

.student-card:nth-child(7) {
    animation-delay: 0.14s;
}

.student-card:nth-child(8) {
    animation-delay: 0.16s;
}

.student-card:nth-child(n+9) {
    animation-delay: 0.18s;
}

/* ============================================================
   SCROLLBAR PERSONNALISÉE
   ============================================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--kmdt-black);
}

::-webkit-scrollbar-thumb {
    background: var(--kmdt-red);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--kmdt-red-bright);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* ============================================================
   BOUTON TOGGLE FILTRES (base — caché sur desktop, visible mobile)
   ============================================================ */
.btn-toggle-filters {
    display: none;
    width: 100%;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-family: var(--kmdt-font-display);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    position: relative;
}

.toggle-filters-icon {
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

/* Dot rouge quand des filtres sont actifs */
.filters-active-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--kmdt-red-bright);
    box-shadow: 0 0 6px rgba(204, 21, 51, 0.6);
    display: inline-block;
}

/* ============================================================
   NAVBAR — éléments responsive
   ============================================================ */
.nav-user-info {
    color: var(--kmdt-text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.nav-link-theme {
    font-family: var(--kmdt-font-display);
    font-size: 0.82rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ============================================================
   MEDIA QUERIES — TABLETTE (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .profile-actions {
        justify-content: center;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .stats-row {
        justify-content: center;
    }

    .login-title {
        font-size: 2.2rem;
    }

    .login-container {
        margin: 1rem;
        padding: 1.5rem;
    }

    /* Navbar collapse — orientation verticale des éléments secondaires */
    .navbar-nav-right {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem !important;
        padding-top: 0.75rem;
        border-top: 1px solid var(--kmdt-border);
        margin-top: 0.5rem;
    }

    .nav-user-info {
        padding: 0.4rem 0;
    }

    .nav-logout-btn {
        width: 100%;
        text-align: center;
        margin-top: 0.25rem;
    }
}

/* ============================================================
   MEDIA QUERIES — MOBILE (≤ 576px)
   ============================================================ */
@media (max-width: 576px) {

    /* --- MAIN CONTAINER --- */
    main.container {
        padding-top: 70px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
        padding-bottom: 30px !important;
    }

    /* --- NAVBAR --- */
    .kmdt-logo-img {
        height: 28px;
    }

    .kmdt-logo {
        font-size: 1.1rem;
        letter-spacing: 2px;
    }

    .navbar {
        padding: 0.3rem 0.5rem;
    }

    /* --- DASHBOARD HEADER --- */
    .dashboard-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 1rem;
        gap: 0.5rem;
    }

    .page-title {
        font-size: 1.15rem;
        margin-bottom: 0.5rem;
    }

    .dashboard-header .btn-primary {
        font-size: 0.68rem;
        padding: 0.4rem 0.7rem;
        white-space: nowrap;
        letter-spacing: 0.5px;
    }

    /* --- STATS --- */
    .stats-row {
        gap: 0.4rem;
    }

    .stat-card {
        padding: 0.5rem 0.7rem;
        min-width: 65px;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .stat-label {
        font-size: 0.6rem;
    }

    /* --- SEARCH BAR --- */
    .search-bar {
        margin-bottom: 1rem;
    }

    .search-input-wrap {
        margin-bottom: 0.5rem;
    }

    .search-input {
        font-size: 0.82rem;
        padding: 0.55rem 0.8rem;
    }

    .btn-search {
        padding: 0.55rem 0.8rem;
    }

    /* --- BOUTON TOGGLE FILTRES — visible en mobile --- */
    .btn-toggle-filters {
        display: flex;
    }

    /* --- FILTRES — cachés par défaut en mobile --- */
    .filters-row {
        display: none;
        flex-direction: column;
        gap: 0.5rem;
    }

    .filters-row.open {
        display: flex;
    }

    .filters-row .form-select {
        min-width: auto;
        flex: 1 1 100%;
        font-size: 0.8rem;
        padding: 0.45rem 2rem 0.45rem 0.7rem;
    }

    /* --- VIEW TOGGLE — masqué en mobile (vue vignette forcée) --- */
    .view-toggle {
        display: none !important;
    }

    /* --- TABLEAU MEMBRES — masqué en mobile --- */
    .members-table-wrap {
        display: none !important;
    }

    /* --- GRILLE ÉLÈVES — 2 colonnes compactes --- */
    .students-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem;
    }

    .student-card {
        padding: 0.6rem;
        flex-direction: column;
        text-align: center;
        gap: 0.4rem;
    }

    .student-card:hover {
        transform: none;
    }

    .student-photo {
        width: 48px;
        height: 48px;
    }

    .student-name {
        font-size: 0.75rem;
    }

    .student-meta {
        justify-content: center;
        gap: 0.3rem;
    }

    .meta-item {
        font-size: 0.65rem;
    }

    /* Masquer les infos étendues en vignette mobile */
    .student-details-extended {
        display: none !important;
    }

    /* Ceinture indicator — plus petit en mobile */
    .ceinture-indicator {
        width: 32px;
        height: 18px;
        top: -3px;
        left: -3px;
    }

    /* Status dot — plus petit */
    .card-status-dot {
        width: 9px;
        height: 9px;
        top: 6px;
        right: 6px;
    }

    /* Badge dossier incomplet — plus petit */
    .badge-dossier-incomplet {
        width: 18px;
        height: 18px;
        bottom: 4px;
        right: 4px;
        font-size: 0.65rem;
    }

    .badge-dossier-incomplet::before {
        width: 14px;
    }

    /* --- PAGINATION --- */
    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
        justify-content: center;
    }

    .page-link {
        font-size: 0.75rem;
        padding: 0.3rem 0.55rem;
        min-width: 28px;
    }

    /* --- EMPTY STATE --- */
    .empty-state {
        padding: 2rem 1rem;
    }

    .empty-icon {
        font-size: 2.5rem;
    }

    /* --- PROFIL ÉLÈVE (vue détail) --- */
    .profile-photo {
        width: 80px;
        height: 80px;
    }

    .profile-header {
        padding: 1rem;
        gap: 1rem;
    }

    .profile-name {
        font-size: 1.1rem;
    }

    /* --- FORMULAIRES --- */
    .form-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .form-actions .btn {
        width: 100%;
        text-align: center;
    }

    /* --- FOOTER --- */
    footer .container {
        padding: 0 0.5rem;
    }

    footer p {
        font-size: 0.75rem !important;
    }

    footer img {
        height: 30px !important;
    }
}

/* ============================================================
   PHOTO CROPPER — Éditeur de photo interactif
   ============================================================ */

/* Preview circulaire cliquable */
.photo-editor-zone {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.photo-preview-circle {
    width: 100px;
    height: 100px;
    border-radius: var(--kmdt-radius);
    border: 3px solid var(--kmdt-red);
    box-shadow: 0 0 12px rgba(139, 0, 0, 0.3);
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 15, 15, 0.9);
    flex-shrink: 0;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.photo-preview-circle:hover {
    border-color: var(--kmdt-red-bright);
    box-shadow: 0 0 20px rgba(204, 21, 51, 0.4);
}

.photo-preview-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    color: var(--kmdt-text-muted);
}

.photo-placeholder span {
    font-size: 1.5rem;
}

.photo-placeholder small {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.photo-editor-actions {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

/* Modal */
.photo-cropper-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.photo-cropper-modal.active {
    display: flex;
}

.photo-cropper-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.photo-cropper-dialog {
    position: relative;
    z-index: 1;
    background: var(--kmdt-card-solid);
    border: 1px solid var(--kmdt-border);
    border-radius: var(--kmdt-radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(139, 0, 0, 0.15);
    overflow: hidden;
}

.photo-cropper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--kmdt-border);
}

.photo-cropper-header h3 {
    font-family: var(--kmdt-font-display);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.03em;
}

.photo-cropper-body {
    padding: 1.5rem;
    display: flex;
    justify-content: center;
}

.photo-cropper-container {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    border-radius: var(--kmdt-radius);
    background: #000;
}

.photo-cropper-container img {
    display: block;
    max-width: 100%;
}

.photo-cropper-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--kmdt-border);
}

.photo-cropper-controls input[type="range"] {
    flex: 1;
    max-width: 200px;
    accent-color: var(--kmdt-red-bright);
    height: 4px;
}

.photo-cropper-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--kmdt-border);
}

/* ============================================================
   FLASHCARDS — apprentissage des prénoms
   ============================================================ */
.btn-flashcards {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 0.95rem;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.85), rgba(180, 20, 20, 0.85));
    color: var(--kmdt-text);
    border: 1px solid rgba(255, 90, 90, 0.35);
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 12px rgba(139, 0, 0, 0.25);
}

.btn-flashcards:hover {
    background: linear-gradient(135deg, rgba(180, 20, 20, 0.95), rgba(220, 40, 40, 0.95));
    box-shadow: 0 0 18px rgba(220, 40, 40, 0.45);
    transform: translateY(-1px);
}

/* Modale plein écran */
.flashcards-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.flashcards-modal.open {
    display: flex;
}

.flashcards-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(6px);
}

.flashcards-dialog {
    position: relative;
    width: min(560px, 94vw);
    max-height: 94vh;
    background: var(--kmdt-card);
    border: 1px solid var(--kmdt-border);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(139, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.flashcards-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--kmdt-border);
    background: rgba(0, 0, 0, 0.25);
    flex-wrap: wrap;
}

.flashcards-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--kmdt-text);
}

.flashcards-stats {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    margin-right: 0.5rem;
    flex-wrap: wrap;
}

.fc-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--kmdt-text-dim);
}

.fc-stat b {
    color: var(--kmdt-text);
    font-weight: 900;
}

.fc-stat-new    { border-color: rgba(255, 171, 0, 0.4);  color: #ffb84d; }
.fc-stat-learning { border-color: rgba(68, 216, 241, 0.4); color: #6be1f0; }
.fc-stat-done   { border-color: rgba(16, 185, 129, 0.5); color: #35d8a4; }

.flashcards-close {
    background: transparent;
    border: none;
    color: var(--kmdt-text-dim);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.flashcards-close:hover {
    color: var(--kmdt-text);
    background: rgba(255, 255, 255, 0.08);
}

.flashcards-body {
    padding: 1.5rem 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 360px;
    justify-content: center;
}

.fc-card-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.fc-photo-wrap {
    position: relative;
    width: 100%;
    max-width: 340px;
}

.fc-photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center top;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: var(--kmdt-bg-dark, #111);
}

.fc-box-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
}

.fc-box-badge.box-0 { border-color: rgba(255, 171, 0, 0.6);  color: #ffb84d; }
.fc-box-badge.box-1 { border-color: rgba(68, 216, 241, 0.6); color: #6be1f0; }
.fc-box-badge.box-2 { border-color: rgba(16, 185, 129, 0.7); color: #35d8a4; }

.fc-reveal {
    text-align: center;
    animation: fcFadeIn 0.25s ease;
}

.fc-name {
    font-family: var(--font-heading, inherit);
    font-size: 1.7rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    color: var(--kmdt-text);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

@keyframes fcFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fc-done {
    text-align: center;
    padding: 2rem 1rem;
}

.fc-done-icon {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
}

.fc-done h4 {
    margin: 0.5rem 0 0.25rem;
    font-size: 1.2rem;
    color: var(--kmdt-text);
}

.fc-done p {
    color: var(--kmdt-text-dim);
    font-size: 0.85rem;
    margin: 0;
}

.flashcards-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--kmdt-border);
    background: rgba(0, 0, 0, 0.25);
}

.fc-actions {
    display: flex;
    gap: 0.6rem;
    margin-left: auto;
}

.flashcards-modal .hidden {
    display: none !important;
}

/* Mobile */
@media (max-width: 576px) {
    .flashcards-dialog {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .flashcards-header h3 {
        font-size: 0.85rem;
    }
    .fc-stat {
        font-size: 0.58rem;
        padding: 0.2rem 0.45rem;
    }
    .fc-name {
        font-size: 1.35rem;
    }
    .flashcards-footer {
        flex-direction: column-reverse;
        gap: 0.6rem;
    }
    .fc-actions {
        width: 100%;
        justify-content: stretch;
    }
    .fc-actions .btn {
        flex: 1;
    }
}

/* ============================================================
   MODALE INVITATION — depuis tableau membres
   ============================================================ */
.invite-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.invite-modal.open {
    display: flex;
}

.invite-modal .hidden {
    display: none !important;
}

.invite-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(6px);
}

.invite-dialog {
    position: relative;
    width: min(540px, 94vw);
    max-height: 94vh;
    background: var(--kmdt-card, var(--bg-card));
    border: 1px solid var(--kmdt-border, var(--border-subtle));
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(68, 216, 241, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.invite-header {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--kmdt-border, var(--border-subtle));
    background: rgba(0, 0, 0, 0.25);
}

.invite-header h3 {
    margin: 0;
    flex: 1;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--kmdt-text, var(--text-primary));
}

.invite-close {
    background: transparent;
    border: none;
    color: var(--kmdt-text-dim, var(--text-secondary));
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: background 0.15s;
}

.invite-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--kmdt-text, var(--text-primary));
}

.invite-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.invite-who {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.invite-desc {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.invite-state {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.invite-url {
    font-family: monospace;
    font-size: 0.75rem;
}

.invite-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.invite-error {
    margin-top: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ff6b6b;
    border-radius: 8px;
    font-size: 0.85rem;
}

@media (max-width: 480px) {
    .invite-dialog {
        width: 96vw;
    }
    .invite-actions {
        width: 100%;
    }
    .invite-actions .btn,
    .invite-actions form {
        flex: 1;
    }
    .invite-actions form .btn {
        width: 100%;
    }
}