/* ============================================================
   ULFR — Gestion des Thèmes & Groupes
   Charte graphique complète
   ============================================================ */

/* --- Variables CSS --- */
:root {
    --color-primary: #348e38;
    --color-primary-hover: #1f1d1d;
    --color-secondary: #14b1bb;
    --color-nav-bg: #f6f4ec;
    --color-text-heading: #232323;
    --color-text-body: #4f555a;
    --color-accent-hover: #ffb600;
    --color-footer-bg: #232323;
    --color-header-bg: #1f5c22;
    --color-header-text: #ffffff;
    --color-white: #ffffff;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-success: #28a745;
    --color-info: #17a2b8;
    --color-light-bg: #f8f9fa;
    --color-border: #dee2e6;
    --font-heading: 'Lexend Deca', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --font-button: 'Nunito', sans-serif;
    --container-max: 1140px;
    --radius: 0px;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

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

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 16px;
    color: var(--color-text-body);
    background: var(--color-white);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main.main-content {
    flex: 1;
    padding: 2rem 0;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s;
}
a:hover {
    color: var(--color-accent-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--color-text-heading);
    line-height: 1.3;
    margin-bottom: 0.75rem;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p {
    margin-bottom: 1rem;
}

.text-muted { color: #6c757d; }
.text-center { text-align: center; }

/* --- Container --- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1rem;
}

/* --- Header / Navigation --- */
.site-header {
    background: var(--color-nav-bg);
    border-bottom: 1px solid var(--color-border);
    height: 135px;
    display: flex;
    align-items: center;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    max-width: var(--container-max);
    margin: 0 auto;
    width: 100%;
    height: 100%;
}

.header-logos {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 100%;
}

.logo-ulfr {
    height: 90px;
    width: auto;
    display: block;
}

.header-partners {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: 100%;
}

.logo-partner {
    height: 60px;
    width: auto;
    display: block;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.main-nav a {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 18px;
    color: var(--color-text-heading);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: background 0.3s, color 0.3s;
    text-decoration: none;
    white-space: nowrap;
}

.main-nav a:hover {
    color: var(--color-accent-hover);
    background: rgba(0,0,0,0.03);
}

/* --- Submenu (Guide Étudiant) --- */
.has-submenu {
    position: relative;
}

.has-submenu > .submenu-toggle {
    cursor: pointer;
}

.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 180px;
    list-style: none;
    padding: 0.5rem 0;
    z-index: 1000;
}

.has-submenu:hover > .submenu,
.has-submenu.open > .submenu {
    display: block;
}

.submenu li a {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}
.hamburger span {
    display: block;
    width: 28px;
    height: 3px;
    background: var(--color-text-heading);
    border-radius: 2px;
    transition: 0.3s;
}

/* --- Footer --- */
.site-footer {
    background: var(--color-footer-bg);
    color: #ccc;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
    font-size: 0.9rem;
}
.site-footer p { margin: 0; }

/* --- Hero --- */
.hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, #2a6e2d 100%);
    color: var(--color-white);
    padding: 4rem 0;
    text-align: center;
    margin-bottom: 2rem;
}
.hero h1 {
    color: var(--color-white);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}
.hero p {
    font-size: 1.15rem;
    max-width: 700px;
    margin: 0 auto 2rem;
    opacity: 0.9;
}
.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    font-family: var(--font-button);
    font-weight: 700;
    font-size: 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.3s, color 0.3s, opacity 0.3s;
    text-decoration: none;
    border: none;
    line-height: 1.2;
    text-align: center;
    height: 46px;
}
.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
}
.btn-primary:hover {
    background: var(--color-primary-hover);
    color: var(--color-white);
}
.btn-secondary {
    background: var(--color-secondary);
    color: var(--color-white);
}
.btn-secondary:hover {
    background: #0e8e96;
    color: var(--color-white);
}
.btn-complet {
    background: #6c757d;
    color: #fff;
    border-color: #6c757d;
}
.btn-complet:hover {
    background: #5a6268;
    color: #fff;
}
.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}
.btn-outline:hover {
    background: var(--color-primary);
    color: var(--color-white);
}
.btn-danger {
    background: var(--color-danger);
    color: var(--color-white);
}
.btn-danger:hover {
    background: #c82333;
    color: var(--color-white);
}
.btn-success {
    background: var(--color-success);
    color: var(--color-white);
}
.btn-success:hover {
    background: #218838;
    color: var(--color-white);
}
.btn-warning {
    background: #e67e22;
    color: var(--color-white);
}
.btn-warning:hover {
    background: #d35400;
    color: var(--color-white);
}
.btn-sm {
    padding: 6px 14px;
    font-size: 14px;
    height: 34px;
}
.btn-block {
    display: block;
    width: 100%;
}

