/* Style principal pour la plateforme منبر - Thème Éducation Clair */

:root {
    /* Couleurs principales - Tons éducatifs et clairs */
    --primary-color: #4A90E2;        /* Bleu ciel éducatif */
    --secondary-color: #5BA3F5;      /* Bleu clair secondaire */
    --success-color: #52C41A;        /* Vert apprentissage */
    --danger-color: #FF6B6B;         /* Rouge doux */
    --warning-color: #FFA940;        /* Orange chaleureux */
    --info-color: #69C0FF;           /* Bleu info clair */
    
    /* Couleurs de fond */
    --bg-primary: #FFFFFF;           /* Blanc pur */
    --bg-secondary: #F7F9FC;         /* Bleu très clair */
    --bg-light: #F0F5FF;             /* Bleu pastel */
    --bg-gradient-start: #E3F2FD;    /* Gradient bleu clair */
    --bg-gradient-end: #F3E5F5;      /* Gradient violet clair */
    
    /* Couleurs de texte */
    --text-primary: #2C3E50;         /* Gris foncé doux */
    --text-secondary: #7F8C8D;       /* Gris moyen */
    --text-light: #95A5A6;           /* Gris clair */
    
    /* Bordures et ombres */
    --border-color: #E8EAF6;         /* Bordure bleu très clair */
    --border-light: #F5F7FA;         /* Bordure ultra claire */
    --shadow-sm: 0 2px 8px rgba(74, 144, 226, 0.08);
    --shadow-md: 0 4px 16px rgba(74, 144, 226, 0.12);
    --shadow-lg: 0 8px 24px rgba(74, 144, 226, 0.15);
    
    /* Couleurs éducatives supplémentaires */
    --edu-yellow: #FFD93D;           /* Jaune apprentissage */
    --edu-green: #6BCF7F;            /* Vert croissance */
    --edu-purple: #A78BFA;           /* Violet créativité */
    --edu-pink: #FDA7DF;             /* Rose inspiration */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
    background: #FFFFFF;
    min-height: 100vh;
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
    width: 100%;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* Empêcher débordement horizontal sur mobile */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    
    * {
        max-width: 100%;
    }
    
    .page-content,
    .card,
    .card-body,
    .modal,
    .form-control,
    input,
    textarea,
    select {
        max-width: 100%;
    }
}

/* Page de Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-width: 450px;
    width: 100%;
    animation: slideUp 0.5s ease-out;
    border: 1px solid var(--border-light);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
    background: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.login-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.login-body {
    padding: 40px 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Cairo', sans-serif;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.12), 0 4px 12px rgba(74, 144, 226, 0.1);
    transform: translateY(-1px);
}

.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 18px;
}

.input-group .form-control {
    padding-left: 45px;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::after {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Dashboard Layout */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    background: #FFFFFF;
    position: relative;
    z-index: 1;
}

/* Sidebar Amélioré - Design Moderne et Responsive */
.sidebar {
    width: 280px;
    background: white;
    box-shadow: var(--shadow-2xl);
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid var(--border-light);
    scroll-behavior: smooth;
    scroll-padding-top: 20px;
    color: var(--text-primary);
}

/* Sidebar fermé sur desktop */
@media (min-width: 769px) {
    .sidebar.closed {
        transform: translateX(100%);
    }
    
    .sidebar.closed + .main-content-wrapper .main-content {
        margin-right: 0;
    }
}

