/* ==========================================================================
   AUTH PAGES — Login / Sign Up / Account
   Follows the Hanaz "The Ordinary" design system
   ========================================================================== */

/* ---- Page shell ---- */
.auth-page {
  min-height: calc(100vh - var(--nav-height) - 240px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) var(--space-lg);
}

/* ---- Auth card ---- */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: var(--space-3xl) var(--space-2xl);
}

.auth-card__eyebrow {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: var(--space-sm);
}

.auth-card__title {
  font-size: clamp(20px, 3vw, 24px);
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: var(--space-xs);
  line-height: 1.2;
}

.auth-card__subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--space-2xl);
  line-height: 1.5;
}

/* ---- Form ---- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.auth-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-heading);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-field input {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-md);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-heading);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
  border-radius: var(--radius);
  transition: border-color var(--duration-fast) ease;
  -webkit-appearance: none;
}

.auth-field input:focus {
  border-color: var(--text-heading);
  background: var(--bg-card);
}

.auth-field input::placeholder {
  color: var(--text-muted);
}

.auth-field input.error {
  border-color: #c0392b;
}

/* Password show/hide toggle */
.auth-pw-toggle {
  position: absolute;
  right: var(--space-md);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 0;
  transition: color var(--duration-fast) ease;
}

.auth-pw-toggle:hover {
  color: var(--text-heading);
}

.auth-pw-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.auth-pw-toggle .icon-eye-off {
  display: none;
}

.auth-pw-toggle.show-pw .icon-eye {
  display: none;
}

.auth-pw-toggle.show-pw .icon-eye-off {
  display: block;
}

/* Field hint / error */
.auth-field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.auth-field-error {
  font-size: 12px;
  color: #c0392b;
  margin-top: 2px;
  display: none;
}

.auth-field-error.visible {
  display: block;
}

/* ---- Forgot password link ---- */
.auth-forgot {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  align-self: flex-end;
  transition: color var(--duration-fast) ease;
  background: none;
  border: none;
  font-family: var(--font-main);
  padding: 0;
  margin-top: -8px;
}

.auth-forgot:hover {
  color: var(--text-heading);
}

/* ---- Submit button ---- */
.auth-submit {
  width: 100%;
  height: 52px;
  background: var(--text-heading);
  color: var(--bg-card);
  border: 1px solid var(--text-heading);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  font-family: var(--font-main);
  transition: background var(--duration-base) ease, color var(--duration-base) ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: var(--space-sm);
}

.auth-submit:hover:not(:disabled) {
  background: var(--bg-card);
  color: var(--text-heading);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-submit .auth-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
  display: none;
  flex-shrink: 0;
}

.auth-submit.loading .auth-spinner {
  display: block;
}

.auth-submit.loading .auth-btn-text {
  opacity: 0.7;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* ---- Global message (success / error) ---- */
.auth-message {
  padding: var(--space-md);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  display: none;
  align-items: flex-start;
  gap: var(--space-sm);
  border: 1px solid transparent;
}

.auth-message.visible {
  display: flex;
}

.auth-message.success {
  background: #f0faf4;
  border-color: #a8d8b9;
  color: #1a6636;
}

.auth-message.error {
  background: #fff5f5;
  border-color: #f5c6cb;
  color: #c0392b;
}

.auth-message svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ---- Switch link (Login ↔ Sign Up) ---- */
.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.auth-switch a {
  color: var(--text-heading);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-switch a:hover {
  opacity: 0.7;
}

/* ---- Forgot password inline panel ---- */
.auth-forgot-panel {
  display: none;
  flex-direction: column;
  gap: var(--space-md);
  border-top: 1px solid var(--border);
  padding-top: var(--space-lg);
  margin-top: var(--space-md);
}

.auth-forgot-panel.visible {
  display: flex;
}

.auth-forgot-panel p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.auth-back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-main);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
  align-self: flex-start;
  transition: color var(--duration-fast) ease;
}

.auth-back-btn:hover {
  color: var(--text-heading);
}

/* ---- Account Page ---- */
.account-page {
  min-height: calc(100vh - var(--nav-height) - 240px);
  padding: var(--space-3xl) var(--space-lg);
}

.account-page .container {
  max-width: 800px;
}

.account-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.account-header h1 {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 500;
  color: var(--text-heading);
  margin-bottom: var(--space-xs);
}

.account-header p {
  font-size: 14px;
  color: var(--text-muted);
}

/* Account grid of sections */
.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

@media (max-width: 640px) {
  .account-grid {
    grid-template-columns: 1fr;
  }
}

.account-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: var(--space-xl);
}

.account-section--full {
  grid-column: 1 / -1;
}

.account-section__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: var(--space-md);
}

.account-section__value {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-heading);
  line-height: 1.4;
}

.account-section__sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Avatar / Initials badge */
.account-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--text-heading);
  color: var(--bg-card);
  font-size: 22px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.account-profile-row {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.account-profile-info h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 4px;
}

.account-profile-info p {
  font-size: 14px;
  color: var(--text-muted);
}

/* Coming soon placeholder cards */
.account-section--coming {
  opacity: 0.45;
  cursor: default;
}

.account-section--coming .account-section__label {
  margin-bottom: var(--space-sm);
}

.account-section--coming .coming-badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  margin-top: var(--space-sm);
}

/* Logout button */
.account-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 var(--space-xl);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  color: var(--text-heading);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all var(--duration-base) ease;
}

.account-logout-btn:hover {
  background: #fff5f5;
  border-color: #f5c6cb;
  color: #c0392b;
}

.account-logout-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

/* Nav auth link (used by auth.js to style the account icon) */
.nav-auth-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-heading);
}

.nav-auth-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--text-heading);
  color: var(--bg-card);
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  flex-shrink: 0;
}

/* ---- Responsive card ---- */
@media (max-width: 480px) {
  .auth-card {
    padding: var(--space-2xl) var(--space-lg);
    border: none;
    border-top: 1px solid var(--border);
  }

  .auth-page {
    align-items: flex-start;
    padding-top: var(--space-2xl);
  }
}