/* --- Cards --- */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.card-body {
    padding: 1.5rem;
}
.card-title {
    font-family: var(--font-heading);
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.card-count {
    color: var(--color-secondary);
    font-weight: 500;
    margin-bottom: 1rem;
}
.card-highlight {
    border-left: 4px solid var(--color-primary);
}
.stat-card {
    text-align: center;
    padding: 1.5rem;
}
.stat-number {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
}
.stat-label {
    font-size: 0.9rem;
    color: var(--color-text-body);
    margin-bottom: 1rem;
}

/* --- Forms --- */
.form-section {
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}
.form-card {
    max-width: 450px;
    width: 100%;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}
.form-card h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--color-text-heading);
    font-size: 0.95rem;
}
.form-input, .form-group input, .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--color-text-heading);
    background: var(--color-white);
    transition: border-color 0.3s;
    height: 46px;
}
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--color-text-heading);
    background: var(--color-white);
    transition: border-color 0.3s;
    min-height: 100px;
}
.form-input:focus, .form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(52, 142, 56, 0.2);
}
.input-small {
    max-width: 100px;
}
.form-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Inline form */
.form-inline {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.form-inline .form-group {
    margin-bottom: 0;
}
.form-inline-card {
    background: var(--color-light-bg);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
}
.form-inline-card h3 {
    margin-bottom: 1rem;
}
.inline-form {
    display: inline;
}

/* Input group */
.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.input-group input {
    flex: 1;
}

/* --- Tables --- */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}
.table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--color-border);
    font-size: 0.95rem;
}
.table thead {
    background: var(--color-header-bg);
    color: var(--color-header-text);
}
.table th {
    padding: 12px 10px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
    font-family: var(--font-heading);
    font-size: 0.9rem;
}
.table td {
    padding: 10px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
/* Seule la colonne Email (etudiants) doit pouvoir casser les mots longs */
#etudiantsTable td:nth-child(3) {
    overflow-wrap: break-word;
    word-break: break-word;
}
.table tbody tr:nth-child(even) {
    background: #f6f4ec;
}
.table tbody tr:hover {
    background: #e9ecef;
}
.actions-cell {
    white-space: nowrap;
}
.actions-cell .btn-sm + .btn-sm {
    margin-left: 0.4rem;
}

/* Tables étudiants et groupes : colonne Actions en vertical (wrapper flex dans le td) */
#etudiantsTable .actions-cell,
#groupesTable .actions-cell {
    white-space: normal;
}
#etudiantsTable .actions-cell .actions-stack,
#groupesTable .actions-cell .actions-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
}

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 500;
    position: relative;
}
.alert-success {
    color: #155724;
    background: #d4edda;
    border-color: #c3e6cb;
}
.alert-danger {
    color: #721c24;
    background: #f8d7da;
    border-color: #f5c6cb;
}
.alert-warning {
    color: #856404;
    background: #fff3cd;
    border-color: #ffeeba;
}
.alert-info {
    color: #0c5460;
    background: #d1ecf1;
    border-color: #bee5eb;
}

/* Alertes avec bouton de fermeture (×) */
.alert-dismissible {
    padding-right: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.alert-dismissible .alert-msg {
    flex: 1;
}
.alert-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    padding: 0 0.2rem;
    transition: opacity 0.15s;
}
.alert-close:hover {
    opacity: 1;
}

