/* ═══════════════════════════════════════════════════════════════════════════
   BMDSpoke — Module Gestion de la Scolarité (Universités)
   Design System hérité directement de "Gestion des RH — Personnel"
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --accent-indigo: #4f46e5;
    --border-light: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --bg-card: #ffffff;
}

/* ── Panneaux d'affichage autonomes (Statistiques, Inscriptions, Migrations) ── */
.sco-view-panel {
    display: none;
    animation: fadeIn .2s ease;
}
.sco-view-panel.active {
    display: block;
}

/* ── Barre d'outils aérée, moderne et anti-chevauchement ── */
.sco-toolbar-1row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 12px !important;
    flex-wrap: nowrap !important;
    padding: 8px 12px !important;
    margin-bottom: 10px !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    border: 1px solid var(--border-light, #e2e8f0) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.04) !important;
    overflow-x: auto !important;
    scrollbar-width: none;
}
.sco-toolbar-1row::-webkit-scrollbar {
    display: none;
}

.sco-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto !important;
    max-width: 480px !important;
    min-width: 220px !important;
}

.sco-toolbar-left .input-group {
    width: 100%;
    flex-wrap: nowrap !important;
}

.sco-toolbar-left .input-group-text {
    font-size: 0.75rem !important;
    padding: 4px 8px !important;
    white-space: nowrap !important;
    background: #f1f5f9 !important;
}

.sco-toolbar-left select,
.sco-toolbar-left #sco-sel-flat {
    font-size: 0.76rem !important;
    height: 32px !important;
    padding: 3px 24px 3px 8px !important;
    max-width: 320px !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

.sco-toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px !important;
    flex: 0 0 auto;
    flex-wrap: nowrap !important;
    justify-content: flex-end;
    white-space: nowrap !important;
}

/* Boutons d'outils carrés / aérés avec icône (PDF, Excel, Colonnes, Fiches) */
.sco-tool-btn {
    height: 32px;
    min-width: 32px;
    padding: 3px 8px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem !important;
    border-radius: 6px;
    border: 1px solid var(--border-light, #cbd5e1);
    background: #ffffff;
    transition: all 0.15s ease-in-out;
}
.sco-tool-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}
.sco-tool-btn i {
    font-size: 0.85rem;
}

/* Recherche aérée sans wrapping */
.sco-search-box {
    position: relative;
    width: 160px !important;
    min-width: 120px !important;
}
.sco-search-box i {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.74rem;
    pointer-events: none;
    z-index: 2;
}
.sco-search-box input {
    height: 32px !important;
    padding-left: 28px !important;
    padding-right: 8px !important;
    font-size: 0.75rem !important;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.sco-search-box input:focus {
    background: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    outline: none;
}

/* Séparateur vertical entre blocs d'outils */
.sco-v-divider {
    width: 1px;
    height: 22px;
    background: #e2e8f0;
    margin: 0 3px;
}

/* ── Tableaux de données Ultra-Compacts (Identique RH Personnel) ── */
.data-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    scrollbar-width: thin;
}

.data-table-wrap::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
.data-table-wrap::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .74rem;
    font-family: 'Inter', sans-serif;
    table-layout: auto;
}

