/* =========================================================
   DESIGN MODERNE — EDU / DASHBOARD
   Palette : Navy / Violet / Cyan
   ========================================================= */

* {
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #06b6d4;
  --accent: #8b5cf6;

  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8faff;

  --text: #172033;
  --text-light: #64748b;
  --border: #e2e8f0;

  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  background:
    radial-gradient(
      circle at top right,
      rgba(99, 102, 241, 0.08),
      transparent 30%
    ),
    var(--bg);

  color: var(--text);
  line-height: 1.6;
}


/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;

  padding: 16px 28px;

  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);

  border-bottom: 1px solid rgba(226, 232, 240, 0.8);

  position: sticky;
  top: 0;
  z-index: 100;

  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  font-size: 1.15rem;
  font-weight: 800;

  text-decoration: none;
  color: var(--text);

  letter-spacing: -0.02em;
}

.brand::before {
  content: "";
  width: 34px;
  height: 34px;

  border-radius: 10px;

  background: linear-gradient(
    135deg,
    var(--primary),
    var(--accent)
  );

  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar nav a {
  position: relative;

  padding: 8px 13px;

  color: var(--text-light);
  text-decoration: none;

  font-size: 0.95rem;
  font-weight: 600;

  border-radius: 9px;

  transition:
    color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.topbar nav a:hover {
  color: var(--primary);
  background: #eef2ff;
  transform: translateY(-1px);
}


/* =========================================================
   PAGE
   ========================================================= */

.page {
  width: min(1200px, calc(100% - 32px));
  margin: 32px auto;
}


/* =========================================================
   LAYOUT
   ========================================================= */

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;

  min-height: 650px;

  background: var(--surface);

  border: 1px solid var(--border);
  border-radius: var(--radius-lg);

  overflow: hidden;

  box-shadow: var(--shadow-md);
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
  padding: 22px;

  background:
    linear-gradient(
      180deg,
      #111827 0%,
      #172554 100%
    );

  border-right: 1px solid rgba(255, 255, 255, 0.08);

  color: #fff;
}

.logo-box {
  height: 100px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin-bottom: 28px;

  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);

  background: rgba(255, 255, 255, 0.05);

  color: rgba(255, 255, 255, 0.7);

  transition: 0.25s ease;
}

.logo-box:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.5);
}


/* =========================================================
   CONTENT
   ========================================================= */

.content {
  padding: 32px;
  background: var(--surface);
}

.content.single {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}


/* =========================================================
   TITRES
   ========================================================= */

.section-title {
  padding: 0 0 18px;
  margin: 0;

  border-bottom: 1px solid var(--border);

  font-size: 1.25rem;
  font-weight: 750;

  color: var(--text);

  letter-spacing: -0.02em;
}

.section-title::after {
  content: "";

  display: block;

  width: 42px;
  height: 3px;

  margin-top: 10px;

  border-radius: 10px;

  background: linear-gradient(
    90deg,
    var(--primary),
    var(--secondary)
  );
}


/* =========================================================
   CARDS
   ========================================================= */

.cards {
  display: grid;
  gap: 20px;
  margin-top: 28px;
}

.class-grid {
  grid-template-columns: repeat(
    4,
    minmax(130px, 1fr)
  );
}

.subject-grid {
  grid-template-columns: repeat(
    3,
    minmax(180px, 1fr)
  );
}

.card {
  position: relative;

  min-height: 90px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;

  text-align: center;
  text-decoration: none;

  color: var(--text);

  background:
    linear-gradient(
      135deg,
      #eef2ff,
      #f0f9ff
    );

  border: 1px solid #dbeafe;

  border-radius: var(--radius-md);

  font-size: 1rem;
  font-weight: 700;

  overflow: hidden;

  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}

.card::before {
  content: "";

  position: absolute;
  inset: 0;

  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.08),
    rgba(6, 182, 212, 0.08)
  );

  opacity: 0;

  transition: opacity 0.25s ease;
}

.card:hover {
  transform: translateY(-5px);

  border-color: #a5b4fc;

  box-shadow: var(--shadow-lg);
}

.card:hover::before {
  opacity: 1;
}

.subject-card {
  min-height: 130px;
}


/* =========================================================
   CATEGORY
   ========================================================= */

.category-grid {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 20px;

  margin-top: 26px;
}

.category-panel {
  padding: 20px;

  background: var(--surface);

  border: 1px solid var(--border);
  border-radius: var(--radius-md);

  box-shadow: var(--shadow-sm);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.category-panel:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}


/* =========================================================
   FILES
   ========================================================= */

.file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 16px;

  padding: 15px 0;

  border-top: 1px solid var(--border);
}

.file-row:first-child {
  border-top: 0;
}