/* --- Dashboard étudiant --- */
.dashboard-section {
    padding: 1rem 0;
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
}
.welcome-text {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}
.parcours-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ff9800;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #856404;
}
.parcours-warning strong {
    color: #5c3d00;
}
.parcours-warning small {
    display: inline-block;
    margin-top: 4px;
    opacity: 0.85;
}
.parcours-warning span {
    font-weight: 500;
}
.parcours-rappel {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.9rem;
    font-weight: 600 !important;
    color: #856404;
}
.parcours-redbox {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-left: 4px solid #dc3545;
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #721c24;
}
.parcours-redbox strong {
    color: #491217;
}
.dashboard-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    align-items: start;
}
.dashboard-sidebar {
    background: var(--color-light-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    position: sticky;
    top: 80px;
}
.dashboard-sidebar h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
}
.domaine-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.domaine-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
}
.domaine-btn:hover, .domaine-btn.active {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}
.dashboard-main {
    min-height: 300px;
}
.themes-container {
    min-height: 200px;
}
.placeholder-message {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
}

/* Theme list */
.theme-list {
    margin-bottom: 1.5rem;
}
.theme-item {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}
.theme-item h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.theme-item h3:hover {
    color: var(--color-primary);
}
.theme-item .theme-toggle {
    font-size: 0.8rem;
    color: var(--color-primary);
}

/* Groupes list */
.groupes-container {
    margin-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    padding-top: 0.75rem;
}
.groupe-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 12px;
    background: var(--color-light-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}
.groupe-info {
    font-weight: 500;
    flex: 1;
    min-width: 0;
}
.groupe-info small {
    font-weight: 400;
    color: #6c757d;
    margin-left: 0.5rem;
}
.groupe-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Info table */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}
.info-table th {
    text-align: left;
    padding: 8px 12px 8px 0;
    font-weight: 700;
    color: var(--color-text-heading);
    width: 120px;
    vertical-align: top;
}
.info-table td {
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

/* Member list */
.member-list {
    list-style: none;
    margin-bottom: 1rem;
}
.member-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 10px;
}
.badge-info {
    background: var(--color-info);
    color: var(--color-white);
}
.badge-warning {
    background: var(--color-warning);
    color: var(--color-text-heading);
}

/* Action bar */
.action-bar {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid var(--color-border);
}

/* --- Admin --- */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}
.admin-session-info {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #6c757d;
}
#sessionTimer {
    font-weight: 700;
    color: var(--color-danger);
}

