/* ============================================================
   assets/css/main.css — Feuille de style globale CapClasse.fr
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;600;700;800&family=Nunito:wght@400;500;600;700&display=swap');

/* ── Variables ─────────────────────────────────────────── */
:root {
  --primary:        #FF6B35;
  --primary-light:  #FFF0EA;
  --primary-dark:   #D94F1C;
  --secondary:      #4ECDC4;
  --secondary-light:#E8FAF9;
  --purple:         #7B5EA7;
  --purple-light:   #F0EAF9;
  --blue:           #3A86FF;
  --blue-light:     #EAF1FF;
  --green:          #2EC4B6;
  --green-light:    #E5F8F7;
  --pink:           #FF6B9D;
  --pink-light:     #FFE8F3;
  --amber:          #FFD93D;
  --dark:           #1A1A2E;
  --text:           #2D3142;
  --text-muted:     #6B7280;
  --border:         #E5E7EB;
  --border-focus:   #3A86FF;
  --bg:             #FAFAF8;
  --white:          #FFFFFF;
  --danger:         #EF4444;
  --danger-light:   #FEF2F2;
  --success:        #10B981;
  --success-light:  #ECFDF5;
  --warning:        #F59E0B;
  --warning-light:  #FFFBEB;
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.09);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.12);
  --radius:     16px;
  --radius-sm:  10px;
  --radius-lg:  24px;
  --radius-xl:  32px;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
