/* ====================================================================
   IZEMSTUDY - Interface d'Administration Web (Normes Massar)
   Feuille de styles personnalisée moderne & responsive
   ==================================================================== */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-subtle: rgba(37, 99, 235, 0.1);
    
    --secondary-color: #475569;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #2563eb;
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    
    --sidebar-width: 260px;
    --topbar-height: 70px;
    
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base & Typography */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ====================================================================
   LAYOUT & STRUCTURE
   ==================================================================== */

.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    position: relative;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--text-light);
    flex-shrink: 0;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #ffffff;
}

.sidebar-logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary-color), #4f46e5);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.sidebar-brand h5 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.sidebar-brand span {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    padding: 1.25rem 0.85rem;
    flex-grow: 1;
}

.sidebar-section-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.92rem;
    transition: var(--transition);
    position: relative;
}

.sidebar-link i {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
    color: #94a3b8;
    transition: var(--transition);
}

.sidebar-link:hover {
    color: #ffffff;
    background-color: var(--bg-sidebar-hover);
}

.sidebar-link:hover i {
    color: #60a5fa;
    transform: translateX(2px);
}

.sidebar-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    font-weight: 600;
}

.sidebar-link.active i {
    color: #ffffff;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background-color: rgba(15, 23, 42, 0.6);
}

.user-compact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar-sm {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #475569, #334155);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

/* Main Content Area */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 0 0 calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100% - var(--sidebar-width));
    box-sizing: border-box;
    transition: var(--transition);
    overflow-x: hidden;
}

/* Top Navbar */
.top-navbar {
    height: var(--topbar-height);
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    box-shadow: var(--shadow-sm);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    gap: 0.75rem;
}

.top-navbar-left {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.btn-sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.top-navbar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

#header-school-name {
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-navbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.28rem 0.75rem;
    background-color: var(--primary-light);
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: 9999px;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
}

.user-badge-info {
    max-width: 150px;
    line-height: 1.2;
}

.user-badge-role {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#navUserName {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    border: 1px solid #fecaca;
    background-color: #fef2f2;
    color: var(--danger-color);
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-logout:hover {
    background-color: var(--danger-color);
    color: #ffffff;
    border-color: var(--danger-color);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
}

/* Main Content Container */
#main-content {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
}

#main-content > .container-fluid {
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 0.25rem !important;
    padding-bottom: 1.5rem !important;
    max-width: 100%;
}

/* ====================================================================
   CARDS & DASHBOARD COMPONENTS
   ==================================================================== */

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 30px -8px rgba(15, 23, 42, 0.1);
    border-color: #cbd5e1;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.stat-card-primary::before { background: linear-gradient(90deg, #2563eb, #3b82f6); }