.data-table th {
    background: var(--accent-indigo, #4f46e5);
    color: #ffffff;
    padding: 5px 6px;
    text-align: left;
    font-weight: 700;
    font-size: .67rem;
    text-transform: uppercase;
    letter-spacing: .3px;
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
    line-height: 1.2;
    border: none;
}

.data-table td {
    padding: 4px 6px;
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    vertical-align: middle;
    font-size: .74rem;
    line-height: 1.25;
    color: var(--text-primary, #1e293b);
}

.data-table td.text-nowrap,
.data-table th.text-nowrap {
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background .12s;
    cursor: default;
}
.data-table tbody tr:hover {
    background: #f8fafc;
}
.data-table tbody tr:nth-child(even) {
    background: #fafbfc;
}
.data-table tbody tr:nth-child(even):hover {
    background: #f1f5f9;
}

/* ── Avatar compact dans les tables (22x22) ── */
.data-table .student-avatar-sm {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #cbd5e1;
    flex-shrink: 0;
    display: inline-block;
}

/* ── Boutons d'actions compacts ── */
.data-table .btn-action-sm {
    padding: 1px 4px !important;
    font-size: 0.68rem !important;
    line-height: 1.2 !important;
}

/* ── Compact Switch in tables (Catégorisation) ── */
.data-table .form-check.form-switch {
    min-height: auto;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.data-table .form-check.form-switch .form-check-input {
    width: 2rem;
    height: 1.1rem;
    margin: 0 !important;
    cursor: pointer;
}

/* ── RDC Binary Category Button Group ── */
.data-table .btn-group-sm .btn {
    font-size: 0.71rem !important;
    padding: 2px 8px !important;
    line-height: 1.3 !important;
    border-radius: 4px;
}

/* ── Page Sizer ── */
.page-sizer {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .74rem;
    color: var(--text-secondary, #475569);
}
.page-sizer select {
    padding: 2px 18px 2px 6px;
    font-size: .74rem;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 4px;
    background-color: #fff;
}
.ps-info {
    font-size: .72rem;
    color: var(--text-muted, #94a3b8);
}
.page-sizer .ps-nav {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.page-sizer .btn-ps-prev,
.page-sizer .btn-ps-next {
    height: 26px;
    line-height: 1;
    font-size: 0.70rem;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    border-color: #cbd5e1;
    background-color: #f8fafc;
    color: #334155;
}
.page-sizer .btn-ps-prev:hover:not(:disabled),
.page-sizer .btn-ps-next:hover:not(:disabled) {
    background-color: #e2e8f0;
    border-color: #94a3b8;
    color: #0f172a;
}
.page-sizer .btn-ps-prev:disabled,
.page-sizer .btn-ps-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: #f1f5f9;
}

/* ── Colonnes Dropdown Toggle ── */
.col-toggle-wrap {
    position: relative;
    display: inline-block;
}
.col-toggle-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 1050;
    min-width: 210px;
    max-height: 340px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid var(--border-light, #cbd5e1);
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 10px 25px rgba(0,0,0,.12);
}
.col-toggle-dropdown.open {
    display: block;
    animation: fadeIn .15s ease;
}
.col-toggle-dropdown .ct-header {
    padding: 4px 8px 6px;
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted, #94a3b8);
    border-bottom: 1px solid var(--border-light, #e2e8f0);
    margin-bottom: 4px;
}
.col-toggle-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 8px;
    font-size: .76rem;
    color: var(--text-primary, #334155);
    cursor: pointer;
    border-radius: 4px;
    user-select: none;
}
.col-toggle-item:hover {
    background: #f1f5f9;
}
.col-toggle-item input[type="checkbox"] {
    cursor: pointer;
}

/* ── Segmented Control pour sous-onglets (Migrations / Catégorisation) ── */
.sco-segmented {
    display: inline-flex;
    background: #f1f5f9;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
    margin-bottom: 12px;
}
.sco-seg-btn {
    padding: 5px 14px;
    border-radius: 6px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary, #475569);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all .15s ease;
}
.sco-seg-btn:hover {
    color: var(--text-primary, #0f172a);
}
.sco-seg-btn.active {
    background: #ffffff;
    color: var(--accent-indigo, #4f46e5);
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.sco-sub-content {
    background: #ffffff;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.03);
}

/* ── MODAL EXÉCUTIF RH (Identique modal agent) ── */
.rh-modal-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 55%, #2563eb 100%) !important;
    padding: 10px 16px !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.22) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.rh-modal-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rh-modal-icon-badge {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.20) !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.98rem;
    flex-shrink: 0;
}

.rh-modal-title {
    font-size: 1.02rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    line-height: 1.15 !important;
    margin: 0 !important;
}

.rh-modal-subtitle {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.85) !important;
    margin-top: 2px;
    display: block;
}

.rh-modal-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.rh-modal-close-btn:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    transform: rotate(90deg) scale(1.05);
}

.rh-modal-tabs-bar {
    background: #edf2f7 !important;
    border-bottom: 2px solid #cbd5e1 !important;
    padding: 6px 14px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
}

.rh-modal-tabs-bar .nav-link {
    border-radius: 6px !important;
    padding: 5px 11px !important;
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    color: #475569 !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid #cbd5e1 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: all 0.15s ease !important;
}
.rh-modal-tabs-bar .nav-link:hover {
    background: #ffffff !important;
    color: #0f172a !important;
}
.rh-modal-tabs-bar .nav-link.active {
    background: #ffffff !important;
    color: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    box-shadow: 0 2px 6px rgba(29, 78, 216, 0.15) !important;
    font-weight: 700 !important;
}

.rh-tab-step-badge {
    width: 17px;
    height: 17px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
}
.rh-tab-step-badge.blue { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.rh-tab-step-badge.green { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.rh-tab-step-badge.amber { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.rh-tab-step-badge.purple { background: #faf5ff; color: #9333ea; border: 1px solid #e9d5ff; }
.rh-tab-step-badge.teal { background: #f0fdfa; color: #0d9488; border: 1px solid #99f6e4; }

/* ── Modal Étudiant : Ultra-Compact & Haute Lisibilité ── */
#modal-etudiant .rh-modal-body {
    padding: 8px 12px !important;
    max-height: 76vh !important;
    overflow-y: auto;
    background: #f8fafc;
}

#modal-etudiant .rh-modal-tabs-bar {
    padding: 4px 10px !important;
    gap: 4px !important;
}

#modal-etudiant .rh-modal-tabs-bar .nav-link {
    padding: 4px 8px !important;
    font-size: 0.73rem !important;
    border-radius: 6px !important;
}

#modal-etudiant .rh-tab-step-badge {
    width: 18px !important;
    height: 18px !important;
    font-size: 0.65rem !important;
    line-height: 18px !important;
}

#modal-etudiant .rh-form-card {
    background: #ffffff;
    border: 1px solid var(--border-light, #e2e8f0);
    border-radius: 7px;
    padding: 7px 10px !important;
    margin-bottom: 7px !important;
    box-shadow: 0 1px 2px rgba(0,0,0,.02);
}

#modal-etudiant .rh-form-card-title {
    font-size: 0.69rem !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--accent-indigo, #4f46e5);
    margin-bottom: 6px !important;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 3px !important;
}

#modal-etudiant .rh-label {
    font-size: 0.68rem !important;
    font-weight: 600;
    color: #334155;
    margin-bottom: 2px !important;
    display: block;
    line-height: 1.1;
}

#modal-etudiant .rh-req {
    color: #ef4444;
}

#modal-etudiant .rh-input-group {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
    position: relative !important;
}

#modal-etudiant .rh-field-icon {
    font-size: 0.78rem !important;
    color: #64748b !important;
    width: 18px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
}

#modal-etudiant .rh-input-group:focus-within .rh-field-icon {
    color: #2563eb !important;
}

