/* ─────────────────────────────────────────────────────────────
   Re Ted EdPlus · Auth modal & admin styles
   Matches the site's serif/sans/blue palette and respects the
   dark-mode theme variables defined in index.html.
   ───────────────────────────────────────────────────────────── */

/* ── Nav account widget ──────────────────────────────────── */
.nav-account-item { display: flex; align-items: center; }
.btn-account {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.5rem 1rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--black);
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-account:hover {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}
html[data-theme="dark"] .btn-account {
  color: var(--black);
  border-color: rgba(255, 255, 255, 0.22);
}
html[data-theme="dark"] .btn-account:hover {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-account .account-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  font-size: 0.7rem; font-weight: 600;
  background: var(--blue); color: #fff;
  border-radius: 50%;
}

/* ── Modal overlay ───────────────────────────────────────── */
.auth-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(13, 13, 13, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.25s ease;
  padding: 1.5rem;
}
.auth-modal-backdrop.open {
  display: flex;
  opacity: 1;
}
.auth-modal {
  background: var(--white);
  width: 100%;
  max-width: 440px;
  border-radius: 18px;
  padding: 2.6rem 2.4rem 2.2rem;
  position: relative;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  transform: translateY(14px);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.28s;
}
.auth-modal-backdrop.open .auth-modal {
  transform: translateY(0);
  opacity: 1;
}
.auth-close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px;
  border: none; background: transparent;
  font-size: 1.1rem; color: var(--mid);
  cursor: pointer; border-radius: 50%;
  transition: background 0.2s, color 0.2s;
}
.auth-close:hover { background: rgba(0,0,0,0.06); color: var(--black); }

.auth-eyebrow {
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 0.6rem;
}
.auth-title {
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 500;
  color: var(--black);
  line-height: 1.15;
  margin-bottom: 0.4rem;
}
.auth-title em { font-style: italic; color: var(--blue); }
.auth-subtitle {
  font-family: var(--sans);
  font-size: 0.84rem;
  color: var(--mid);
  margin-bottom: 1.6rem;
  line-height: 1.55;
}

/* Tab switcher */
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--lighter);
  border-radius: 100px;
  padding: 4px;
  margin-bottom: 1.6rem;
}
.auth-tab {
  background: transparent;
  border: none;
  padding: 0.6rem 0.5rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--mid);
  cursor: pointer;
  border-radius: 100px;
  transition: background 0.25s, color 0.25s;
}
.auth-tab.active {
  background: var(--white);
  color: var(--black);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
html[data-theme="dark"] .auth-tab.active {
  background: var(--off-black);
  color: var(--white);
}

/* Form fields */
.auth-form { display: flex; flex-direction: column; gap: 0.9rem; }
.auth-form .field { display: flex; flex-direction: column; gap: 0.35rem; }
.auth-form label {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
  font-weight: 500;
}
.auth-form input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: var(--sans);
  font-size: 0.92rem;
  background: var(--lighter);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--black);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.auth-form input:focus {
  border-color: var(--blue);
  background: var(--white);
}
html[data-theme="dark"] .auth-form input {
  background: rgba(255,255,255,0.06);
  color: var(--black);
}
html[data-theme="dark"] .auth-form input:focus {
  background: rgba(255,255,255,0.1);
}

.auth-submit {
  width: 100%;
  padding: 0.95rem 1.2rem;
  margin-top: 0.5rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--white);
  background: var(--black);
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.25s, transform 0.15s;
}
.auth-submit:hover {
  background: var(--blue);
}
.auth-submit:disabled {
  opacity: 0.55; cursor: not-allowed;
}
.auth-submit:disabled:hover { background: var(--black); }
html[data-theme="dark"] .auth-submit { background: #ebe7e1; color: #111; }
html[data-theme="dark"] .auth-submit:hover { background: var(--blue); color: #fff; }

.auth-feedback {
  font-family: var(--sans);
  font-size: 0.78rem;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  display: none;
  line-height: 1.5;
}
.auth-feedback.error {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  border: 1px solid rgba(220, 38, 38, 0.18);
  display: block;
}
.auth-feedback.success {
  background: rgba(34, 197, 94, 0.08);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.18);
  display: block;
}

.auth-footnote {
  font-family: var(--sans);
  font-size: 0.72rem;
  color: var(--mid);
  text-align: center;
  margin-top: 1.4rem;
  line-height: 1.5;
}
.auth-footnote a {
  color: var(--blue);
  text-decoration: none;
}
.auth-footnote a:hover { text-decoration: underline; }

/* ── Account dropdown (logged-in state) ─────────────────── */
.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  min-width: 240px;
  padding: 0.9rem;
  display: none;
  z-index: 9999;
  animation: dropFadeIn 0.18s ease-out;
}
.account-dropdown.open { display: block; }
.account-dropdown .dd-header {
  padding: 0.4rem 0.6rem 0.9rem;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  margin-bottom: 0.6rem;
}
.account-dropdown .dd-name {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--black);
}
.account-dropdown .dd-email {
  font-family: var(--sans);
  font-size: 0.74rem;
  color: var(--mid);
  margin-top: 2px;
  word-break: break-all;
}
.account-dropdown button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0.55rem 0.6rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--black);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s;
}
.account-dropdown button:hover { background: var(--lighter); }
.account-dropdown button.danger { color: #b91c1c; }

@keyframes dropFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Nav account wrapper */
.nav-account-wrap { position: relative; }

/* Mobile menu auth section */
.mobile-auth {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0,0,0,0.1);
  display: flex; flex-direction: column; gap: 0.6rem;
}
.mobile-auth button {
  width: 100%;
  padding: 0.8rem 1.2rem;
  background: transparent;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--black);
  cursor: pointer;
}
.mobile-auth button.primary {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}
html[data-theme="dark"] .mobile-auth button {
  border-color: rgba(255,255,255,0.2);
}

/* Responsive modal sizing */
.auth-modal-backdrop {
  overflow-y: auto;
  overscroll-behavior: contain;
}
.auth-modal {
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

@media (max-width: 768px) {
  .auth-modal-backdrop {
    padding: 1rem;
  }
  .auth-modal {
    padding: 2rem 1.5rem 1.6rem;
    border-radius: 14px;
    max-width: calc(100% - 2rem);
  }
  .auth-title { font-size: 1.6rem; }
  .auth-subtitle { font-size: 0.8rem; }
  .auth-form { gap: 0.8rem; }
}

@media (max-width: 480px) {
  .auth-modal-backdrop {
    padding: 0.75rem;
  }
  .auth-modal {
    padding: 1.6rem 1.2rem 1.4rem;
    border-radius: 12px;
    max-width: 100%;
    max-height: calc(100vh - 1.5rem);
  }
  .auth-title { font-size: 1.4rem; margin-bottom: 0.3rem; }
  .auth-subtitle { font-size: 0.75rem; margin-bottom: 1.2rem; }
  .auth-eyebrow { margin-bottom: 0.4rem; }
  .auth-tabs { margin-bottom: 1.2rem; }
  .auth-form { gap: 0.65rem; }
  .auth-form input,
  .auth-form button {
    font-size: 16px;
  }
  .auth-close {
    width: 28px;
    height: 28px;
    font-size: 0.95rem;
  }
}