.file-row small {
  display: block;

  margin-top: 4px;

  color: var(--text-light);

  font-size: 0.85rem;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  gap: 8px;

  padding: 10px 16px;

  color: #fff;

  background:
    linear-gradient(
      135deg,
      var(--primary),
      var(--primary-dark)
    );

  border: 0;
  border-radius: 10px;

  text-decoration: none;

  font: inherit;
  font-weight: 700;

  cursor: pointer;

  box-shadow:
    0 5px 14px rgba(79, 70, 229, 0.25);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);

  box-shadow:
    0 8px 20px rgba(79, 70, 229, 0.32);

  filter: brightness(1.05);
}

.btn:active {
  transform: translateY(0);
}

.btn.danger {
  background:
    linear-gradient(
      135deg,
      #ef4444,
      #dc2626
    );

  box-shadow:
    0 5px 14px rgba(220, 38, 38, 0.22);
}

.btn.disabled {
  background: #94a3b8;

  box-shadow: none;

  cursor: not-allowed;
  pointer-events: none;
}


/* =========================================================
   AUTHENTIFICATION
   ========================================================= */

.auth-box {
  width: 100%;
  max-width: 520px;

  margin: 40px auto;

  padding: 30px;

  background: rgba(255, 255, 255, 0.95);

  border: 1px solid var(--border);
  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-lg);
}

.auth-box.wide {
  max-width: 680px;
}

.auth-box form {
  display: grid;
  gap: 18px;
}

.auth-box label {
  display: grid;
  gap: 8px;

  font-size: 0.92rem;
  font-weight: 700;

  color: var(--text);
}

.auth-box input,
.auth-box select {
  width: 100%;

  padding: 12px 14px;

  font: inherit;
  color: var(--text);

  background: #fff;

  border: 1px solid #cbd5e1;
  border-radius: 10px;

  outline: none;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.auth-box input:focus,
.auth-box select:focus {
  border-color: var(--primary);

  box-shadow:
    0 0 0 4px rgba(99, 102, 241, 0.12);
}


/* =========================================================
   ALERTS
   ========================================================= */

.alert {
  padding: 13px 16px;

  margin: 14px 0;

  border-radius: 10px;

  border: 1px solid transparent;

  font-weight: 600;
}

.alert.success {
  color: #166534;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.alert.error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.alert:not(.success):not(.error) {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}


/* =========================================================
   TEXTES
   ========================================================= */

.muted {
  color: var(--text-light);
}


/* =========================================================
   TABLEAUX
   ========================================================= */

.table-wrap {
  width: 100%;
  overflow-x: auto;

  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

table {
  width: 100%;

  border-collapse: collapse;

  background: var(--surface);
}

th,
td {
  padding: 14px 16px;

  text-align: left;

  border-bottom: 1px solid var(--border);
}

th {
  background: #f8fafc;

  color: #475569;

  font-size: 0.85rem;
  font-weight: 800;

  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: #f8faff;
}

tbody tr:last-child td {
  border-bottom: 0;
}


/* =========================================================
   FOOTER
   ========================================================= */

footer {
  padding: 32px 16px;

  color: var(--text-light);

  text-align: center;

  font-size: 0.9rem;
}


/* =========================================================
   RESPONSIVE — TABLETTE
   ========================================================= */

@media (max-width: 900px) {

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .class-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .subject-grid,
  .category-grid {
    grid-template-columns: 1fr;
  }
}


/* =========================================================
   RESPONSIVE — MOBILE
   ========================================================= */

@media (max-width: 520px) {

  .topbar {
    align-items: flex-start;
    flex-direction: column;

    padding: 14px 18px;
  }

  .topbar nav {
    width: 100%;
  }

  .topbar nav a {
    padding: 7px 10px;
    font-size: 0.88rem;
  }

  .page {
    width: calc(100% - 16px);
    margin: 16px auto;
  }

  .content {
    padding: 20px 16px;
  }

  .sidebar {
    padding: 18px;
  }

  .class-grid {
    grid-template-columns: 1fr;
  }

  .file-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .file-row .btn {
    width: 100%;
  }

  .auth-box {
    margin: 20px auto;
    padding: 22px 18px;
  }
}


/* =========================================================
   ACCESSIBILITÉ
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-header h1 {
    margin: 0;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.actions .btn,
.admin-header .btn {
    text-decoration: none;
    display: inline-block;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    border: none;
}

.btn.secondary {
    background: #3498db;
    color: white;
}

.btn.warning {
    background: #f39c12;
    color: white;
}

.btn.danger {
    background: #e74c3c;
    color: white;
}

.status.approved {
    color: #27ae60;
    font-weight: bold;
}

.status.pending {
    color: #f39c12;
    font-weight: bold;
}
