/* ============================================================
   AUTH STYLES — shared across auth pages + homepage header
   ============================================================ */

/* ============ PASSWORD TOGGLE VISIBILITY FIX ============ */
.pw-toggle .icon-eye-off { display: none; }
.pw-toggle.showing .icon-eye-off { display: inline-block; }
.pw-toggle.showing .icon-eye { display: none; }

/* ============ HEADER AUTH SLOT (homepage) ============ */
.header-auth-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
}

.header-signin-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.header-signin-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.header-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  max-width: 240px;
}

.header-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 800;
  flex-shrink: 0;
  text-transform: uppercase;
}

.header-user-email {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 4px;
}

.header-user-logout {
  background: none;
  border: none;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.header-user-logout:hover {
  background: var(--danger);
  color: #fff;
}

@media (max-width: 640px) {
  .header-signin-btn { padding: 6px 12px; font-size: .78rem; }
  .header-user { max-width: 160px; padding: 3px; }
  .header-user-avatar { width: 24px; height: 24px; font-size: .7rem; }
  .header-user-email { display: none; }
  .header-user-logout { padding: 4px 8px; font-size: .72rem; }
}

@media (max-width: 420px) {
  .header-signin-btn { padding: 5px 10px; font-size: .74rem; }
}

/* ============ SHARED AUTH HEADER LINK ============ */
.header-auth-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.header-auth-link:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}
@media (max-width: 640px) {
  .header-auth-link { padding: 6px 10px; font-size: .76rem; }
}
@media (max-width: 480px) {
  .header-auth-link { display: none; }
}

/* ============ AUTH PAGE LAYOUT ============ */
.auth-main {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 60px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
  animation: authFade .35s ease;
}

@keyframes authFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .auth-main { padding: 24px 14px 40px; }
  .auth-card { padding: 24px 20px; border-radius: 14px; }
}

/* ============ AUTH HEADER ============ */
.auth-header {
  text-align: center;
  margin-bottom: 24px;
}
.auth-header h1 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0 0 6px;
  color: var(--text);
}
.auth-header p {
  margin: 0;
  font-size: .88rem;
  color: var(--text-muted);
}

/* ============ AUTH FORM ============ */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.auth-field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: .95rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.auth-field input.invalid {
  border-color: var(--danger);
}

.auth-hint {
  font-size: .74rem;
  color: var(--text-muted);
  margin: 0;
}
.auth-hint.invalid { color: var(--danger); }

/* ============ PASSWORD WRAP + TOGGLE ============ */
.password-wrap {
  position: relative;
  display: flex;
}
.password-wrap input {
  padding-right: 44px;
}
.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background .15s, color .15s;
}
.pw-toggle:hover {
  background: var(--bg-soft);
  color: var(--text);
}

/* ============ ERROR / SUCCESS ============ */
.auth-error,
.auth-success {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .82rem;
  font-weight: 500;
  line-height: 1.4;
}
.auth-error {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
}
.auth-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}

/* ============ SUBMIT BUTTON ============ */
.auth-submit {
  position: relative;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  font-size: .95rem;
}
.auth-submit:disabled {
  opacity: .7;
  cursor: not-allowed;
}
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinAuth .7s linear infinite;
}
@keyframes spinAuth { to { transform: rotate(360deg); } }

/* ============ LINKS ============ */
.auth-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  font-size: .82rem;
  color: var(--text-muted);
  text-align: center;
}
.auth-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.auth-links a:hover { text-decoration: underline; }
.auth-divider { color: var(--text-muted); opacity: .5; }

.auth-guest {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: .82rem;
}
.auth-guest a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s;
}
.auth-guest a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ============ HIDDEN UTILITY ============ */
.auth-error.hidden,
.auth-success.hidden,
.btn-spinner.hidden {
  display: none !important;
}
/* ============ PRO BADGE IN HEADER ============ */
.header-user-tier {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b 0%, #ec4899 100%);
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .04em;
  flex-shrink: 0;
}

/* ============================================================
   TOAST — action buttons (must be clickable)
   ============================================================ */
#toast {
  pointer-events: none;
}

#toast.show {
  pointer-events: auto;
}

#toast .toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
  pointer-events: auto;
}

#toast .toast-btn {
  pointer-events: auto;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: .82rem;
  font-weight: 700;
  transition: transform .1s, box-shadow .15s, background .15s;
  white-space: nowrap;
}

#toast .toast-btn:active {
  transform: scale(.96);
}

#toast .toast-btn-primary {
  background: #fff;
  color: #78350f;
}

#toast .toast-btn-primary:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

#toast .toast-btn-secondary {
  background: rgba(255, 255, 255, .2);
  color: #fff;
}

#toast .toast-btn-secondary:hover {
  background: rgba(255, 255, 255, .3);
}

#toast .toast-btn-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .4);
}

#toast .toast-btn-ghost:hover {
  background: rgba(255, 255, 255, .1);
}

#toast .toast-text {
  display: block;
  line-height: 1.4;
}