/* ============================================================
   TEACHER.CSS - Estils del mode professor
   ============================================================
   Conte:
   1. Boto "Mode Professor" (header)
   2. Overlay del modal de login
   3. Contingut del modal (formulari de contrasenya)
   4. Animacions: shake (error), entrada, tancament, exit
   5. Estat actiu del mode professor
   ============================================================ */

/* ------------------------------------------------------------
   1. BOTO "MODE PROFESSOR" (a la capçalera)
   ------------------------------------------------------------ */
.teacher-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 6px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  white-space: nowrap;
}

.teacher-btn:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.6);
}

/* Estat actiu: mode professor habilitat */
.teacher-btn.teacher-active {
  background: #f39c12;
  border-color: #e67e22;
  color: #1a2332;
  font-weight: 700;
}

.teacher-btn.teacher-active:hover {
  background: #e67e22;
}

/* Badge "ACTIU" que apareix dins del boto */
.teacher-badge {
  display: inline-block;
  background: #e74c3c;
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 99px;
  letter-spacing: 0.05em;
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}


/* ------------------------------------------------------------
   2. OVERLAY DEL MODAL
   Capa semitransparent sobre tota la pàgina
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fade-in 200ms ease forwards;
  padding: 1rem;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Animacio de tancament */
.modal-overlay.modal-closing {
  animation: fade-out 250ms ease forwards;
}

@keyframes fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}


/* ------------------------------------------------------------
   3. CONTINGUT DEL MODAL
   ------------------------------------------------------------ */
.modal-content {
  background: #ffffff;
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: slide-up 250ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Icona gran al damunt */
.modal-icon {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

/* Titol del modal */
.modal-title {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a2332;
  margin-bottom: 0.3rem;
}

/* Subtitol / instruccio */
.modal-subtitle {
  text-align: center;
  font-size: 0.85rem;
  color: #6b7a8d;
  margin-bottom: 1.25rem;
}

/* Grup de camp de formulari */
.modal-field {
  margin-bottom: 1rem;
}

.modal-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1a2332;
  margin-bottom: 0.35rem;
}

/* Input de contrasenya */
.modal-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 2px solid #dde3ea;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #1a2332;
  background: #f8fafc;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.modal-input:focus {
  outline: none;
  border-color: #2d7d46;
  box-shadow: 0 0 0 3px rgba(45,125,70,0.12);
  background: #fff;
}

/* Missatge d'error sota l'input */
.modal-error {
  font-size: 0.8rem;
  color: #c0392b;
  margin-top: 0.3rem;
  min-height: 1rem;
  display: block;
}

/* Grup de botons */
.modal-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

/* Boto principal (entrar) */
.modal-btn-primary {
  flex: 1;
  padding: 0.65rem;
  background: #2d7d46;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 200ms ease;
}

.modal-btn-primary:hover {
  background: #1e5c32;
}

/* Boto secundari (cancelar) */
.modal-btn-secondary {
  flex: 1;
  padding: 0.65rem;
  background: #f0f4f8;
  color: #1a2332;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 200ms ease;
}

.modal-btn-secondary:hover {
  background: #dde3ea;
}


/* ------------------------------------------------------------
   4. ANIMACIONS D'ESTAT
   ------------------------------------------------------------ */

/* Shake: contrasenya incorrecta */
.shake {
  animation: shake-anim 0.5s ease;
}

@keyframes shake-anim {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-8px); }
  30%      { transform: translateX(8px); }
  45%      { transform: translateX(-6px); }
  60%      { transform: translateX(6px); }
  75%      { transform: translateX(-3px); }
  90%      { transform: translateX(3px); }
}

/* Estat exit (contrasenya correcta) */
.modal-success .modal-content {
  animation: success-pulse 400ms ease forwards;
}

@keyframes success-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.modal-success .modal-icon::after {
  content: ' ✓';
  color: #2d7d46;
}


/* ------------------------------------------------------------
   5. INDICADORS DE MODE PROFESSOR ACTIU
   Els elements amb class teacher-only son visibles nomes
   quan TeacherMode.isActive === true (afegit per teacherMode.js)
   ------------------------------------------------------------ */

/* Per defecte, els elements exclusius del professor estan ocults */
.teacher-only {
  display: none;
}

/* Quan body te la classe teacher-mode, es mostren */
body.teacher-mode .teacher-only {
  display: block;
}

body.teacher-mode .teacher-only-flex {
  display: flex;
}

/* Ratlla de separacio amb etiqueta "MODE PROFESSOR" */
body.teacher-mode .main-content::before {
  content: 'MODE PROFESSOR ACTIU';
  display: block;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #d68910;
  background: #fff8e1;
  border: 1px dashed #f39c12;
  border-radius: 6px;
  padding: 0.35rem;
  margin-bottom: 1rem;
}