/* Stats grid */
.stats-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* Quick links */
.quick-links {
    margin-top: 2rem;
}
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.quick-link {
    display: block;
    padding: 1rem;
    background: var(--color-light-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-align: center;
    font-weight: 600;
    transition: all 0.3s;
}
.quick-link:hover {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

/* Crud section */
.crud-section {
    padding: 1rem 0;
}
.crud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.filter-bar {
    background: var(--color-light-bg);
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}
.filter-bar .form-group {
    margin-bottom: 0;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 0.75rem 0;
}
.page-info {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--color-text-body);
}

/* --- Modal / Overlay --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal-box {
    background: var(--color-white);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-box h3 {
    margin-bottom: 1rem;
}
.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

/* --- Loading spinner --- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- CTA section --- */
.cta-section {
    text-align: center;
    padding: 2rem 0;
}
.cta-box {
    background: var(--color-light-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2.5rem;
}
.cta-box h2 {
    margin-bottom: 0.5rem;
}
.cta-box p {
    margin-bottom: 1.5rem;
}

/* --- Responsive --- */
@media (max-width: 992px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
    .dashboard-sidebar {
        position: static;
    }
    h1 { font-size: 1.6rem; }
    .hero h1 { font-size: 1.8rem; }
}

@media (max-width: 768px) {
    /* Hamburger visible */
    .hamburger {
        display: flex;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--color-nav-bg);
        border-bottom: 1px solid var(--color-border);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    .main-nav.open {
        display: block;
    }
    .main-nav ul {
        flex-direction: column;
        padding: 1rem;
        gap: 0.25rem;
    }
    .main-nav a {
        display: block;
        padding: 0.75rem 1rem;
        font-size: 16px;
    }

    /* Mobile submenu */
    .has-submenu > .submenu-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .submenu {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 1rem;
        background: transparent;
    }
    .submenu li a {
        font-size: 15px;
    }

    .header-inner {
        position: relative;
        flex-wrap: nowrap;
    }

    .header-logos {
        gap: 0.75rem;
        flex-wrap: nowrap;
    }

    .logo-ulfr {
        height: 60px;
    }

    .logo-partner {
        height: 40px;
    }

    .site-header {
        height: auto;
        min-height: 80px;
    }

    /* Réduire encore pour les très petits écrans (360-480px) sans wrapping */
    @media (max-width: 480px) {
        .header-inner {
            gap: 0.25rem;
            padding: 0 0.5rem;
        }
        .header-logos {
            gap: 0.4rem;
        }
        .logo-ulfr {
            height: 45px;
        }
        .logo-partner {
            height: 30px;
        }
        .hamburger {
            padding: 3px;
        }
        .hamburger span {
            width: 22px;
            height: 2.5px;
        }
    }

    .hero {
        padding: 2.5rem 0;
    }

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

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .table {
        font-size: 0.85rem;
    }
    .table th, .table td {
        padding: 8px;
    }
    .info-table th {
        width: 100px;
    }
}

/* --- Search Groupes Section --- */
.search-groupes-section {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 2rem;
}
.search-groupes-form {
    margin-bottom: 1.5rem;
}
.search-groupes-form .input-group {
    display: flex;
    gap: 0.5rem;
    max-width: 500px;
}
.search-groupes-form .input-group input {
    flex: 1;
}
.search-groupes-results {
    min-height: 100px;
}
.groupes-search-list {
    display: grid;
    gap: 1rem;
}
.groupe-search-card {
    border-left: 4px solid var(--color-primary);
}
.groupe-search-card .member-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
}
.groupe-search-card .member-list li {
    padding: 4px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
}

/* --- Section Sujets disponibles --- */
.sujets-section {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.sujets-liste {
    display: grid;
    gap: 1rem;
}
.sujets-card {
    border-left: 4px solid var(--color-secondary);
    background: var(--color-light-bg);
}
.sujets-card .card-body {
    padding: 1rem;
}
.sujets-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.sujets-groupe-nom {
    font-size: 1.05rem;
}
.sujets-membres {
    font-size: 0.85rem;
    color: var(--color-text-body);
}
.sujets-details {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}
.sujets-domaine {
    color: var(--color-primary);
    font-weight: 500;
}
.sujets-theme {
    color: var(--color-secondary);
    font-weight: 500;
}
.sujets-sujet {
    font-style: italic;
    color: var(--color-text-heading);
    margin: 0.5rem 0;
    padding: 0.5rem 1rem;
    background: var(--color-white);
    border-radius: var(--radius);
    border-left: 3px solid var(--color-accent-hover);
}
.sujets-createur {
    font-size: 0.85rem;
    color: #6c757d;
}

/* ============================================================
   SYSTÈME D'INVITATION
   ============================================================ */

/* Section formulaire d'invitation */
.invitation-section {
    background: var(--color-light-bg);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-secondary);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.invitation-section h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-family: var(--font-heading);
    color: var(--color-text-heading);
}
.invitation-section .input-group {
    max-width: 500px;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.invitation-section .form-input {
    flex: 1;
}
.invitation-message {
    margin-top: 0.75rem;
}

/* Interface de délégation (propriétaire) */
.delegation-section {
    background: var(--color-light-bg);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-warning);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.delegation-section h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-family: var(--font-heading);
    color: var(--color-text-heading);
}
.delegation-list {
    margin-top: 0.75rem;
}
.delegation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
}
.delegation-item:last-child {
    border-bottom: none;
}
.delegation-nom {
    font-weight: 500;
    color: var(--color-text-heading);
}
.delegation-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}
.delegation-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}
.toggle-label {
    font-size: 0.85rem;
    color: var(--color-text-body);
}

/* Modal large pour le split */
.modal-box-wide {
    max-width: 720px;
    width: 95%;
}