h1,h2,h3,h4,h5,h6 { font-family: 'Baloo 2', cursive; line-height: 1.2; }
a { text-decoration: none; color: inherit; transition: color .2s; }
img { max-width: 100%; height: auto; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Utilitaires ────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 700px; margin: 0 auto; padding: 0 24px; }
.container-xs { max-width: 480px; margin: 0 auto; padding: 0 24px; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-primary{ color: var(--primary); }
.mt-auto { margin-top: auto; }
.hidden  { display: none !important; }
.flex    { display: flex; }
.grid    { display: grid; }
.gap-2   { gap: 8px; }
.gap-3   { gap: 12px; }
.gap-4   { gap: 16px; }
.gap-6   { gap: 24px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

/* ── Boutons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius);
  font-family: 'Baloo 2', cursive; font-weight: 700; font-size: 1rem;
  border: none; cursor: pointer; transition: all .25s; text-align: center;
  justify-content: center; white-space: nowrap;
}
.btn-sm  { padding: 8px 16px; font-size: .9rem; border-radius: var(--radius-sm); }
.btn-lg  { padding: 16px 36px; font-size: 1.1rem; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 16px rgba(255,107,53,.3); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255,107,53,.4); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { opacity: .9; transform: translateY(-1px); }
.btn-outline { background: #fff; color: var(--text); border: 2px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; }
.btn-ghost:hover { background: var(--bg); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-full { width: 100%; }
.btn-icon { padding: 10px; border-radius: var(--radius-sm); }

/* ── Formulaires ────────────────────────────────────────── */
.form-group   { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.form-label   { font-weight: 700; font-size: .9rem; color: var(--text); }
.form-label span.req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%; padding: 12px 16px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: #fff; color: var(--text);
  font-size: 1rem; transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(58,134,255,.12);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-valid   { border-color: var(--success); }
.form-error  { font-size: .82rem; color: var(--danger); font-weight: 600; }
.form-hint   { font-size: .78rem; color: var(--text-muted); }
.form-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input-group { position: relative; }
.input-group .form-control { padding-right: 48px; }
.input-group .input-icon {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); cursor: pointer; font-size: 1.1rem;
}

/* ── Alertes ────────────────────────────────────────────── */
.alert {
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: .92rem; font-weight: 600;
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 20px;
}
.alert-danger  { background: var(--danger-light);  color: #991B1B; border-left: 4px solid var(--danger); }
.alert-success { background: var(--success-light); color: #065F46; border-left: 4px solid var(--success); }
.alert-warning { background: var(--warning-light); color: #92400E; border-left: 4px solid var(--warning); }
.alert-info    { background: var(--blue-light);    color: #1E3A5F; border-left: 4px solid var(--blue); }

/* ── Cartes ─────────────────────────────────────────────── */
.card {
  background: #fff; border-radius: var(--radius);
  border: 1.5px solid var(--border); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-lg { padding: 32px; }
.card:hover { box-shadow: var(--shadow-md); }
.card-header { padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 100px;
  font-size: .72rem; font-weight: 700;
}
.badge-primary  { background: var(--primary-light);  color: var(--primary); }
.badge-success  { background: var(--success-light);  color: #065F46; }
.badge-warning  { background: var(--warning-light);  color: #92400E; }
.badge-danger   { background: var(--danger-light);   color: #991B1B; }
.badge-purple   { background: var(--purple-light);   color: var(--purple); }
.badge-blue     { background: var(--blue-light);     color: var(--blue); }
.badge-secondary{ background: var(--secondary-light);color: #0A8A81; }

/* ── Navigation principale ──────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 999;
  background: #fff; border-bottom: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; max-width: 1200px; margin: 0 auto;
}
.nav-logo {
  font-family: 'Baloo 2', cursive; font-size: 1.7rem; font-weight: 800;
  color: var(--primary); display: flex; align-items: center; gap: 4px;
}
.nav-logo .logo-accent { color: var(--secondary); }
.nav-logo .logo-dot    { color: var(--purple); }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a { padding: 8px 13px; border-radius: var(--radius-sm); font-weight: 600; font-size: .9rem; }
.nav-links a:hover { background: var(--primary-light); color: var(--primary); }
.nav-links a.active { color: var(--primary); background: var(--primary-light); }
.nav-cta {
  background: var(--primary) !important; color: #fff !important;
  padding: 10px 20px !important; border-radius: var(--radius-sm) !important;
}
.nav-cta:hover { opacity: .9 !important; }
.nav-user-menu {
  display: flex; align-items: center; gap: 10px;
}
.nav-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  font-family: 'Baloo 2', cursive; font-weight: 800; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: 260px; min-height: 100vh;
  background: var(--dark); padding: 24px 0;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; z-index: 100;
}
.sidebar-logo { padding: 0 24px 24px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-logo .nav-logo { font-size: 1.5rem; }
.sidebar-nav { padding: 20px 12px; flex: 1; }
.sidebar-section-label {
  font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px;
  color: rgba(255,255,255,.35); padding: 16px 12px 8px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.65); font-weight: 600; font-size: .92rem;
  transition: all .2s; margin-bottom: 4px;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(255,255,255,.1); color: #fff;
}
.sidebar-link.active { background: var(--primary); color: #fff; }
.sidebar-link .link-icon { font-size: 1.1rem; min-width: 22px; text-align: center; }
.sidebar-footer { padding: 20px 24px; border-top: 1px solid rgba(255,255,255,.1); }
.dashboard-layout { display: flex; min-height: 100vh; }
.dashboard-main  { margin-left: 260px; flex: 1; background: var(--bg); }
.dashboard-header{
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 16px 32px; display: flex; justify-content: space-between; align-items: center;
}
.dashboard-content { padding: 32px; }

/* ── Progress bar ───────────────────────────────────────── */
.progress { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 4px; transition: width .6s ease; }
.progress-primary  { background: var(--primary); }
.progress-success  { background: var(--success); }
.progress-secondary{ background: var(--secondary); }

/* ── Stat cards ─────────────────────────────────────────── */
.stat-card {
  background: #fff; border-radius: var(--radius);
  padding: 20px 24px; border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: .8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.stat-value { font-family: 'Baloo 2', cursive; font-size: 2rem; font-weight: 800; color: var(--dark); }
.stat-change { font-size: .82rem; color: var(--success); font-weight: 700; margin-top: 4px; }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1.5px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: #fff; }
thead th { background: var(--bg); padding: 12px 16px; font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); text-align: left; border-bottom: 2px solid var(--border); }
tbody td { padding: 12px 16px; font-size: .92rem; border-bottom: 1px solid var(--border); }
tbody tr:hover td { background: var(--bg); }
tbody tr:last-child td { border-bottom: none; }

/* ── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--text-muted); margin-bottom: 24px; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted); font-weight: 600; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--border); }
.breadcrumb-current { color: var(--text); font-weight: 700; }

/* ── Pagination ─────────────────────────────────────────── */
.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-weight: 700; font-size: .9rem;
  border: 1.5px solid var(--border);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ── Quiz UI ────────────────────────────────────────────── */
.quiz-option-btn {
  width: 100%; padding: 14px 18px; text-align: left;
  background: var(--bg); border: 2px solid var(--border);
  border-radius: var(--radius-sm); font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: all .2s; display: flex; align-items: center; gap: 12px;
}
.quiz-option-btn:hover { border-color: var(--blue); background: var(--blue-light); }
.quiz-option-btn.correct { border-color: var(--success); background: var(--success-light); color: #065F46; }
.quiz-option-btn.incorrect { border-color: var(--danger); background: var(--danger-light); color: #991B1B; }
.quiz-opt-key {
  min-width: 30px; height: 30px; border-radius: 8px;
  background: var(--border); display: flex; align-items: center;
  justify-content: center; font-size: .82rem; font-weight: 800;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { position: relative; width: 100%; min-height: auto; flex-direction: row; flex-wrap: wrap; }
  .dashboard-main { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
  .container { padding: 0 16px; }
  .dashboard-content { padding: 16px; }
  .dashboard-header { padding: 12px 16px; }
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeUp   { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeIn   { from{opacity:0} to{opacity:1} }
@keyframes spin     { to{transform:rotate(360deg)} }
@keyframes shake    { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 60%{transform:translateX(6px)} }
.anim-fade-up  { animation: fadeUp .5s ease both; }
.anim-fade-in  { animation: fadeIn .4s ease both; }
.anim-shake    { animation: shake .4s ease; }
.anim-delay-1  { animation-delay: .1s; }
.anim-delay-2  { animation-delay: .2s; }
.anim-delay-3  { animation-delay: .3s; }

/* ── Scrollbar personnalisée ────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
