/* ==========================================================================
   elektromekka.com — auth UI (Phase 2)
   Header account button + account drawer (login, signup, forgot/reset,
   profile, artist application). Built on the shared tokens in styles.css;
   form fields reuse .field / .input / .textarea / .btn from there.
   Mobile: bottom sheet (same gesture language as the now-playing sheet).
   Desktop (≥760px): right-edge drawer.
   ========================================================================== */

/* ---- Header account button ---------------------------------------------- */

.site-header .tagline { margin-left: auto; }

.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.account-btn:hover { border-color: var(--border-strong); }
.account-btn[hidden] { display: none; }

/* logged in: the button collapses to a quiet avatar circle */
.account-btn.is-user {
  padding: 0;
  min-height: 0;
  border: 0;
  background: transparent;
}
.account-btn__label[hidden] { display: none; }
.account-btn__avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--violet-dim);
  border: 1px solid var(--border-strong);
  color: var(--violet-text);
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
}
.account-btn__avatar[hidden] { display: none; }
.account-btn.is-user:hover .account-btn__avatar {
  border-color: var(--lime);
  color: var(--lime);
}

/* phones: tagline drops to its own row, the button stays beside the logo */
@media (max-width: 599px) {
  .site-header .account-btn { order: 2; margin-left: auto; }
  .site-header .tagline { order: 3; flex-basis: 100%; margin-left: 0; padding-top: 0; }
}

/* ---- Drawer shell -------------------------------------------------------- */

.authsheet {
  position: fixed;
  inset: 0;
  z-index: 90; /* above the now-playing sheet (80) */
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.authsheet[hidden] { display: none; }

body.auth-open { overflow: hidden; }

.authsheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.78);
  opacity: 0;
  transition: opacity 240ms ease;
}

.authsheet__panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100% - 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  padding: 10px 24px calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 18px;
  transform: translateY(100%);
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.authsheet.is-open .authsheet__backdrop { opacity: 1; }
.authsheet.is-open .authsheet__panel { transform: translateY(0); }

.authsheet__grip {
  flex: 0 0 auto;
  width: 40px;
  height: 4px;
  margin: 2px auto 0;
  border-radius: 999px;
  background: var(--border-strong);
}

.authsheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.authsheet__eyebrow { font-size: 10px; }
.authsheet__close {
  flex: none;
  width: 36px;
  height: 36px;
  margin-right: -8px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.authsheet__close:hover { color: var(--text); }

.authsheet__title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* desktop and tablet: right-edge drawer, full height */
@media (min-width: 760px) {
  .authsheet { align-items: stretch; justify-content: flex-end; }
  .authsheet__panel {
    width: min(440px, calc(100% - 48px));
    max-width: none;
    max-height: none;
    height: 100%;
    border-radius: 0;
    border: 0;
    border-left: 1px solid var(--border);
    padding: 20px 28px 28px;
    transform: translateX(100%);
  }
  .authsheet.is-open .authsheet__panel { transform: translateX(0); }
  .authsheet__grip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .authsheet__backdrop, .authsheet__panel { transition: none; }
}

/* ---- Views + forms ------------------------------------------------------- */

.auth-view { display: flex; flex-direction: column; gap: 16px; }
.auth-view[hidden] { display: none; }

.auth-form { display: flex; flex-direction: column; gap: 14px; margin: 0; }

.auth-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}
.auth-hint--warn { color: var(--warn); }

.field__hint { font-size: 12px; color: var(--placeholder); }

/* status line under a form (errors + confirmations) */
.auth-form__status {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--danger);
}
.auth-form__status.is-ok { color: var(--lime); }
.auth-form__status[hidden] { display: none; }

/* top-of-drawer notice (verified / link expired …) */
.auth-notice {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid rgba(198, 255, 0, 0.35);
  border-radius: var(--radius);
  background: rgba(198, 255, 0, 0.07);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
.auth-notice.is-warn {
  border-color: rgba(255, 138, 128, 0.4);
  background: rgba(255, 138, 128, 0.08);
}
.auth-notice[hidden] { display: none; }

/* quiet text links under the forms */
.auth-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding-top: 2px;
}
.auth-link {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 13px;
  color: var(--lime);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-align: left;
}
.auth-link:hover { color: var(--text); }

.auth-message { margin: 0; font-size: 15px; line-height: 1.6; }

/* ---- Profile ------------------------------------------------------------- */

.auth-user {
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-user__avatar {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--violet-dim);
  border: 1px solid var(--border-strong);
  color: var(--violet-text);
  font-weight: 700;
  font-size: 20px;
}
.auth-user__meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.auth-user__name {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-user__email {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-badge {
  flex: none;
  font-family: var(--font-label);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--lime);
  background: rgba(198, 255, 0, 0.08);
  border-radius: 999px;
  padding: 5px 10px;
}
.auth-badge[hidden] { display: none; }

/* display-name row: input + save side by side */
.auth-form--row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.auth-form--row .field { flex: 1 1 200px; }
.auth-form--row .btn { flex: none; }
.auth-form--row .auth-form__status { flex-basis: 100%; }

/* collapsible sections (password change, artist, delete) */
.auth-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-3);
}
.auth-section__summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  -webkit-user-select: none;
  user-select: none;
}
.auth-section__summary::-webkit-details-marker { display: none; }
.auth-section__summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 400;
  font-size: 16px;
  line-height: 1;
}
.auth-section[open] .auth-section__summary::after { content: "–"; }
.auth-section__body { padding: 2px 16px 16px; }
.auth-section--danger { border-color: rgba(255, 138, 128, 0.35); }
.auth-section--danger .auth-section__summary { color: var(--danger); }

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.auth-actions .btn { flex: 1 1 auto; justify-content: center; text-align: center; }
.auth-actions a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

.auth-btn--danger { border-color: rgba(255, 138, 128, 0.4); color: var(--danger); }
.auth-btn--danger:hover { border-color: var(--danger); color: var(--danger); }

/* artist box (content built by js/auth-ui.js) */
.auth-artist { display: flex; flex-direction: column; gap: 12px; }
.auth-artist .btn { align-self: flex-start; text-decoration: none; }

/* a busy form dims slightly while its request is in flight */
.auth-form.is-busy { opacity: 0.65; pointer-events: none; }
