/* components.css — briques réutilisables (charte "verre sombre") */

.icon-wrap { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.icon { display: block; }

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4) 0 var(--space-5);
  min-height: 56px;
}
.topbar .back-btn {
  position: absolute;
  left: 0;
  top: var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 40px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}
.topbar .back-btn:active { transform: scale(.94); }
.topbar h1 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .01em;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 50px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-m);
  font-weight: 700;
  font-size: 16px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  transition: transform var(--dur-fast) var(--ease-organic), box-shadow var(--dur-fast), background var(--dur-fast);
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2) 60%, var(--primary-3));
  color: #fff;
  border-color: transparent;
  box-shadow: var(--glow-primary);
}
.btn-accent { background: linear-gradient(135deg, var(--accent), #FFC978); color: #2B1B04; border-color: transparent; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #F79AA0); color: #3A0A0E; border-color: transparent; }
.btn-ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--text-muted); }
.btn-block { width: 100%; }
.btn-lg { min-height: 60px; font-size: 18px; }
.btn-xl { min-height: 84px; font-size: 22px; border-radius: var(--radius-l); }
.btn:disabled { opacity: .4; pointer-events: none; }

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}
.icon-btn:active { transform: scale(.92); }
.icon-btn.is-active { background: linear-gradient(135deg, var(--primary-1), var(--primary-2)); color: #fff; border-color: transparent; }

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius-l);
  padding: var(--space-5);
  box-shadow: var(--shadow-soft);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.field label { font-weight: 700; font-size: 14px; color: var(--text-muted); }
.field input[type="text"],
.field input[type="number"],
.field input[type="search"],
.field textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  background: var(--surface-alt);
  color: var(--text);
  min-height: 48px;
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-muted); opacity: .7; }
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible { border-color: var(--primary-2); }
.hint { font-size: 13px; color: var(--text-muted); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  outline-offset: 4px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  box-shadow: var(--glow-primary);
  border: 3px solid var(--surface-solid);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  box-shadow: var(--glow-primary);
  border: 3px solid var(--surface-solid);
  cursor: pointer;
}
input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-alt);
}

.chip-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: 2px var(--space-1) var(--space-2);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.chip {
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.chip[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  color: #fff;
  border-color: transparent;
  box-shadow: var(--glow-primary);
}

.switch { display: inline-flex; align-items: center; gap: var(--space-3); }
.switch-track {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border-soft);
  position: relative;
  transition: background var(--dur-fast);
  flex-shrink: 0;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-soft);
  transition: transform var(--dur-fast) var(--ease-organic);
}
input:checked + .switch-track { background: linear-gradient(135deg, var(--primary-1), var(--primary-2)); border-color: transparent; }
input:checked + .switch-track::after { transform: translateX(22px); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-soft);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .label { font-weight: 700; }

.empty-state {
  text-align: center;
  padding: var(--space-7) var(--space-4);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}
.empty-state .icon-wrap {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--primary-2);
}
.empty-state p { font-size: 16px; max-width: 32ch; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 12, .6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 950;
  padding: var(--space-4);
  animation: fadeIn var(--dur-fast) ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface-solid);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-l);
  padding: var(--space-5);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lift);
  margin-bottom: env(safe-area-inset-bottom, 0);
}
.modal h2 { font-size: 18px; font-weight: 800; margin-bottom: var(--space-3); }
.modal p { color: var(--text-muted); margin-bottom: var(--space-5); }
.modal .actions { display: flex; gap: var(--space-3); }
.modal .actions .btn { flex: 1; }

@media (min-width: 640px) {
  .modal-backdrop { align-items: center; }
}

.student-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-soft);
}
.student-row:last-child { border-bottom: none; }
.student-row .name { flex: 1; font-weight: 700; }
.student-row.absent .name { color: var(--text-muted); text-decoration: line-through; }
.tag-absent {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--surface-alt);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 999px;
}