/* Split modal (50/50) */
.split-modal {
    display: flex;
    gap: 0;
    margin: 1rem 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.split-panel {
    flex: 1;
    padding: 1.25rem;
    background: var(--color-white);
}
.split-panel-left {
    border-right: 2px solid var(--color-border);
}
.split-panel-right {
    background: #f0faf0;
}
.split-title {
    font-size: 1rem;
    text-align: center;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid var(--color-primary);
    font-family: var(--font-heading);
}
.split-content p {
    margin: 0.4rem 0;
    font-size: 0.9rem;
    line-height: 1.5;
}
.split-content strong {
    color: var(--color-text-heading);
}
.split-modal .btn-block {
    width: 100%;
    margin-top: 1rem;
    padding: 0.6rem 1rem;
    text-align: center;
}
.split-divider {
    display: none;
}

/* Modal de confirmation d'invitation (Cas A) */
#modalConfirmationInvitation .info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}
#modalConfirmationInvitation .info-table th {
    text-align: left;
    padding: 0.4rem 0.75rem;
    font-weight: 600;
    color: var(--color-text-heading);
    width: 40%;
    font-size: 0.9rem;
}
#modalConfirmationInvitation .info-table td {
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
}

/* Conteneur flex pour les sections d'invitation (côte à côte sur desktop) */
.invitation-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}
@media (min-width: 1025px) {
    .invitation-grid {
        flex-direction: row;
    }
    .invitation-grid .invitation-section,
    .invitation-grid .delegation-section {
        flex: 1;
        margin-top: 0 !important;
    }
}

/* Responsive : split modal empilé sur mobile */
@media (max-width: 768px) {
    .split-modal {
        flex-direction: column;
    }
    .split-panel-left {
        border-right: none;
        border-bottom: 2px solid var(--color-border);
    }
    .invitation-section .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    .delegation-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
}

/* Padding mobile sur .dashboard-section */
@media (max-width: 767px) {
    .dashboard-section {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* ============================================================
   AUTO-COMPLETE MOODLE
   ============================================================ */
.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-wrapper .form-input {
    padding-right: 40px;
}

.autocomplete-loading {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    pointer-events: none;
    z-index: 1;
}

.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid var(--color-border, #ddd);
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    max-height: 250px;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 0.65rem 0.85rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s;
}

.autocomplete-item:last-child {
    border-bottom: none;
    border-radius: 0 0 6px 6px;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: var(--color-primary-light, #e8f5e9);
}

.autocomplete-item.active {
    background-color: #d4edda;
}

.autocomplete-nom {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text, #232323);
    line-height: 1.3;
}

.autocomplete-email {
    font-size: 0.75rem;
    color: #999;
    margin-top: 3px;
    line-height: 1.2;
}

/* ============================================================
   SECTION DEMANDES D'ADHÉSION
   ============================================================ */
.requests-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
}

.requests-section h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    color: #333;
}

.request-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
    gap: 1rem;
    flex-wrap: wrap;
}

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

.request-info {
    flex: 1;
    min-width: 200px;
}

.request-message {
    font-style: italic;
    color: #555;
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
}

.request-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ============================================================
   SECTION MES DEMANDES
   ============================================================ */
.my-requests-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.request-status-item {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ============================================================
   BADGE MANAGER
   ============================================================ */
.badge-manager {
    background: #348e38;
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

/* ============================================================
   BOUTON DÉTACHER DANS MEMBER LIST
   ============================================================ */
.member-list li .btn-sm.btn-danger {
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* ============================================================
   SECTION DEMANDES — RESPONSIVE
   ============================================================ */
@media (max-width: 767px) {
    .request-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .request-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ============================================================
   TRANSFERT PROPRIÉTÉ
   ============================================================ */
.transfert-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
}

.transfert-section h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
    color: #555;
}

.transfert-section .input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.transfert-section .input-group select {
    flex: 1;
    min-width: 150px;
}

/* ============================================================
   BADGE SUCCESS / DANGER / WARNING (si non existants)
   ============================================================ */
.badge-success {
    background: #28a745;
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-danger {
    background: #dc3545;
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}