/* Scrollbar personnalisé pour le sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.sidebar-header {
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    text-align: center;
    position: relative;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 35px;
    margin-bottom: 15px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.3);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.sidebar-logo:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.sidebar-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.02em;
}

.sidebar-menu {
    padding: 25px 0;
}

.menu-section {
    margin-bottom: 30px;
}

.menu-section-title {
    padding: 0 20px;
    font-size: 14px;
    font-weight: 800;
    color: var(--primary-color);
    text-transform: uppercase;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-section-title::before {
    content: '';
    width: 3px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 2px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    margin: 4px 10px;
    color: #000000;
    text-decoration: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    font-size: 15px;
    font-weight: 500;
}

.menu-item::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
    background: var(--bg-gradient);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-item::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s;
    border-radius: 4px 0 0 4px;
}

.menu-item::before {
    content: '';
    position: absolute;
    right: -100%;
    top: 0;
    bottom: 0;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(74, 144, 226, 0.1), transparent);
    transition: right 0.5s ease;
}

.menu-item:hover::before {
    right: 100%;
}

.menu-item:hover {
    background: rgba(74, 144, 226, 0.08);
    color: var(--primary-color);
    transform: translateX(-5px);
    padding-right: 24px;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
}

.menu-item:hover::before {
    transform: scaleY(1);
}

.menu-item:hover::after {
    transform: scaleY(1);
}

.menu-item.active {
    background: rgba(74, 144, 226, 0.12);
    color: var(--primary-color);
    font-weight: 700;
    border-right: 3px solid var(--primary-color);
    box-shadow: inset 0 0 20px rgba(74, 144, 226, 0.08), 0 4px 12px rgba(74, 144, 226, 0.15);
    position: relative;
    animation: menuItemActivate 0.3s ease-out;
}

@keyframes menuItemActivate {
    0% {
        background: transparent;
        transform: translateX(5px);
    }
    100% {
        background: rgba(74, 144, 226, 0.12);
        transform: translateX(0);
    }
}

.menu-item.active::before {
    transform: scaleY(1);
}

.menu-icon {
    width: 24px;
    height: 24px;
    margin-left: 12px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.menu-item:hover .menu-icon {
    transform: scale(1.1);
}

.menu-item.active .menu-icon {
    animation: iconPulse 0.5s ease-out;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Badge pour notifications dans le menu */
