/* KitLEARN — feuille de style */
:root {
  --app-primary: #1d4ed8;
  --app-primary-dark: #1e3a8a;
  --app-bg: #f4f6fb;
  --bs-primary: #1d4ed8;
  --bs-primary-rgb: 29, 78, 216;
  --bs-link-color: #1d4ed8;
  --bs-link-color-rgb: 29, 78, 216;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body { background: var(--app-bg); }
.btn-primary { --bs-btn-bg: var(--app-primary); --bs-btn-border-color: var(--app-primary); --bs-btn-hover-bg: var(--app-primary-dark); --bs-btn-hover-border-color: var(--app-primary-dark); --bs-btn-active-bg: var(--app-primary-dark); }
.btn-outline-primary { --bs-btn-color: var(--app-primary); --bs-btn-border-color: var(--app-primary); --bs-btn-hover-bg: var(--app-primary); --bs-btn-hover-border-color: var(--app-primary); --bs-btn-active-bg: var(--app-primary); }
.fs-7 { font-size: .75rem; }
.min-w-0 { min-width: 0; }
.min-vh-75 { min-height: 75vh; }
.card { border-color: #e5e7eb; border-radius: .75rem; }
.card-header:first-child { border-radius: .75rem .75rem 0 0; }
.hover-lift { transition: transform .15s, box-shadow .15s; }
.hover-lift:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1.25rem rgba(15, 23, 42, .08); }

/* Barre de navigation */
.app-navbar { background: linear-gradient(90deg, #1e3a8a, #1d4ed8 60%, #4338ca); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.app-navbar .nav-link { color: rgba(255,255,255,.85); }
.app-navbar .nav-link:hover, .app-navbar .nav-link.active { color: #fff; }
.nav-badge { position: absolute; top: 2px; right: 0; font-size: .6rem; }
.notif-menu { width: 340px; max-width: 92vw; }
.notif-menu .dropdown-item { white-space: normal; }
.unread { background: #eff6ff; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 600; flex-shrink: 0; }
.app-footer { background: #fff; border-top: 1px solid #e5e7eb; }

/* Connexion */
.guest-body { background: radial-gradient(circle at 20% 20%, #4338ca 0, transparent 40%), linear-gradient(135deg, #1e3a8a, #1d4ed8 50%, #6d28d9); min-height: 100vh; }

/* En-tête de cours */
.course-header { background: #fff; border-bottom: 1px solid #e5e7eb; }
.course-tabs { gap: .25rem; }
.course-tabs .nav-link { color: #475569; border-bottom: 3px solid transparent; border-radius: 0; padding: .6rem .9rem; font-weight: 500; }
.course-tabs .nav-link:hover { color: var(--app-primary); }
.course-tabs .nav-link.active { color: var(--app-primary); border-bottom-color: var(--app-primary); }
.breadcrumb a { text-decoration: none; }

/* Cartes de cours */
.course-card { overflow: hidden; }
.course-cover { display: block; height: 110px; position: relative; text-decoration: none;
  background: linear-gradient(135deg, hsl(var(--h) 75% 45%), hsl(calc(var(--h) + 40) 70% 55%));
  background-image: radial-gradient(circle at 85% 20%, rgba(255,255,255,.25) 0 18%, transparent 19%), radial-gradient(circle at 10% 90%, rgba(255,255,255,.15) 0 25%, transparent 26%), linear-gradient(135deg, hsl(var(--h) 75% 42%), hsl(calc(var(--h) + 40) 70% 55%)); }
.course-cover-lg { height: 160px; border-radius: .75rem .75rem 0 0; }
.course-cover-code { position: absolute; left: 1rem; bottom: .7rem; color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: .03em; text-shadow: 0 1px 3px rgba(0,0,0,.25); }
.course-thumb { width: 120px; min-width: 120px; height: 84px; border-radius: .5rem; display: flex; align-items: flex-end; padding: .5rem; color: #fff; font-weight: 700; font-size: .85rem;
  background: linear-gradient(135deg, hsl(var(--h) 75% 42%), hsl(calc(var(--h) + 40) 70% 55%)); }

/* Page de cours */
.course-index .list-group-item { border: 0; padding: .4rem 1rem; }
.course-section .card-header { border-bottom: 1px solid #eef0f4; }
.section-hidden { opacity: .7; border-style: dashed; }
.module-list .module-item { position: relative; padding: .7rem .75rem; border-radius: .5rem; margin-bottom: .25rem; }
.module-list .module-item:hover { background: #f8fafc; }
.module-hidden { opacity: .55; }
.module-label { padding-left: 0 !important; }
.module-name { text-decoration: none; color: #0f172a; }
.module-name:hover { color: var(--app-primary); text-decoration: underline; }
.mod-icon { display: inline-flex; align-items: center; justify-content: center; border-radius: .6rem; flex-shrink: 0; }
.module-actions { position: absolute; top: .5rem; right: .5rem; opacity: 0; transition: opacity .15s; background: #fff; border-radius: .4rem; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.module-item:hover .module-actions { opacity: 1; }
.module-actions form, .module-actions .btn { border-radius: 0; }
.label-content img, .page-content img { max-width: 100%; height: auto; }
.page-content iframe, .label-content iframe { max-width: 100%; aspect-ratio: 16/9; width: 100%; height: auto; border: 0; border-radius: .5rem; }
.add-activity { border-style: dashed; }

/* Tests */
.question-info { background: #f1f5f9; border-right: 1px solid #e5e7eb; border-radius: .75rem 0 0 .75rem; }
.question-card { overflow: hidden; }
.quiz-nav-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 38px; border: 1px solid #cbd5e1; border-radius: .35rem; text-decoration: none; color: #334155; font-size: .85rem; font-weight: 600; background: #fff; }
.quiz-nav-btn.answered { background: #dbeafe; border-color: #93c5fd; }
.answer-line { padding: .35rem .6rem; border-radius: .4rem; margin-bottom: .2rem; }
.chosen-good { background: #dcfce7; }
.chosen-bad { background: #fee2e2; }
.timer-danger { color: #dc2626 !important; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .5; } }

/* Histogrammes */
.histogram, .activity-chart { display: flex; align-items: flex-end; gap: 4px; height: 180px; padding-top: 1rem; }
.hist-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.hist-bar { width: 100%; background: linear-gradient(180deg, #60a5fa, #1d4ed8); border-radius: 4px 4px 0 0; color: #fff; font-size: .7rem; text-align: center; min-height: 2px; }
.hist-col span { font-size: .65rem; color: #64748b; margin-top: 4px; white-space: nowrap; }

/* Carnet de notes */
.grader-table th, .grader-table td { white-space: nowrap; }
.sticky-col { position: sticky; left: 0; background: #fff; z-index: 1; }
thead .sticky-col, tfoot .sticky-col { background: #f8f9fa; }
.completion-table th .rotate { display: inline-block; font-weight: 500; font-size: .75rem; }

/* Calendrier */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head { padding: .5rem; text-align: center; font-weight: 600; font-size: .8rem; color: #64748b; border-bottom: 1px solid #e5e7eb; }
.cal-day { min-height: 105px; border-right: 1px solid #eef0f4; border-bottom: 1px solid #eef0f4; padding: .3rem; overflow: hidden; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-empty { background: #fafbfc; }
.cal-num { font-size: .8rem; font-weight: 600; color: #475569; }
.cal-today { background: #eff6ff; }
.cal-today .cal-num { color: #fff; background: var(--app-primary); border-radius: 50%; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.cal-event { display: block; font-size: .7rem; padding: 1px 4px; border-radius: 3px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
@media (max-width: 768px) { .cal-day { min-height: 60px; } .cal-event { font-size: .6rem; } }

/* Messagerie */
.messaging { overflow: hidden; }
.conv-list { max-height: 70vh; overflow: auto; }
.conv-pane { height: 70vh; }
.messages-scroll { overflow-y: auto; background: #f8fafc; }
.msg-bubble { max-width: 75%; background: #fff; border: 1px solid #e5e7eb; padding: .5rem .75rem; border-radius: 1rem 1rem 1rem .25rem; }
.msg-bubble.mine { background: var(--app-primary); color: #fff; border-color: var(--app-primary); border-radius: 1rem 1rem .25rem 1rem; }
.msg-time { font-size: .65rem; opacity: .7; text-align: right; }

/* Badges */
.badge-medal { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; min-width: 64px; border-radius: 50%; font-size: 1.8rem; color: #fff;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--c) 60%, #fff), var(--c)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, #fff), 0 4px 10px rgba(0,0,0,.15); }

/* Administration */
.admin-nav .nav-link { color: #475569; }
.admin-nav .nav-link.active { background: var(--app-primary); color: #fff; }
.stat-icon { width: 46px; height: 46px; border-radius: .75rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; }

/* Forums */
.forum-post { border-left: 3px solid #dbeafe; }
.post-message { white-space: normal; word-wrap: break-word; }
.submission-text { white-space: normal; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
a.btn:hover, a.card:hover, a.list-group-item:hover, a.nav-link:hover, a.dropdown-item:hover, a.navbar-brand:hover, a.page-link:hover { text-decoration: none; }
.grader-table thead th { white-space: normal; min-width: 110px; max-width: 170px; vertical-align: bottom; }
.grader-table thead th.sticky-col { min-width: 180px; }
/* Classe virtuelle */
.live-room { height: calc(100vh - 230px); min-height: 480px; border-radius: .75rem; overflow: hidden; background: #0f172a; }
.provider-card { transition: border-color .15s, box-shadow .15s; }

/* ---------------------------------------------------------------
   Arabe : mise en page de droite à gauche (bootstrap.rtl inverse déjà
   les utilitaires ms-/me-, ps-/pe-, text-start/end, float, etc.)
---------------------------------------------------------------- */
[dir=rtl] body { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", "Arial", sans-serif; }
[dir=rtl] .sticky-col { left: auto; right: 0; }
[dir=rtl] .module-actions { right: auto; left: .5rem; }
[dir=rtl] .question-info { border-right: 0; border-left: 1px solid #e5e7eb; border-radius: 0 .75rem .75rem 0; }
[dir=rtl] .forum-post { border-left: var(--bs-card-border-width) solid var(--bs-card-border-color); border-right: 3px solid #dbeafe; }
[dir=rtl] .course-cover-code { left: auto; right: 1rem; }
[dir=rtl] .nav-badge { right: auto; left: 0; }
[dir=rtl] .msg-bubble { border-radius: 1rem 1rem .25rem 1rem; }
[dir=rtl] .msg-bubble.mine { border-radius: 1rem 1rem 1rem .25rem; }
[dir=rtl] .msg-time { text-align: left; }
[dir=rtl] .cal-day { border-right: 0; border-left: 1px solid #eef0f4; }
[dir=rtl] .cal-day:nth-child(7n) { border-left: 0; }
[dir=rtl] input[type=url], [dir=rtl] input[type=email], [dir=rtl] .font-monospace, [dir=rtl] code, [dir=rtl] pre { direction: ltr; }
[dir=rtl] input[type=url], [dir=rtl] input[type=email] { text-align: right; }
.lang-switch .btn { min-width: 76px; }
[dir=rtl] .legend-dot { margin-right: 0; margin-left: 4px; }
/* Contenus saisis par les utilisateurs : chaque paragraphe prend la direction de sa propre langue */
[dir=rtl] .course-summary, [dir=rtl] .label-content, [dir=rtl] .page-content, [dir=rtl] .section-summary,
[dir=rtl] .post-message, [dir=rtl] .submission-text, [dir=rtl] .msg-bubble, [dir=rtl] .question-text { unicode-bidi: plaintext; text-align: start; }
/* Icônes directionnelles inversées en arabe (gauche ↔ droite) */
[dir=rtl] .bi-chevron-left::before { content: "\f285"; }
[dir=rtl] .bi-chevron-right::before { content: "\f284"; }
[dir=rtl] .bi-arrow-left::before { content: "\f138"; }
[dir=rtl] .bi-arrow-right::before { content: "\f12f"; }
[dir=rtl] .bi-box-arrow-left::before { content: "\f1c3"; }
[dir=rtl] .bi-box-arrow-right::before { content: "\f1c2"; }
[dir=rtl] .bi-box-arrow-in-right::before { content: "\f1bd"; }
