/* ============================================================
   Présentia — style.css v1.0
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=Playfair+Display:wght@700;900&display=swap');

:root {
  --brand:       #c0392b;
  --brand-dark:  #96281b;
  --brand-light: #fadbd8;
  --dark:        #111827;
  --dark2:       #1f2937;
  --gray:        #6b7280;
  --gray-light:  #f3f4f6;
  --white:       #ffffff;
  --border:      #e5e7eb;
  --success:     #059669;
  --warning:     #d97706;
  --danger:      #dc2626;
  --info:        #2563eb;
  --present:     #059669;
  --absent:      #dc2626;
  --retard:      #d97706;
  --excuse:      #2563eb;
  --shadow:      0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:   0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:   0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius:      10px;
  --radius-sm:   6px;
}

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

body {
  font-family: 'Sora', sans-serif;
  background: var(--gray-light);
  color: var(--dark);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── LAYOUT ────────────────────────────────────────────────── */
.app { display:flex; min-height:100vh; }

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  width: 250px;
  background: var(--dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top:0; left:0; bottom:0;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.25s;
}

.sidebar-brand {
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.brand-app {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 900;
  color: white;
  letter-spacing: -0.5px;
}

.brand-app span { color: var(--brand); }

.brand-etab {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.4);
  margin-top: 3px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav { padding: 10px 0; flex:1; }

.nav-section {
  padding: 10px 20px 3px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.22);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 20px;
  color: rgba(255,255,255,0.58);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover  { background: rgba(255,255,255,0.05); color: white; }
.nav-item.active { background: rgba(255,255,255,0.08); color: white; border-left-color: var(--brand); }
.nav-item .icon  { font-size: 1rem; width: 18px; text-align: center; opacity: 0.8; }

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.user-chip {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}

.user-avatar {
  width: 34px; height: 34px;
  background: var(--brand);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: white; font-size: 0.78rem;
  flex-shrink: 0;
}

.user-name { color: white; font-size: 0.82rem; font-weight: 600; }
.user-role { color: rgba(255,255,255,0.32); font-size: 0.68rem; }

/* ── MAIN ──────────────────────────────────────────────────── */
.main {
  margin-left: 250px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: white;
  padding: 13px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}

.topbar-title { font-size: 1.05rem; font-weight: 700; }
.topbar-right { display:flex; align-items:center; gap:10px; font-size:0.8rem; color:var(--gray); }

.content { padding: 26px; flex: 1; }

/* ── CARDS ─────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 0;
}

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

.card-header h3 { font-size: 0.92rem; font-weight: 700; }
.card-body      { padding: 20px; }

/* ── STATS ─────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 13px;
  border-left: 4px solid var(--brand);
}

.stat-card.green  { border-left-color: var(--success); }
.stat-card.orange { border-left-color: var(--warning); }
.stat-card.blue   { border-left-color: var(--info);    }
.stat-card.purple { border-left-color: #7c3aed;        }

.stat-icon {
  width: 42px; height: 42px;
  border-radius: 9px;
  background: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}

.stat-card.green  .stat-icon { background: #d1fae5; }
.stat-card.orange .stat-icon { background: #fef3c7; }
.stat-card.blue   .stat-icon { background: #dbeafe; }
.stat-card.purple .stat-icon { background: #ede9fe; }

.stat-number {
  font-family: 'Playfair Display', serif;
  font-size: 1.65rem; font-weight: 700; line-height: 1;
}

.stat-label { color: var(--gray); font-size: 0.72rem; margin-top: 3px; }

/* ── FORMS ─────────────────────────────────────────────────── */
.form-group       { margin-bottom: 16px; }
.form-group label {
  display: block; font-weight: 600; font-size: 0.8rem;
  margin-bottom: 5px; color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Sora', sans-serif;
  font-size: 0.86rem;
  color: var(--dark);
  background: white;
  transition: border-color 0.15s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--brand); }

.form-row   { display: grid; grid-template-columns: 1fr 1fr;     gap: 13px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 13px; }

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

.checkbox-card {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.8rem;
  font-weight: 500;
}