.menu-badge {
    margin-right: auto;
    background: var(--danger-color);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-right: 280px;
    flex: 1;
    padding: 0;
    position: relative;
    z-index: 1;
    /* Empêcher la création d'un nouveau contexte d'empilement qui pourrait affecter les modals */
    isolation: isolate;
    transition: margin-right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main content ajusté quand sidebar fermé sur desktop - sera géré par JavaScript */

/* Top Navbar */
.top-navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px 30px;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 999;
    border-bottom: 1px solid rgba(74, 144, 226, 0.1);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    /* Ne pas créer de nouveau contexte d'empilement */
    isolation: auto;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 8px 40px 8px 15px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    width: 300px;
    font-family: 'Cairo', sans-serif;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.notification-icon,
.user-menu {
    position: relative;
    cursor: pointer;
}

.notification-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-avatar:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

/* Page Content */
.page-content {
    padding: 30px;
    padding-bottom: 100px;
    min-height: calc(100vh - 140px);
    position: relative;
    z-index: 1;
}

.page-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.page-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(74, 144, 226, 0.1);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--bg-gradient);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover::before {
    transform: scaleX(1);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 25px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

/* Stats grid sur desktop seulement */
@media (min-width: 769px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 15px;
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (min-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 25px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 4px solid transparent;
    border: 1px solid rgba(74, 144, 226, 0.15);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
}

.stat-card.primary {
    border-right-color: var(--primary-color);
}

.stat-card.success {
    border-right-color: var(--success-color);
}

.stat-card.warning {
    border-right-color: var(--warning-color);
}

.stat-card.info {
    border-right-color: var(--info-color);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-card.primary .stat-icon {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(91, 163, 245, 0.1) 100%);
    color: var(--primary-color);
}

.stat-card.success .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.stat-card.warning .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-card.info .stat-icon {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.stat-info h3 {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: var(--text-primary);
}

.stat-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    width: 100%;
    max-width: 100%;
}

/* Ensure all tables are scrollable on mobile */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
        width: 100%;
        max-width: 100%;
        display: block;
    }
    
    /* Force table to maintain its width for horizontal scrolling */
    .table-responsive table {
        width: auto;
        min-width: 100%;
        display: table;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    background: var(--bg-light);
    padding: 15px;
    text-align: right;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

table tr:hover {
    background: var(--bg-light);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.badge-secondary {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-secondary);
}

/* Buttons */
.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    padding: 8px 12px;
    font-size: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

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

/* Responsive Design Amélioré */

/* Tablette (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar {
        width: 260px;
    }
    
    .main-content {
        margin-right: 260px;
        transition: margin-right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .sidebar.closed + * .main-content,
    .sidebar.closed ~ .main-content-wrapper .main-content {
        margin-right: 0;
    }
    
    .menu-item {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .sidebar-header {
        padding: 25px 15px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile et petites tablettes (max 768px) */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        transform: translateX(100%);
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.2);
    }
    
    .sidebar.active {
        transform: translateX(0);
        animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    @keyframes slideInRight {
        from {
            transform: translateX(100%);
            opacity: 0.8;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }
    
    
    .main-content {
        margin-right: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .stat-info h3 {
        font-size: 26px;
    }
    
    .stat-info p {
        font-size: 13px;
    }
    
    /* Subscription card responsive */
    .subscription-card-body .subscription-info-wrapper {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .subscription-card-body .subscription-info-wrapper > div:first-child {
        width: 100%;
    }
    
    .subscription-card-body .subscription-info-wrapper > div:last-child {
        width: 100%;
        justify-content: flex-start;
    }
    
    .subscription-card-body .subscription-info-wrapper .btn {
        flex: 1;
        min-width: auto;
    }
    
    /* Responsive grids */
    .responsive-grid-2 {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    
    .info-grid-2 {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    /* Card headers responsive */
    .card-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
    }
    
    .card-header > .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Unpaid students card header - responsive layout */
    .card-header > div[style*="margin-right: auto"] {
        width: 100%;
        margin-right: 0 !important;
    }
    
    .card-header > div[style*="margin-right: auto"] form {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .card-header select {
        width: 100% !important;
    }
    
    /* Dashboard ads container - responsive without scrolling */
    .dashboard-ads-container {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .dashboard-ads-container > div {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .dashboard-ads-container img {
        max-width: 100%;
        height: auto;
    }
    
    /* Modal quick payment responsive */
    .modal-body > div[style*="display: flex"] {
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-body > div[style*="display: flex"] > button {
        width: 100%;
    }
    
    .search-box input {
        width: 150px;
        font-size: 14px;
    }
    
    /* Bouton toggle sidebar visible sur mobile */
    #sidebarToggle {
        display: inline-flex !important;
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
        color: white;
        border: none;
        padding: 10px 15px;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.3s;
        box-shadow: var(--shadow-sm);
    }
    
    #sidebarToggle:hover {
        transform: scale(1.05);
        box-shadow: var(--shadow-md);
    }
    
    #sidebarToggle:active {
        transform: scale(0.95);
    }
    
    /* Menu items plus espacés sur mobile */
    .menu-item {
        padding: 16px 20px;
        font-size: 16px;
    }
    
    .menu-icon {
        font-size: 22px;
        width: 26px;
        height: 26px;
    }
    
    .sidebar-header {
        padding: 25px 20px;
    }
    
    /* Page Header sur mobile */
    .page-header {
        margin-bottom: 20px;
    }
    
    .page-title {
        font-size: 22px;
    }
    
    .page-subtitle {
        font-size: 13px;
    }
    
    /* Cards sur mobile */
    .card {
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 15px 20px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .card-title {
        font-size: 16px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    /* Tables responsives */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
        width: 100%;
        max-width: 100%;
        display: block;
        margin: 0;
    }
    
    /* Ensure tables maintain minimum width for scrolling */
    .table-responsive table {
        width: auto;
        min-width: 600px;
        font-size: 14px;
        display: table;
        margin: 0;
    }
    
    table th,
    table td {
        padding: 12px 10px;
        white-space: nowrap;
    }
    
    /* Modals sur mobile */
    .modal-overlay {
        z-index: 999999 !important;
        padding: 10px;
    }
    
    .modal {
        width: 95%;
        max-width: 95% !important;
        max-height: 90vh;
        margin: auto;
        overflow-y: auto;
        z-index: 1000000 !important;
        position: relative !important;
        left: auto !important;
        top: auto !important;
    }
    
    .modal-header {
        padding: 15px 20px;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 20px;
        overflow-y: auto;
        max-height: calc(90vh - 140px);
    }
    
    .modal-footer {
        padding: 12px 20px;
        flex-wrap: wrap;
        gap: 10px;
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 1px solid #e0e0e0;
    }
    
    /* Form grids dans les modals sur mobile */
    .modal .form-grid-2 {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .modal .form-group[style*="grid-column: span 2"] {
        grid-column: span 1 !important;
    }
    
    /* Select multiple dans les modals */
    .modal select[multiple] {
        height: 120px !important;
    }
    
    /* Photo preview dans les modals */
    .modal #addPhotoPreview,
    .modal #editPhotoPreview {
        margin-top: 10px;
    }
    
    .modal #addPhotoPreview img,
    .modal #editPhotoPreview img,
    .modal #editCurrentPhotoImg {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Inputs dans les modals */
    .modal input[type="text"],
    .modal input[type="email"],
    .modal input[type="tel"],
    .modal input[type="date"],
    .modal textarea,
    .modal select {
        width: 100% !important;
        box-sizing: border-box;
        font-size: 16px !important; /* Empêche le zoom sur iOS */
    }
    
    /* Select multiple dans les modals */
    .modal select[multiple] {
        font-size: 16px !important;
    }
    
    /* Buttons dans le footer du modal */
    .modal-footer .btn {
        flex: 1;
        min-width: 120px;
        width: auto;
    }
    
    /* Forms sur mobile */
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-label {
        font-size: 13px;
    }
    
    .form-control {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    /* Buttons sur mobile */
    .btn {
        font-size: 14px;
        padding: 10px 20px;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Grid layouts sur mobile */
    div[style*="grid-template-columns"] {
        display: block !important;
    }
    
    div[style*="display: grid"] > * {
        margin-bottom: 15px;
    }
    
    /* Navbar sur mobile */
    .navbar-left {
        gap: 10px;
    }
    
    .user-avatar {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .navbar-left > div[style*="text-align"] {
        display: none;
    }
    
    /* Alerts sur mobile */
    .alert {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    /* Badges sur mobile */
    .badge {
        font-size: 11px;
        padding: 4px 10px;
    }
}

/* Très petits écrans (max 480px) */
@media (max-width: 480px) {
    .sidebar {
        width: 85vw;
        max-width: 300px;
    }
    
    .search-box {
        display: none;
    }
    
    .navbar-right {
        gap: 8px;
    }
    
    .page-content {
        padding: 15px 12px;
        padding-bottom: 80px;
    }
    
    .top-navbar {
        padding: 10px 12px;
    }
    
    /* Page titles */
    .page-title {
        font-size: 20px;
    }
    
    .page-subtitle {
        font-size: 12px;
    }
    
    /* Stats cards */
    .stat-card {
        padding: 15px;
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .stat-icon {
        width: 55px;
        height: 55px;
        font-size: 26px;
        margin: 0 auto;
    }
    
    .stat-info {
        text-align: center;
    }
    
    .stat-info h3 {
        font-size: 24px;
    }
    
    /* Cards */
    .card-header {
        padding: 12px 15px;
    }
    
    .card-title {
        font-size: 15px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* Tables - encore plus compactes */
    .table-responsive table {
        min-width: 500px;
        font-size: 13px;
        width: auto;
    }
    
    .table-responsive table th,
    .table-responsive table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    /* Forms */
    .form-control {
        padding: 9px 10px;
        font-size: 13px;
    }
    
    /* Buttons */
    .btn {
        font-size: 13px;
        padding: 9px 16px;
    }
    
    .btn-sm {
        padding: 5px 10px;
        font-size: 11px;
    }
    
    .btn-icon {
        padding: 7px 10px;
        font-size: 14px;
    }
    
    /* Modals */
    .modal-overlay {
        z-index: 999999 !important;
        padding: 5px;
    }
    
    .modal {
        width: 98%;
        max-width: 98%;
        max-height: 95vh;
        margin: auto;
        overflow-y: auto;
        z-index: 1000000 !important;
    }
    
    .modal-header {
        padding: 12px 15px;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    .modal-body {
        padding: 15px;
        overflow-y: auto;
        max-height: calc(95vh - 120px);
    }
    
    .modal-footer {
        padding: 10px 15px;
        flex-wrap: wrap;
        gap: 8px;
        position: sticky;
        bottom: 0;
        background: white;
        border-top: 1px solid #e0e0e0;
    }
    
    /* Form grids dans les modals sur très petit écran */
    .modal .form-grid-2 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    .modal .form-group[style*="grid-column: span 2"] {
        grid-column: span 1 !important;
    }
    
    /* Select multiple dans les modals */
    .modal select[multiple] {
        height: 100px !important;
    }
    
    /* Photo preview dans les modals */
    .modal #addPhotoPreview img,
    .modal #editPhotoPreview img,
    .modal #editCurrentPhotoImg {
        max-width: 150px !important;
        max-height: 150px !important;
    }
    
    /* Inputs dans les modals sur très petit écran */
    .modal input[type="text"],
    .modal input[type="email"],
    .modal input[type="tel"],
    .modal input[type="date"],
    .modal textarea,
    .modal select {
        width: 100% !important;
        box-sizing: border-box;
        font-size: 16px !important;
    }
    
    /* Buttons dans le footer du modal sur très petit écran */
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .modal-footer .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Login page sur mobile */
    .login-container {
        padding: 15px;
    }
    
    .login-card {
        max-width: 100%;
    }
    
    .login-header {
        padding: 30px 20px;
    }
    
    .login-logo {
        width: 70px;
        height: 70px;
        font-size: 35px;
    }
    
    .login-title {
        font-size: 24px;
    }
    
    .login-subtitle {
        font-size: 13px;
    }
    
    .login-body {
        padding: 30px 20px;
    }
    
    /* Footer copyright sur mobile */
    .dashboard-footer {
        margin-top: 20px;
        padding: 12px 15px;
    }
    
    .footer-content p {
        font-size: 11px;
    }
    
    /* Notification icon */
    .notification-icon i {
        font-size: 18px !important;
    }
    
    .notification-badge {
        font-size: 9px;
        padding: 1px 4px;
        min-width: 16px;
    }
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border-right: 4px solid var(--success-color);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-right: 4px solid var(--danger-color);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    border-right: 4px solid var(--warning-color);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
    border-right: 4px solid var(--info-color);
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 1;
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 999999 !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    margin: 0 !important;
}

.modal-overlay.active {
    display: flex !important;
}

.modal {
    background: white !important;
    border-radius: 15px !important;
    max-width: 600px !important;
    width: 90% !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    animation: modalSlideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 24px 48px -12px rgba(74, 144, 226, 0.25) !important;
    border: 1px solid var(--border-light) !important;
    position: relative !important;
    z-index: 1000000 !important;
    margin: auto !important;
}

@keyframes modalSlideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Dashboard Footer */
.dashboard-footer {
    margin-top: 40px;
    padding: 20px 30px;
    background: white;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 8px rgba(74, 144, 226, 0.06);
}

.footer-content {
    text-align: center;
}

.footer-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.footer-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    padding: 2px 5px;
    border-radius: 3px;
}

.footer-link:hover {
    color: var(--secondary-color);
    background: rgba(37, 99, 235, 0.1);
}

@media (max-width: 768px) {
    .dashboard-footer {
        margin-top: 30px;
        padding: 15px 20px;
    }
    
    .footer-content p {
        font-size: 12px;
    }
}

/* Utility Classes for Responsive Grids */
.responsive-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.responsive-grid-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.responsive-grid-classes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.responsive-grid-reports {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* Desktop: utiliser minmax seulement sur grands écrans */
@media (min-width: 769px) {
    .responsive-grid-2 {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
    
    .responsive-grid-cards {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .responsive-grid-classes {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        /* Cartes plus petites = plus de colonnes sur desktop */
    }
    
    .responsive-grid-reports {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Desktop large: encore plus de colonnes pour classes */
@media (min-width: 1400px) {
    .responsive-grid-classes {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        /* Sur très grand écran: 5-6 colonnes */
    }
}

/* Desktop - Affichage global plus compact et petit */
@media (min-width: 769px) {
    /* Typographie réduite globalement */
    body {
        font-size: 14px;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .page-subtitle {
        font-size: 13px;
    }
    
    .card-title {
        font-size: 16px;
    }
    
    /* Cartes plus compactes */
    .card {
        border-radius: 12px;
    }
    
    .card-header {
        padding: 15px 20px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    /* Stats cards plus petites */
    .stat-card {
        padding: 20px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .stat-info h3 {
        font-size: 28px;
    }
    
    .stat-info p {
        font-size: 13px;
    }
    
    /* Page content plus compact */
    .page-content {
        padding: 25px;
    }
    
    /* Tables plus compactes */
    table th,
    table td {
        padding: 12px;
        font-size: 14px;
    }
    
    /* Buttons plus petits */
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    /* Badges plus petits */
    .badge {
        font-size: 11px;
        padding: 4px 10px;
    }
    
    /* Forms plus compacts */
    .form-control {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .form-label {
        font-size: 13px;
    }
    
    /* Modals plus compacts */
    .modal-title {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    /* Top navbar plus compact */
    .top-navbar {
        padding: 12px 25px;
    }
    
    /* Sidebar plus compact */
    .sidebar-header {
        padding: 25px 20px;
    }
    
    .sidebar-title {
        font-size: 20px;
    }
    
    .menu-item {
        padding: 12px 18px;
        font-size: 14px;
    }
    
    .menu-icon {
        width: 22px;
        height: 22px;
        font-size: 18px;
    }
    
    /* Classes page - cartes compactes */
    .responsive-grid-classes .card {
        font-size: 13px;
    }
    
    .responsive-grid-classes .card-header {
        padding: 12px 18px;
    }
    
    .responsive-grid-classes .card-title {
        font-size: 15px;
    }
    
    .responsive-grid-classes .card-body {
        padding: 15px 18px;
    }
    
    .responsive-grid-classes .card-body > div {
        margin-bottom: 8px;
    }
    
    .responsive-grid-classes .badge {
        font-size: 10px;
        padding: 3px 8px;
    }
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.info-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 768px) {
    .responsive-grid-2,
    .responsive-grid-cards,
    .responsive-grid-classes,
    .responsive-grid-reports {
        grid-template-columns: 1fr !important;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .form-grid-2 {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-grid-3 {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .info-grid-2 {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    /* Classes page - boutons dans les cartes */
    .responsive-grid-classes .card-body > div[style*="display: flex"] {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .responsive-grid-classes .btn-sm .btn-text {
        display: none;
    }
    
    .responsive-grid-classes .btn-sm {
        padding: 6px 10px;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .form-grid-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .responsive-grid-classes .card-body > div[style*="display: flex"] {
        flex-direction: column;
        align-items: stretch;
    }
    
    .responsive-grid-classes .btn-sm {
        width: 100%;
        justify-content: center;
    }
    
    /* Subscription card on very small screens */
    .subscription-card-body .subscription-info-wrapper > div:first-child {
        gap: 12px;
    }
    
    .subscription-card-body .subscription-info-wrapper > div:first-child > div:first-child {
        min-width: 70px;
    }
    
    .subscription-card-body .subscription-info-wrapper > div:first-child > div:first-child > div:first-child {
        font-size: 24px;
    }
    
    .subscription-card-body .subscription-info-wrapper > div:first-child > div:last-child {
        min-width: auto;
    }
    
    .subscription-card-body .subscription-info-wrapper > div:first-child > div:last-child > div:first-child {
        font-size: 14px;
    }
    
    .subscription-card-body .subscription-info-wrapper > div:first-child > div:last-child > div:last-child {
        font-size: 11px;
        gap: 8px;
    }
    
    .subscription-card-body .subscription-info-wrapper > div:first-child > div:last-child > div:last-child > span {
        display: block;
        margin-bottom: 5px;
    }
    
    .subscription-card-body .subscription-info-wrapper > div:last-child {
        flex-direction: column;
        width: 100%;
    }
    
    .subscription-card-body .subscription-info-wrapper > div:last-child > .btn {
        width: 100%;
    }
    
    /* Card headers on very small screens */
    .card-header .card-title {
        font-size: 14px;
        flex-wrap: wrap;
    }
    
    .card-header .badge {
        font-size: 12px;
        padding: 4px 10px;
    }
}

@media (max-width: 480px) {
    .responsive-grid-2,
    .responsive-grid-cards,
    .responsive-grid-classes,
    .responsive-grid-reports {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
}

/* Login footer responsive */
.login-footer-fixed {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    margin-top: auto;
}

@media (max-width: 768px) {
    .login-footer-fixed {
        padding: 12px 10px;
    }
    
    .login-footer-fixed p {
        font-size: 11px !important;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .login-footer-fixed {
        padding: 10px 8px;
    }
    
    .login-footer-fixed p {
        font-size: 10px !important;
    }
}

/* Touch-friendly elements for mobile */
@media (max-width: 768px) {
    /* Augmenter la taille des zones de touch */
    a, button, .btn, input[type="checkbox"], input[type="radio"], select {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Exception pour les petits boutons */
    .btn-sm, .btn-icon {
        min-height: 36px;
    }
    
    /* Tables touch-friendly */
    table tr {
        cursor: pointer;
    }
}

/* Prevent zoom on input focus (iOS) */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Dashboard specific mobile styles */
@media (max-width: 768px) {
    /* Quick payment modal sur mobile */
    .modal-body div[style*="display: grid"] {
        display: grid !important;
        grid-template-columns: 1fr !important;
    }
    
    /* Progress bars sur mobile */
    div[style*="progress"] {
        width: 100% !important;
    }
    
    /* Action buttons group sur mobile */
    .card-body a.btn + button.btn,
    .card-body button.btn + button.btn {
        margin-right: 5px;
    }
}

@media (max-width: 480px) {
    /* Reduce padding for better space usage */
    .card-header h3 {
        font-size: 14px;
    }
    
    /* Stack action buttons vertically on very small screens */
    td > .btn {
        display: block;
        width: 100%;
        margin-bottom: 5px;
    }
    
    td > .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Compact user info display */
    table td strong {
        font-size: 13px;
    }
    
    table td small {
        font-size: 11px;
    }
}

/* Horizontal scrolling hint for tables */
@media (max-width: 768px) {
    .table-responsive {
        position: relative;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Visual hint for scrollable content */
    .table-responsive::after {
        content: '→';
        position: absolute;
        right: 5px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--primary-color);
        font-size: 20px;
        opacity: 0.3;
        pointer-events: none;
        z-index: 1;
    }
    
    /* Hide scroll hint when scrolled */
    .table-responsive.scrolled::after {
        display: none;
    }
}

/* Improve button groups on mobile */
@media (max-width: 768px) {
    .modal-footer .btn,
    .card-header .btn {
        flex: 1;
        min-width: 100px;
    }
}

/* Better spacing for currency displays */
@media (max-width: 480px) {
    [style*="font-size: 28px"],
    [style*="font-size: 20px"] {
        font-size: 20px !important;
    }
    
    [style*="font-size: 24px"] {
        font-size: 18px !important;
    }
}

/* Page-specific responsive styles */

/* Empêcher débordement sur toutes les pages */
@media (max-width: 768px) {
    /* Forcer largeur 100% pour tous les conteneurs */
    .page-content,
    .card,
    .search-filters,
    form {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    /* Table responsive must allow horizontal scroll */
    .table-responsive {
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }
    
    /* Ensure card-body doesn't prevent table scrolling */
    .card-body {
        overflow-x: visible;
    }
    
    /* Empêcher débordement des grids inline */
    [style*="display: grid"],
    [style*="display:grid"] {
        grid-template-columns: 1fr !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    
    /* Empêcher débordement des flex */
    [style*="display: flex"],
    [style*="display:flex"] {
        flex-wrap: wrap;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    
    /* Modals - empêcher débordement */
    .modal {
        width: 95% !important;
        max-width: 95% !important;
        margin: 20px auto;
        box-sizing: border-box;
        position: relative !important;
        left: auto !important;
        top: auto !important;
    }
    
    .modal-body {
        overflow-x: hidden;
        overflow-y: auto;
        max-height: calc(85vh - 120px);
    }
    
    /* Page header - empêcher débordement */
    .page-header {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .page-header > div[style*="flex"] {
        width: 100%;
        flex-wrap: wrap;
    }
    
    /* Masquer le texte des boutons sur très petits écrans */
    .btn .btn-text {
        display: inline;
    }
}

@media (max-width: 480px) {
    .btn .btn-text {
        display: none;
    }
    
    .btn {
        padding: 8px 12px;
        min-width: auto;
    }
}

/* Students page */
@media (max-width: 768px) {
    /* Filter form on mobile */
    .search-filters .form-group {
        margin-bottom: 15px !important;
    }
    
    .search-filters .form-group:last-child {
        margin-bottom: 0 !important;
    }
    
    /* Student cards in modal */
    .student-info-section {
        margin-bottom: 20px;
    }
    
    /* Multi-select on mobile */
    select[multiple] {
        min-height: 120px;
        width: 100%;
    }
}

/* Subjects page */
@media (max-width: 768px) {
    /* Subject list more compact */
    .card-body table td {
        padding: 10px 8px;
    }
}

/* Users page */
@media (max-width: 768px) {
    /* User roles badges more visible */
    .badge {
        white-space: nowrap;
    }
    
    /* User actions stacked */
    .user-actions {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
}

/* Reports page */
@media (max-width: 768px) {
    /* Report cards better spacing */
    .card[style*="border-right"] {
        border-right-width: 3px !important;
    }
    
    /* Date pickers side by side become stacked */
    input[type="date"] {
        width: 100%;
    }
}

/* Formations page */
@media (max-width: 768px) {
    /* Formation cards */
    .formation-card {
        padding: 15px;
    }
    
    /* Formation details */
    .formation-details {
        font-size: 13px;
    }
}

/* Payments page - Desktop width fix */
@media (min-width: 769px) {
    /* Réduire les min-width des colonnes pour éviter débordement */
    .card-body table th[style*="min-width: 150px"] {
        min-width: 120px !important;
    }
    
    .card-body table th[style*="min-width: 120px"] {
        min-width: 100px !important;
    }
    
    .card-body table th[style*="min-width: 100px"] {
        min-width: 80px !important;
    }
    
    /* Table responsive sans débordement */
    .table-responsive {
        overflow-x: auto;
        max-width: 100%;
    }
    
    .table-responsive table {
        width: 100%;
        table-layout: auto;
    }
}

@media (min-width: 769px) and (max-width: 1400px) {
    /* Sur écrans moyens, tableau encore plus compact */
    .card-body table th,
    .card-body table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .card-body table th[style*="min-width"] {
        min-width: 80px !important;
    }
    
    /* Boutons dans page-header plus compacts sur écrans moyens */
    .page-header > div[style*="flex"] button,
    .page-header > div[style*="flex"] .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* Payments page - Header buttons responsive sur tous desktop */
@media (min-width: 769px) {
    /* Page-header avec 3 boutons */
    .page-header > div[style*="flex"] {
        gap: 8px;
    }
    
    .page-header > div[style*="flex"] button {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Payments stats cards - Plus compactes */
    .stats-grid .stat-card {
        min-width: 200px;
    }
    
    /* Formulaire de filtres - Responsive */
    .search-filters form {
        max-width: 100%;
    }
    
    .search-filters .form-group {
        min-width: 150px;
    }
}

/* Print styles - hide on mobile */
@media print {
    .no-print,
    .sidebar,
    .top-navbar,
    .btn,
    button,
    .search-filters {
        display: none !important;
    }
    
    .main-content {
        margin-right: 0 !important;
    }
    
    .page-content {
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* Additional touch improvements for all pages */
@media (max-width: 768px) {
    /* Sticky headers for long tables */
    .table-responsive table thead {
        position: sticky;
        top: 0;
        background: var(--bg-light);
        z-index: 10;
    }
    
    /* Better spacing for form sections */
    .modal-body .form-group:last-child {
        margin-bottom: 0;
    }
    
    /* Improve select dropdowns */
    select.form-control {
        background-position: left 10px center;
        padding-left: 35px;
    }
    
    /* Better checkbox and radio visibility */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
    }
    
    /* Labels with required asterisk */
    .form-label span[style*="color: red"] {
        font-size: 16px;
    }
    
    /* Page header actions */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .page-header > button,
    .page-header > a {
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* Even more compact on very small screens */
    .card-body {
        padding: 12px;
    }
    
    /* Smaller badges */
    .badge {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    /* Compact table headers */
    table thead th {
        font-size: 12px;
        padding: 10px 8px;
    }
    
    /* Action buttons in table more touch-friendly */
    table td .btn + .btn {
        margin-right: 3px;
        margin-top: 3px;
    }
}

/* Settings page specific */
@media (max-width: 768px) {
    /* System info grid more compact */
    .card-body .info-grid-2 > div {
        padding: 10px;
        background: var(--bg-light);
        border-radius: 8px;
    }
    
    /* Database stats compact */
    .card-body [style*="padding: 15px"] {
        padding: 12px !important;
        font-size: 13px;
    }
}

/* All pages - Final mobile touches */
@media (max-width: 768px) {
    /* Ensure all buttons in page-header are full width on mobile */
    .page-header button,
    .page-header .btn {
        width: 100%;
    }
    
    /* Multiple buttons in header - flex wrap */
    .page-header > div[style*="display: flex"],
    .page-header > div[style*="flex"] {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .page-header > div[style*="display: flex"] > button,
    .page-header > div[style*="display: flex"] > .btn,
    .page-header > div[style*="flex"] > button,
    .page-header > div[style*="flex"] > .btn {
        flex: 1;
        min-width: 120px;
    }
    
    /* Card headers with multiple buttons */
    .card-header[style*="flex"],
    .card-header[style*="display: flex"] {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    /* Single button per line on very small screens */
    .page-header > div[style*="display: flex"] > button,
    .page-header > div[style*="display: flex"] > .btn,
    .page-header > div[style*="flex"] > button,
    .page-header > div[style*="flex"] > .btn {
        width: 100%;
        min-width: auto;
    }
    
    /* Reduce icon sizes in cards for space */
    .card-body [style*="font-size: 24px"] {
        font-size: 20px !important;
    }
}

/* Styles pour les bannières publicitaires */
/* Desktop - Taille réelle */
@media (min-width: 769px) {
    /* Bannières sur la page de login */
    .login-ads-container img {
        width: auto !important;
        height: auto !important;
        max-width: none !important;
    }
    
    /* Bannières sur le dashboard */
    .dashboard-ads-container img {
        width: auto !important;
        height: auto !important;
        max-width: none !important;
    }
}

/* Mobile - Responsive */
@media (max-width: 768px) {
    .login-ads-container,
    .dashboard-ads-container {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden !important;
    }
    
    .login-ads-container > div,
    .dashboard-ads-container > div {
        width: 100%;
        flex-wrap: wrap;
        display: flex;
        justify-content: center;
        gap: 15px;
    }
    
    .login-ads-container img,
    .dashboard-ads-container img {
        max-width: 100% !important;
        height: auto !important;
        width: auto;
    }
    
    .login-ads-container > div > div,
    .dashboard-ads-container > div > div {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
    }
}

