/* =====================================================================
   Authentication Forms & Header Account Popover
   ===================================================================== */

/* =====================================================================
   Shared Form Controls
   ===================================================================== */

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-form h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-main, #16181b);
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field span {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main, #16181b);
}

.auth-field input {
  padding: 11px 14px;
  border: 1px solid var(--border-subtle, #edebe6);
  border-radius: 10px;
  font: inherit;
  font-size: 16px;                              /* Prevents iOS auto-zoom */
  background: #ffffff;
  color: var(--text-main, #16181b);
  outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: all 0.15s ease;
}

.auth-field input:focus-visible {
  border-color: var(--accent, #4f46e5);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* Error Banner */
.auth-error {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #b91c1c;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Primary Submit Button */
.auth-form .btn-primary {
  padding: 12px;
  border: none;
  border-radius: 10px;                          /* Modern rect instead of 999px */
  background: var(--accent, #4f46e5);
  color: #ffffff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.25);
  transition: all 0.15s ease;
}

.auth-form .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  filter: brightness(1.04);
}

.auth-form .btn-primary:active {
  transform: translateY(0);
}

.auth-form.busy .btn-primary {
  opacity: 0.65;
  cursor: progress;
}

.auth-switch {
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted, #656f77);
}

.auth-switch a {
  color: var(--accent, #4f46e5);
  font-weight: 600;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* =====================================================================
   Full Screen Auth Page
   ===================================================================== */

.auth-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg-app, #fcfcfb);
}

.auth-card {
  width: min(400px, 100%);
  display: grid;
  gap: 24px;
}

.auth-brand {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--text-main, #16181b);
  text-decoration: none;
}

/* =====================================================================
   Side Panel (Slide-in Auth Drawer)
   ===================================================================== */

.auth-panel {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(420px, 100vw);
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: calc(56px + env(safe-area-inset-top)) 24px 24px;
  border: none;
  border-inline-start: 1px solid var(--border-subtle, #edebe6);
  background: #ffffff;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
  overflow-y: auto;
}

.auth-panel::backdrop {
  background: rgba(10, 12, 16, 0.35);
  backdrop-filter: blur(4px);
}

.auth-panel .close-btn {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
}

.auth-panel-note {
  margin: 0 0 18px;
  font-size: 0.9rem;
  color: var(--text-muted, #656f77);
  line-height: 1.45;
}

@media (prefers-reduced-motion: no-preference) {
  .auth-panel[open] {
    animation: auth-panel-in 240ms cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@keyframes auth-panel-in {
  from { transform: translateX(100%); }
  to { transform: none; }
}

@media (max-width: 599px) {
  .auth-panel {
    width: 100vw;
    box-shadow: none;
  }
}

/* =====================================================================
   Registration Extras
   ===================================================================== */

.auth-field small {
  font-size: 0.8rem;
  color: var(--text-muted, #656f77);
}

.auth-field input[aria-invalid="true"] {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.auth-legal {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted, #656f77);
  line-height: 1.4;
}

.auth-legal a {
  color: var(--text-main, #16181b);
  text-decoration: underline;
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-main, #16181b);
  cursor: pointer;
}

.auth-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent, #4f46e5);
}

/* =====================================================================
   Header Account Menu Popover
   ===================================================================== */

account-menu {
  position: relative;
  display: inline-block;
}

.account-button {
  display: block;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.account-button:hover {
  transform: scale(1.05);
}

.account-button img {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-subtle, #edebe6);
}

.account-button:focus-visible {
  outline: 2px solid var(--accent, #4f46e5);
  outline-offset: 2px;
}

/* Popover card */
.account-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 100;
  min-width: 240px;
  padding: 8px 0;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--border-subtle, #edebe6);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
}

.account-who {
  display: grid;
  padding: 8px 16px 10px;
}

.account-who strong {
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--text-main, #16181b);
}

.account-who span {
  font-size: 0.85rem;
  color: var(--text-muted, #656f77);
}

.account-popover hr {
  margin: 6px 0;
  border: none;
  border-top: 1px solid var(--border-subtle, #edebe6);
}

.account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 16px;
  border: none;
  background: none;
  color: var(--text-main, #16181b);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.account-item:hover,
.account-item:focus-visible {
  background: rgba(22, 24, 27, 0.04);
  outline: none;
}

@media (prefers-color-scheme: dark) {
  .account-popover {
    background: #16181c;
    border-color: #2a2e35;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
  }
  .account-item:hover,
  .account-item:focus-visible {
    background: rgba(231, 233, 234, 0.08);
  }
}