#modal-etudiant .form-control,
#modal-etudiant .form-select {
    height: 28px !important;
    padding: 2px 7px !important;
    font-size: 0.76rem !important;
    line-height: 1.2 !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    color: #0f172a !important;
    background-color: #ffffff;
}

#modal-etudiant .form-control:focus,
#modal-etudiant .form-select:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15) !important;
}

/* ── Animation ── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Formulaire ENF (4 Colonnes Panorama - Conforme au prototype) ── */
.enf-grid-4cols {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    align-items: start;
}
@media (max-width: 1200px) {
    .enf-grid-4cols {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 768px) {
    .enf-grid-4cols {
        grid-template-columns: 1fr;
    }
}
.enf-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.enf-card {
    background: #edf3fa;
    border: 1px solid #d4e3f5;
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 1px 4px rgba(30, 80, 160, 0.04);
}
.enf-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 4px;
}
.enf-header-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #2563eb;
    position: relative;
}
.enf-header-title::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 3px;
    background: #3b82f6;
    border-radius: 2px;
    margin-left: 6px;
    vertical-align: middle;
}
.enf-fg {
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
}
.enf-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 2px;
}
.enf-iw {
    position: relative;
    display: flex;
    align-items: center;
}
.enf-ii {
    position: absolute;
    left: 9px;
    font-size: 0.72rem;
    color: #2563eb;
    pointer-events: none;
    z-index: 2;
}
.enf-in {
    width: 100%;
    height: 27px;
    padding: 2px 8px 2px 28px;
    font-size: 0.74rem;
    background: #ffffff;
    border: 1px solid #c9dff7;
    border-radius: 14px;
    color: #1e293b;
    outline: none;
    transition: all 0.15s ease-in-out;
}
.enf-in:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
    background: #ffffff;
}
.enf-file-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid #c9dff7;
    border-radius: 14px;
    padding: 2px 8px;
    height: 27px;
}
.enf-file-icon {
    font-size: 0.72rem;
    color: #2563eb;
}
.enf-btn-file {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.68rem;
    padding: 1px 7px;
    color: #1e293b;
    cursor: pointer;
}
.enf-file-name {
    font-size: 0.68rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Sélection multiple d'apprenants (Inscriptions & Profils) ── */
.chk-inscrit-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.chk-inscrit, #chk-select-all-inscrits {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #2563eb;
    margin: 0;
}
tr.row-selected {
    background-color: #eff6ff !important;
}
tr.row-selected td {
    background-color: #eff6ff !important;
}

/* ── Bouton Fiche de scolarité dans Toolbar & Actions ── */
#btn-download-fiches:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.btn-action-sm {
    width: 26px;
    height: 26px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    border-radius: 6px;
}