.checkbox-card:hover               { border-color: var(--brand); background: var(--brand-light); }
.checkbox-card input[type=checkbox]{ accent-color: var(--brand); width: 14px; height: 14px; }

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: 'Sora', sans-serif;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; border: none;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary   { background: var(--brand); color: white; }
.btn-primary:hover   { background: var(--brand-dark); }
.btn-secondary { background: white; color: var(--dark); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--gray-light); }
.btn-success   { background: var(--success); color: white; }
.btn-success:hover   { background: #047857; }
.btn-danger    { background: var(--danger); color: white; }
.btn-danger:hover    { background: #b91c1c; }
.btn-warning   { background: var(--warning); color: white; }
.btn-warning:hover   { background: #b45309; }
.btn-sm   { padding: 4px 9px; font-size: 0.74rem; }
.btn-lg   { padding: 11px 26px; font-size: 0.92rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── TABLE ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }

table th {
  background: var(--dark);
  color: white;
  padding: 10px 13px;
  text-align: left;
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

table th.center  { text-align: center; }
table th.mat-hd  { background: var(--brand); text-align: center; }

table td {
  padding: 10px 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table tr:hover td   { background: #fafafa; }
table tr:last-child td { border-bottom: none; }

/* ── PRÉSENCE ──────────────────────────────────────────────── */
.statut-btn {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 2px solid transparent;
  font-size: 0.73rem; font-weight: 700;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  font-family: 'Sora', sans-serif;
  background: none;
}

.statut-btn.present { background: #d1fae5; color: var(--present); border-color: var(--present); }
.statut-btn.absent  { background: #fee2e2; color: var(--absent);  border-color: var(--absent);  }
.statut-btn.retard  { background: #fef3c7; color: var(--retard);  border-color: var(--retard);  }
.statut-btn.excuse  { background: #dbeafe; color: var(--excuse);  border-color: var(--excuse);  }
.statut-btn:hover   { opacity: 0.78; transform: scale(0.97); }

.min-input {
  width: 64px; padding: 3px 7px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.76rem; text-align: center;
  font-family: 'Sora', sans-serif;
}
.min-input:focus { border-color: var(--warning); outline: none; }

.motif-select {
  padding: 3px 7px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.73rem;
  font-family: 'Sora', sans-serif;
  max-width: 130px;
}

/* ── BADGES ────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem; font-weight: 700;
}

.badge-success { background: #d1fae5; color: var(--success); }
.badge-danger  { background: #fee2e2; color: var(--danger);  }
.badge-warning { background: #fef3c7; color: var(--warning); }
.badge-info    { background: #dbeafe; color: var(--info);    }
.badge-gray    { background: var(--gray-light); color: var(--gray); }
.badge-purple  { background: #ede9fe; color: #7c3aed; }

/* ── ALERTS ────────────────────────────────────────────────── */
.alert {
  padding: 10px 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.84rem; font-weight: 500;
}

.alert-success { background: #d1fae5; color: var(--success); border-left: 3px solid var(--success); }
.alert-error   { background: #fee2e2; color: var(--danger);  border-left: 3px solid var(--danger);  }
.alert-warning { background: #fef3c7; color: var(--warning); border-left: 3px solid var(--warning); }
.alert-info    { background: #dbeafe; color: var(--info);    border-left: 3px solid var(--info);    }

/* ── MODALS ────────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: white;
  border-radius: var(--radius);
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.18s ease;
}

@keyframes modalIn {
  from { opacity:0; transform:translateY(-14px) scale(0.97); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}

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

.modal-header h3 { font-size: 0.92rem; font-weight: 700; }

.modal-close {
  background: none; border: none; font-size: 1.1rem;
  cursor: pointer; color: var(--gray); line-height: 1; padding: 2px;
}
.modal-close:hover { color: var(--dark); }

.modal-body   { padding: 20px; }
.modal-footer {
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ── CODE INVITATION ───────────────────────────────────────── */
.code-box {
  background: var(--dark);
  color: white;
  font-family: 'Courier New', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 4px;
  padding: 14px 22px;
  border-radius: var(--radius);
  text-align: center;
  margin: 10px 0;
  cursor: pointer;
  transition: background 0.15s;
  user-select: all;
}
.code-box:hover { background: #374151; }

/* ── PLANNING CELLS ────────────────────────────────────────── */
.planning-cell {
  background: #ecfdf5;
  border-left: 3px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  margin-bottom: 5px;
  font-size: 0.76rem;
}

.planning-cell.annule  { background: #fee2e2; border-left-color: var(--danger);  }
.planning-cell.reporte { background: #fef3c7; border-left-color: var(--warning); }

/* ── VALIDATION ROW ────────────────────────────────────────── */
.validation-row {
  display: flex; gap: 14px; padding: 13px 20px;
  background: var(--gray-light); border-top: 1px solid var(--border);
  align-items: center; flex-wrap: wrap;
}

.validation-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
}

.validation-item input[type=checkbox] {
  width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer;
}

/* ── MISC ──────────────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-gray    { color: var(--gray); }
.text-small   { font-size: 0.75rem; }
.fw-bold      { font-weight: 700; }
.mb-4         { margin-bottom: 14px; }
.mb-6         { margin-bottom: 22px; }
.mt-4         { margin-top: 14px; }
.flex         { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; justify-content: center; align-items: center; }
.gap-2        { gap: 7px; }
.gap-3        { gap: 11px; }
.w-full       { width: 100%; }

/* ── PRINT ─────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main    { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  table th { background: #333 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar          { transform: translateX(-100%); }
  .sidebar.open     { transform: translateX(0); }
  .main             { margin-left: 0; }
  .form-row         { grid-template-columns: 1fr; }
  .form-row-3       { grid-template-columns: 1fr; }
  .matieres-grid    { grid-template-columns: 1fr 1fr; }
  .content          { padding: 14px; }
  .stats-grid       { grid-template-columns: 1fr 1fr; }
  .topbar           { padding: 10px 14px; }
}

/* ── AUTH PAGES ────────────────────────────────────────────── */
.auth-body {
  min-height: 100vh;
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: fadeUp 0.35s ease;
}

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

.auth-back {
  display: inline-block;
  color: var(--gray);
  text-decoration: none;
  font-size: 0.82rem;
  margin-bottom: 20px;
  transition: color 0.15s;
}
.auth-back:hover { color: var(--dark); }

.auth-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}

.auth-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.auth-sub {
  color: var(--gray);
  font-size: 0.84rem;
  margin-bottom: 24px;
  line-height: 1.5;
}

.auth-hint {
  margin-top: 16px;
  font-size: 0.75rem;
  color: var(--gray);
  text-align: center;
  line-height: 1.5;
}

.auth-info {
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--gray-light);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--gray);
  line-height: 1.5;
}

/* ── HOME / INDEX PAGE ─────────────────────────────────────── */
.home-body {
  min-height: 100vh;
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.home-wrapper {
  text-align: center;
  max-width: 600px;
  width: 100%;
  animation: fadeUp 0.4s ease;
}

.home-logo {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 900;
  color: white;
  letter-spacing: -1px;
  margin-bottom: 6px;
}

.home-logo span { color: var(--brand); }

.home-tagline {
  color: rgba(255,255,255,0.4);
  font-size: 0.95rem;
  margin-bottom: 48px;
}

.role-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.role-card {
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 32px 20px;
  text-decoration: none;
  color: white;
  transition: all 0.2s;
  cursor: pointer;
  display: block;
}

.role-card:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--brand);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(192,57,43,0.2);
}

.role-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
  display: block;
}

.role-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.role-desc {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  line-height: 1.5;
}

.role-arrow {
  margin-top: 10px;
  font-size: 1rem;
  color: var(--brand);
}

.home-register {
  color: rgba(255,255,255,0.3);
  font-size: 0.82rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  padding-bottom: 2px;
  transition: color 0.15s;
}
.home-register:hover { color: rgba(255,255,255,0.6); }

.home-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 900;
  color: white;
}
.home-brand span { color: var(--brand); }

.home-sub {
  color: rgba(255,255,255,0.4);
  font-size: 0.82rem;
  margin-top: 3px;
}

.home-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.8rem;
  font-weight: 900;
  color: white;
  margin: 32px 0 10px;
  letter-spacing: -1px;
  line-height: 1.1;
}

.home-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 32px 0 24px;
}

.home-left, .home-right, .home-features, .feat-item {
  /* utilitaires layout index.php */
}

.home-features {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
  margin: 20px 0 32px;
}

.feat-item {
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  text-align: center;
}

.feat-item strong {
  display: block;
  color: white;
  margin-bottom: 3px;
  font-size: 0.82rem;
}

/* Register page */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray);
  margin: 20px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
