/* ══════════════════════════════════════════════════════════════════════
   Вхід і реєстрація — ОДНА картка для учня (profile.html) і вчителя (teacher.html).
   Картка стоїть по центру між шапкою і футером і вміщається без прокрутки
   на ноутбуку 1366×768 і телефоні 390×844. Хто входить — перемикач
   «Учень / Вчитель» угорі картки, тому окремого кроку вибору немає.
   ══════════════════════════════════════════════════════════════════════ */

/* Сцена: головна область сторінки тягнеться на всю вільну висоту, картка — по центру. */
.auth-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.auth-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px 12px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.auth-stage.hidden { display: none !important; }
.auth-boot-note { color: var(--nmt-text-muted); font-size: 0.95rem; margin: 0; }

/* Картка */
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--nmt-surface);
  border-radius: 20px;
  box-shadow: 0 20px 56px rgba(15, 118, 110, 0.14), 0 3px 14px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  animation: authSlideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes authSlideUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

/* Бренд-смужка: компактна, логотип і назва в один рядок. */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #0a5c56 0%, var(--nmt-primary) 55%, #0891b2 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.auth-brand::before {
  content: "";
  position: absolute; top: -70px; right: -50px;
  width: 170px; height: 170px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.11);
  pointer-events: none;
}
.auth-brand-logo {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.32);
  font-size: 0.95rem; font-weight: 800; letter-spacing: -0.02em; color: #fff;
  position: relative; z-index: 1;
}
.auth-brand-text { display: flex; flex-direction: column; min-width: 0; position: relative; z-index: 1; }
.auth-brand-title { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.auth-brand-sub { font-size: 0.8rem; color: rgba(255, 255, 255, 0.88); line-height: 1.3; }

/* Хто входить: учень чи вчитель. Посилання, бо це дві різні сторінки. */
.auth-role {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 10px 18px 0;
  padding: 4px;
  border-radius: 12px;
  background: var(--nmt-subtle);
  border: 1px solid var(--nmt-border);
}
.auth-role-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 0.88rem; font-weight: 600;
  color: var(--nmt-text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.auth-role-btn:hover { color: var(--nmt-text); text-decoration: none; }
.auth-role-btn.is-active {
  background: var(--nmt-surface);
  color: var(--nmt-text);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.10);
  cursor: default;
}

/* Вкладки «Вхід / Реєстрація» — пігулки. (.auth-tab і .auth-panel — гачки для JS.) */
.auth-tabs {
  display: flex; gap: 4px;
  margin: 8px 18px 0;
  padding: 0; border: none; border-radius: 0; background: transparent;
}
.auth-tab {
  flex: 1;
  padding: 9px 8px;
  border: none; border-radius: 10px;
  background: transparent;
  font: inherit; font-size: 0.9rem; font-weight: 600;
  color: var(--nmt-text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.auth-tab:hover { background: var(--nmt-subtle); color: var(--nmt-text); }
.auth-tab.active {
  background: linear-gradient(135deg, var(--nmt-primary) 0%, #0891b2 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(15, 118, 110, 0.25);
}

/* Тіло форми */
.auth-body, .auth-panel, .auth-inner-section { padding: 12px 20px 16px; }
.auth-panel { display: none; border: none; border-radius: 0; background: transparent; box-shadow: none; }
.auth-panel.active { display: block; animation: authPanelIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.auth-form-panel { animation: authPanelIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes authPanelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.auth-card .field-label, .auth-card .profile-form .field-label {
  display: block;
  margin: 11px 0 4px;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.01em;
  color: var(--nmt-text-muted);
}
.auth-card .field-label:first-child, .auth-card .profile-form .field-label:first-child { margin-top: 0; }
.auth-card .text-input, .auth-card .profile-form .text-input {
  width: 100%; box-sizing: border-box;
  padding: 10px 13px;
  font-size: 0.95rem;
  background: var(--nmt-subtle);
  border: 1.5px solid var(--nmt-border);
  border-radius: 11px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.auth-card .text-input:focus, .auth-card .profile-form .text-input:focus {
  background: var(--nmt-surface);
  border-color: var(--nmt-primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
  outline: none;
}
.auth-card .profile-actions, .auth-card .start-actions { margin-top: 14px; }
.auth-card .btn-primary {
  width: 100%; box-sizing: border-box;
  padding: 12px;
  border-radius: 12px;
  font-size: 0.98rem; font-weight: 700;
  background: linear-gradient(135deg, var(--nmt-primary) 0%, #0891b2 100%);
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.26);
  transition: box-shadow 0.2s, transform 0.18s;
}
.auth-card .btn-primary:hover { box-shadow: 0 8px 22px rgba(15, 118, 110, 0.38); transform: translateY(-1px); }
.auth-card .btn-primary:active { transform: translateY(0); }
.auth-card .btn-secondary { width: 100%; box-sizing: border-box; margin-top: 8px; border-radius: 12px; padding: 11px; }
.auth-forgot-row, .auth-form-hint { margin: 10px 0 0; text-align: center; font-size: 0.86rem; color: var(--nmt-text-muted); }
.auth-forgot-row a, .auth-form-hint a { color: var(--nmt-primary); font-weight: 600; text-decoration: none; }
.auth-forgot-row a:hover, .auth-form-hint a:hover { text-decoration: underline; }
.auth-card .input-ok { margin: 8px 0 0; color: var(--nmt-ok); font-size: 0.9rem; }
.auth-card .muted { font-size: 0.92rem; line-height: 1.5; }
.auth-card .recaptcha-wrap { margin: 14px 0; }
.auth-card .profile-divider { margin: 14px 0 10px; }

/* «Забули пароль?» в учня — блок усередині форми входу: коли він відкритий, поля входу ховаємо. */
#form-login.is-forgot > .field-label, #form-login.is-forgot > .text-input, #form-login.is-forgot > .profile-actions,
#form-login.is-forgot > .auth-form-hint, #form-login.is-forgot > .profile-google-section,
#form-login.is-forgot > #login-error, #form-login.is-forgot > #confirm-success, #form-login.is-forgot > .recaptcha-wrap { display: none !important; }
.auth-card .forgot-password-block { margin-top: 0; padding-top: 0; border-top: none; }
.auth-card .forgot-password-block .profile-actions { display: flex; flex-direction: column; gap: 0; }

/* Темна тема і контраст */
body.theme-dark .auth-card { box-shadow: 0 20px 56px rgba(0, 0, 0, 0.45); }
body.theme-contrast .auth-card { border: 2px solid #000; box-shadow: none; }
body.theme-contrast .auth-role-btn.is-active, body.theme-contrast .auth-tab.active { outline: 2px solid #000; }

/* Телефон */
@media (max-width: 480px) {
  .auth-stage { padding: 4px 8px 16px; align-items: flex-start; }
  .auth-card { border-radius: 16px; }
  .auth-brand { padding: 14px 16px; }
  .auth-role { margin: 12px 14px 0; }
  .auth-tabs { margin: 10px 14px 0; }
  .auth-body, .auth-panel, .auth-inner-section { padding: 12px 16px 18px; }
  .auth-tab { padding: 9px 6px; font-size: 0.86rem; }
}
/* Коли висоти мало (ноутбук із панелями, альбомний телефон) — ще щільніше. */
@media (max-height: 700px) {
  .auth-stage { align-items: flex-start; }
  .auth-brand { padding: 12px 18px; }
  .auth-card .field-label, .auth-card .profile-form .field-label { margin-top: 9px; }
}