.stat-card-success::before { background: linear-gradient(90deg, #059669, #10b981); }
.stat-card-warning::before { background: linear-gradient(90deg, #d97706, #f59e0b); }
.stat-card-info::before    { background: linear-gradient(90deg, #0891b2, #06b6d4); }

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon-primary {
    background-color: #eff6ff;
    color: #2563eb;
}

.stat-icon-success {
    background-color: #ecfdf5;
    color: #059669;
}

.stat-icon-warning {
    background-color: #fffbeb;
    color: #d97706;
}

.stat-icon-info {
    background-color: #ecfeff;
    color: #0891b2;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    margin: 0.4rem 0 0.2rem 0;
}

.stat-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
}

.stat-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Quick Action Cards */
.action-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

/* Data Table Styling */
.custom-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.custom-card-header {
    padding: 1.25rem 1.5rem;
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Tableaux parfaitement adaptatifs et scrollables */
.table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0.5rem;
    scrollbar-width: thin;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.table-custom,
.table-responsive > .table {
    margin: 0;
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom thead th,
.table-responsive > .table thead th {
    background-color: #f8fafc;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table-custom tbody td,
.table-responsive > .table tbody td {
    padding: 0.85rem 1.15rem;
    font-size: 0.88rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.table-custom tbody tr:hover,
.table-responsive > .table tbody tr:hover {
    background-color: #f1f5f9;
}

.code-massar-badge {
    background: #e0e7ff;
    color: #3730a3;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 700;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* Status Badges */
.badge-status {
    padding: 0.35rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.badge-nouveau {
    background-color: #ecfdf5;
    color: #065f46;
}

.badge-redoublant {
    background-color: #fffbeb;
    color: #92400e;
}

.badge-triplant {
    background-color: #fef2f2;
    color: #991b1b;
}

/* Search Box */
.search-wrapper {
    position: relative;
    max-width: 340px;
    width: 100%;
}

.search-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-input {
    padding-left: 2.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ====================================================================
   LOGIN SCREEN
   ==================================================================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: radial-gradient(circle at 10% 20%, #1e293b 0%, #0f172a 100%);
    position: relative;
}

.login-card {
    background: #ffffff;
    border-radius: var(--radius-xl);
    padding: 2.75rem;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 2;
}

.login-brand-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), #4f46e5);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.75rem;
    margin: 0 auto 1.25rem auto;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.demo-account-chip {
    cursor: pointer;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.78rem;
    transition: var(--transition);
}

.demo-account-chip:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Loading States & Skeletons */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.spinner-custom {
    width: 3.5rem;
    height: 3.5rem;
    border: 4px solid var(--primary-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ====================================================================
   MODALES FLUIDES, ADAPTATIVES & ANTI-DÉBORDEMENT
   ==================================================================== */
.modal {
    overflow-y: auto !important;
}

.modal-dialog {
    max-width: min(94vw, 680px);
    margin: 1.5rem auto;
}

.modal-dialog.modal-lg {
    max-width: min(96vw, 920px);
}

.modal-dialog.modal-xl {
    max-width: min(98vw, 1180px);
}

.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.28);
    max-height: calc(100vh - 3rem);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: #ffffff;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    flex-shrink: 0;
}

.modal-body {
    overflow-y: auto;
    max-height: calc(100vh - 180px);
    scrollbar-width: thin;
    padding: 1.25rem 1.5rem;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.modal-footer {
    padding: 0.85rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: #f8fafc;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    flex-shrink: 0;
}

/* ====================================================================
   RESPONSIVE DESIGN & MOBILE-FIRST OPTIMIZATIONS
   ==================================================================== */

/* Ordinateurs portables et résolutions standards (992px à 1399px) - Anti-débordement */
@media (min-width: 992px) and (max-width: 1399.98px) {
    #main-content {
        padding: 1.15rem 1.25rem;
    }

    .top-navbar {
        padding: 0 1rem;
        gap: 0.5rem;
    }

    .top-navbar-title {
        font-size: 0.95rem;
    }

    #header-school-name {
        max-width: 220px !important;
    }

    .user-badge {
        max-width: 180px;
        padding: 0.25rem 0.55rem;
        gap: 0.45rem;
    }

    .user-badge-info {
        max-width: 120px;
    }

    .btn-logout {
        padding: 0.38rem 0.7rem;
        font-size: 0.82rem;
    }

    .stat-card {
        padding: 1.1rem 1rem;
    }

    .stat-value {
        font-size: 1.65rem;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.15rem;
    }
}

/* Backdrop tactile pour mobile & tablette */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.28s ease-in-out;
    pointer-events: none;
}

body.sidebar-open .sidebar-backdrop,
.sidebar-backdrop.show {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Tablette et Smartphone (< 992px) */
@media (max-width: 991.98px) {
    .main-wrapper,
    html[dir="rtl"] .main-wrapper {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        z-index: 1055;
        width: 270px;
        transition: transform 0.28s ease-in-out;
        transform: translateX(-100%);
    }

    .sidebar.show,
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    /* Support RTL sous 992px */
    html[dir="rtl"] .sidebar {
        left: auto;
        right: 0;
        transform: translateX(100%);
    }

    html[dir="rtl"] .sidebar.show,
    html[dir="rtl"] body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .btn-sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .top-navbar {
        padding: 0 1rem;
    }

    #main-content {
        padding: 1rem 0.75rem;
    }
}

/* Smartphone (< 768px) */
@media (max-width: 767.98px) {
    /* En-têtes de vues et barres d'actions */
    .view-header-actions,
    .container-fluid > .d-flex.align-items-center.justify-content-between.mb-4 > .d-flex.gap-2 {
        width: 100% !important;
        flex-wrap: wrap !important;
    }

    .view-header-actions .btn,
    .container-fluid > .d-flex.align-items-center.justify-content-between.mb-4 > .d-flex.gap-2 > .btn,
    .container-fluid > .d-flex.align-items-center.justify-content-between.mb-4 > .d-flex.gap-2 > a.btn {
        flex: 1 1 auto !important;
        min-width: 120px;
        text-align: center;
        justify-content: center;
    }

    /* Grilles et Tableaux compacts */
    .table, .table-custom {
        font-size: 0.85rem !important;
    }

    .table th, .table td, .table-custom th, .table-custom td {
        padding: 0.55rem 0.65rem !important;
    }

    .badge, .badge-status, .code-massar-badge {
        white-space: nowrap !important;
        font-size: 0.75rem !important;
    }

    .table .btn-sm {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.75rem !important;
        white-space: nowrap;
    }

    /* Champs de saisie de notes agrandis au doigt (anti-zoom iOS/Android) */
    .input-note-val {
        min-height: 44px !important;
        font-size: 16px !important;
    }

    /* Bouton dans les barres d'actions collantes plein écran */
    .sticky-bottom-bar .btn,
    .card-footer.sticky-bottom-bar .btn {
        width: 100% !important;
    }
}

/* Petit écran mobile (< 576px) */
@media (max-width: 575.98px) {
    .top-navbar {
        padding-left: 12px !important;
        padding-right: 12px !important;
        gap: 0.5rem;
    }

    #header-school-name {
        display: inline-block !important;
        max-width: 140px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: middle;
        font-size: 0.95rem;
    }

    .top-navbar .btn,
    .top-navbar .btn-sidebar-toggle,
    .top-navbar .btn-lang-switch,
    .top-navbar .btn-logout {
        min-height: 40px;
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }

    .top-navbar-title {
        font-size: 0.95rem;
    }
}

/* Barre de validation collante tactile (Sticky Bottom Bar) */
.sticky-bottom-bar,
.card-footer.sticky-bottom-bar {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 1020 !important;
    background: #ffffff !important;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08) !important;
    border-top: 1px solid var(--border-color) !important;
}

/* Switch d'appel tactile agrandi */
.switch-presence,
.form-check-input.switch-presence {
    width: 3.2em !important;
    height: 1.6em !important;
    cursor: pointer !important;
}

/* Emploi du Temps : Cartes Mobile */
.edt-mobile-day-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
    overflow: hidden;
}

.edt-mobile-day-header {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.edt-mobile-slot-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.edt-mobile-slot-item:last-child {
    border-bottom: none;
}

/* ====================================================================
   MODULES AVANCÉS (IMPORT EXCEL, APPEL & GRILLE NOTES)
   ==================================================================== */

/* Zone de glisser-déposer Excel */
.dropzone-excel {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    background-color: #f8fafc;
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.dropzone-excel:hover, .dropzone-excel.dragover {
    border-color: #10b981;
    background-color: #ecfdf5;
}

.dropzone-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background-color: #d1fae5;
    color: #059669;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.25rem auto;
    transition: var(--transition);
}

.dropzone-excel:hover .dropzone-icon {
    transform: scale(1.08);
}

/* Grand Toggle Switch pour l'Appel */
.form-switch.form-switch-lg {
    padding-left: 3rem;
}

.form-switch.form-switch-lg .form-check-input {
    width: 2.75rem;
    height: 1.5rem;
    margin-left: -3rem;
    cursor: pointer;
}

.row-presence-absent {
    background-color: #fef2f2 !important;
}

.row-presence-present {
    background-color: #ffffff;
}

/* Grille de Saisie des Notes (Tableur) */
.note-grid-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.note-input {
    max-width: 110px;
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.note-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.note-pass {
    color: #059669 !important;
}

.note-fail {
    color: #dc2626 !important;
}

.stats-bar-notes {
    background: linear-gradient(135deg, #f8fafc, #edf2f7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
}

/* ====================================================================
   SUPPORT INTERNATIONALISATION (i18n) BILINGUE & DIRECTION RTL
   ==================================================================== */

html[dir="rtl"] body {
    font-family: 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-align: right;
}

html[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.12);
}

html[dir="rtl"] .main-wrapper {
    margin-left: 0;
    margin-right: var(--sidebar-width, 260px);
    width: calc(100% - var(--sidebar-width, 260px));
    max-width: calc(100% - var(--sidebar-width, 260px));
    flex: 0 0 calc(100% - var(--sidebar-width, 260px));
    box-sizing: border-box;
}

/* Polices spécifiques arabes */
.font-arabic, html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3, 
html[dir="rtl"] h4, html[dir="rtl"] h5, html[dir="rtl"] h6, 
html[dir="rtl"] .sidebar-brand h5, html[dir="rtl"] .sidebar-link,
html[dir="rtl"] .btn, html[dir="rtl"] .table, html[dir="rtl"] .form-label,
html[dir="rtl"] .dropdown-item, html[dir="rtl"] .badge {
    font-family: 'Cairo', sans-serif;
}

/* Bouton Sélecteur de Langue */
.btn-lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    border-radius: var(--radius-md, 12px);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-primary);
    cursor: pointer;
}

.btn-lang-switch:hover {
    background-color: var(--primary-light, #eff6ff);
    color: var(--primary-color, #2563eb);
    border-color: var(--primary-color, #2563eb);
}

.btn-lang-switch .flag-icon {
    font-size: 1.15rem;
    line-height: 1;
}

/* Ajustements RTL pour tables, badges et bordures */
html[dir="rtl"] .sidebar-header {
    flex-direction: row-reverse;
}

html[dir="rtl"] .sidebar-link {
    flex-direction: row;
}

html[dir="rtl"] .top-navbar {
    flex-direction: row;
}

html[dir="rtl"] .text-start {
    text-align: right !important;
}

html[dir="rtl"] .text-end {
    text-align: left !important;
}

html[dir="rtl"] .border-start-0 {
    border-right: 0 !important;
    border-left: 1px solid var(--border-color) !important;
}

html[dir="rtl"] .border-end-0 {
    border-left: 0 !important;
    border-right: 1px solid var(--border-color) !important;
}

html[dir="rtl"] .table th, html[dir="rtl"] .table td {
    text-align: right;
}

html[dir="rtl"] .table th.text-center, html[dir="rtl"] .table td.text-center {
    text-align: center;
}

html[dir="rtl"] .table th.text-end, html[dir="rtl"] .table td.text-end {
    text-align: left;
}


