/* =====================================================================
   YSCHOOL — Design System (mobile-first, moderne & élégant)
   ===================================================================== */
:root {
  --primary:        #4f46e5;
  --primary-dark:   #4338ca;
  --primary-light:  #6366f1;
  --primary-soft:   #eef2ff;
  --accent:         #06b6d4;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;

  --bg:             #f1f5f9;
  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --border:         #e2e8f0;
  --text:           #0f172a;
  --text-muted:     #64748b;
  --text-soft:      #94a3b8;

  --radius:         14px;
  --radius-sm:      9px;
  --radius-lg:      20px;
  --shadow-sm:      0 1px 2px rgba(15,23,42,.06);
  --shadow:         0 4px 16px rgba(15,23,42,.08);
  --shadow-lg:      0 12px 40px rgba(15,23,42,.16);

  --sidebar-w:      264px;
  --header-h:       62px;
  --font:           'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ---------------------- Auth / Login ----------------------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(99,102,241,.25), transparent),
    radial-gradient(900px 500px at 110% 110%, rgba(6,182,212,.25), transparent),
    linear-gradient(135deg, #1e1b4b, #312e81 55%, #1e293b);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
  animation: rise .5s ease;
}
.auth-logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  display: grid; place-items: center;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-size: 30px; font-weight: 800;
  box-shadow: var(--shadow);
}
.auth-title { text-align: center; font-size: 22px; font-weight: 800; }
.auth-sub { text-align: center; color: var(--text-muted); margin-bottom: 22px; font-size: 14px; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------------------- Forms ----------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.input, .select, textarea.input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.input-group { position: relative; }
.input-group .input { padding-left: 42px; }
.input-group .icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-soft); font-size: 17px;
}

/* ---------------------- Buttons ----------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px;
  border: none; border-radius: var(--radius-sm);
  font-weight: 600; cursor: pointer;
  transition: transform .08s, box-shadow .15s, background .15s;
  background: var(--surface-2); color: var(--text);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border: 1.5px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 9px; border-radius: 10px; }

/* ---------------------- Alerts ----------------------- */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 14px; border-left: 4px solid; }
.alert-error   { background: #fef2f2; color: #991b1b; border-color: var(--danger); }
.alert-success { background: #ecfdf5; color: #065f46; border-color: var(--success); }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: var(--info); }
.alert-warning { background: #fffbeb; color: #92400e; border-color: var(--warning); }

/* ---------------------- App Layout ----------------------- */
.layout { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: #1e293b;
  color: #cbd5e1;
  transform: translateX(-100%);
  transition: transform .25s ease;
  z-index: 1000;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px; color: #fff; font-weight: 800; font-size: 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .logo {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-weight: 800;
}
.nav { padding: 12px 10px; flex: 1; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 14px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px; margin-bottom: 2px;
  color: #cbd5e1; font-weight: 500; transition: background .15s, color .15s;
}
.nav-link .ico { font-size: 18px; width: 22px; text-align: center; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; box-shadow: var(--shadow); }

.topbar {
  position: sticky; top: 0; z-index: 900;
  height: var(--header-h);
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
}
.topbar .menu-btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 11px; cursor: pointer; }
.topbar .title { font-weight: 700; font-size: 16px; }
.topbar .spacer { flex: 1; }
.topbar .user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }

.content { padding: 18px 16px 40px; }
main.main { transition: margin .25s ease; }

.overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  opacity: 0; visibility: hidden; transition: .25s; z-index: 950;
}
.overlay.show { opacity: 1; visibility: visible; }

/* ---------------------- Cards / Grid ----------------------- */
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 21px; font-weight: 800; }
.page-head p { color: var(--text-muted); font-size: 14px; }

.grid { display: grid; gap: 14px; }
.grid-stats { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 18px;
}
.card-pad-0 { padding: 0; }
.stat {
  display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
}
.stat .stat-ico {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center; font-size: 20px; margin-bottom: 6px;
}
.stat .v { font-size: 26px; font-weight: 800; }
.stat .l { color: var(--text-muted); font-size: 13px; }
.bg-indigo { background: var(--primary-soft); color: var(--primary); }
.bg-cyan   { background: #cffafe; color: #0891b2; }
.bg-green  { background: #d1fae5; color: #059669; }
.bg-amber  { background: #fef3c7; color: #d97706; }
.bg-rose   { background: #ffe4e6; color: #e11d48; }

/* ---------------------- Tables ----------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 13px; text-align: left; white-space: nowrap; }
.table thead th { background: var(--surface-2); font-weight: 700; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--border); }
.table tbody tr { border-bottom: 1px solid var(--border); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child { border-bottom: none; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-muted   { background: var(--surface-2); color: var(--text-muted); }

/* ---------------------- Utilities ----------------------- */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mb-3 { margin-bottom: 12px; }
.text-muted { color: var(--text-muted); } .text-sm { font-size: 13px; } .text-center { text-align: center; }
.fw-700 { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ---------------------- Responsive (desktop) ----------------------- */
@media (min-width: 992px) {
  .sidebar { transform: translateX(0); }
  main.main { margin-left: var(--sidebar-w); }
  .topbar .menu-btn { display: none; }
  .overlay { display: none; }
  .content { padding: 24px 28px 48px; }
  .grid-stats { grid-template-columns: repeat(4, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}
