/*
 * auth.css — AnimeHay Auth Design System
 * Dùng chung cho: login, register, forgot-password, reset-password
 * Tokens: phụ thuộc vào --ah-* từ modern.css, nhưng self-contained nếu cần
 */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Auth page layout ── */
.auth-page {
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
}
.auth-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at top left,    rgba(220, 38, 38, .10) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(124, 58, 237, .08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ── Card ── */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(13, 13, 20, 0.92);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 24px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .04),
    0 32px 64px rgba(0, 0, 0, .65),
    0 8px 24px rgba(0, 0, 0, .4);
  backdrop-filter: blur(24px);
  position: relative;
  z-index: 1;
  animation: authCardIn .38s cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(22px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* ── Header ── */
.auth-header {
  padding: 34px 36px 26px;
  background: linear-gradient(135deg, #180505 0%, #0c0c1a 100%);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.auth-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 25% 60%, rgba(239, 68, 68, .20) 0%, transparent 55%),
    radial-gradient(circle at 78% 38%, rgba(124, 58, 237, .13) 0%, transparent 55%);
  pointer-events: none;
}
.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #ef4444, #f97316, #eab308);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  z-index: 1;
  text-decoration: none;
}
.auth-logo svg { flex-shrink: 0; }
.auth-subtitle {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, .42);
  position: relative;
  z-index: 1;
}

/* ── Tabs (dùng cho switch login↔register) ── */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  background: rgba(0, 0, 0, .25);
}
.auth-tab {
  flex: 1;
  padding: 13px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, .35);
  cursor: pointer;
  transition: color .2s, border-bottom-color .2s;
  border-bottom: 2px solid transparent;
  letter-spacing: .2px;
}
.auth-tab.active {
  color: #fff;
  border-bottom-color: #ef4444;
}
.auth-tab:hover:not(.active) { color: rgba(255, 255, 255, .65); }

/* ── Body ── */
.auth-body { padding: 26px 32px 30px; }

/* ── Alert ── */
.auth-alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 18px;
  line-height: 1.5;
  animation: authAlertIn .22s ease both;
}
@keyframes authAlertIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: none; }
}
.auth-alert.show { display: flex; }
.auth-alert.is-error   { background: rgba(239,68,68,.11); border: 1px solid rgba(239,68,68,.28); color: #fca5a5; }
.auth-alert.is-success { background: rgba(34,197,94,.11); border: 1px solid rgba(34,197,94,.28); color: #86efac; }
.auth-alert.is-info    { background: rgba(99,102,241,.11); border: 1px solid rgba(99,102,241,.28); color: #a5b4fc; }
.auth-alert-icon { font-size: 17px; flex-shrink: 0; line-height: 1; margin-top: 2px; }

/* ── Field ── */
.auth-field { margin-bottom: 16px; }
.auth-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, .38);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 7px;
}
.auth-label a {
  font-size: 11.5px;
  color: rgba(255, 255, 255, .35);
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  transition: color .15s;
}
.auth-label a:hover { color: #ef4444; }

/* ── Input ── */
.auth-input-wrap { position: relative; }
.auth-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, .28);
  font-size: 17px;
  pointer-events: none;
  transition: color .2s;
  z-index: 1;
}
.auth-input {
  width: 100%;
  background: rgba(255, 255, 255, .05);
  border: 1.5px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  color: #fff;
  font-family: inherit;
  font-size: 14.5px;
  padding: 13px 44px 13px 44px;
  transition: border-color .2s, background .2s, box-shadow .2s;
  outline: none;
}
.auth-input.no-icon { padding-left: 16px; }
.auth-input.has-action { padding-right: 48px; }
.auth-input::placeholder { color: rgba(255, 255, 255, .2); }
.auth-input:focus {
  border-color: rgba(239, 68, 68, .55);
  background: rgba(239, 68, 68, .05);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .10);
}
.auth-input:focus ~ .auth-input-icon { color: rgba(239, 68, 68, .65); }
.auth-input.is-error { border-color: rgba(239, 68, 68, .5) !important; }
.auth-input.is-ok    { border-color: rgba(34, 197, 94, .4); }

/* action button inside input (toggle pw etc) */
.auth-input-action {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: rgba(255, 255, 255, .28);
  font-size: 17px;
  transition: color .2s;
  user-select: none;
  background: none;
  border: none;
  padding: 2px;
  line-height: 1;
}
.auth-input-action:hover { color: rgba(255, 255, 255, .7); }

/* ── Password Strength ── */
.auth-strength {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}
.auth-strength__bars {
  display: flex;
  gap: 4px;
  flex: 1;
}
.auth-strength__bar {
  flex: 1;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .08);
  transition: background .3s;
}
.auth-strength__bar.on-weak   { background: #ef4444; }
.auth-strength__bar.on-fair   { background: #f97316; }
.auth-strength__bar.on-strong { background: #22c55e; }
.auth-strength__label {
  font-size: 10.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, .3);
  min-width: 50px;
  text-align: right;
  transition: color .3s;
}
.auth-strength__label.weak   { color: #ef4444; }
.auth-strength__label.fair   { color: #f97316; }
.auth-strength__label.strong { color: #22c55e; }

/* ── Checkbox (Remember me) ── */
.auth-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.auth-checkbox {
  width: 16px;
  height: 16px;
  accent-color: #ef4444;
  cursor: pointer;
  flex-shrink: 0;
}
.auth-checkbox-label {
  font-size: 13px;
  color: rgba(255, 255, 255, .45);
  cursor: pointer;
  user-select: none;
}

/* ── Submit button ── */
.auth-submit {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .2px;
  color: #fff;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 20px rgba(239, 68, 68, .32), 0 1px 0 rgba(255, 255, 255, .08) inset;
  transition: transform .15s, box-shadow .15s, opacity .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  margin-top: 4px;
}
.auth-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, .1), transparent);
  opacity: 0;
  transition: opacity .2s;
}
.auth-submit:hover:not(:disabled)::before { opacity: 1; }
.auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(239, 68, 68, .42), 0 1px 0 rgba(255, 255, 255, .08) inset;
}
.auth-submit:active:not(:disabled) { transform: translateY(0); }
.auth-submit:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ── Spinner ── */
.auth-spin {
  width: 17px; height: 17px;
  border: 2.5px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin .65s linear infinite;
  flex-shrink: 0;
  display: none;
}
@keyframes authSpin { to { transform: rotate(360deg); } }
.auth-submit.loading .auth-spin { display: block; }
.auth-submit.loading .auth-btn-text { display: none; }

/* ── Divider ── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: 11px;
  color: rgba(255, 255, 255, .2);
  font-weight: 600;
  letter-spacing: .8px;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, .06);
}

/* ── Google button ── */
.auth-google {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, .05);
  border: 1.5px solid rgba(255, 255, 255, .09);
  border-radius: 12px;
  color: rgba(255, 255, 255, .8);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background .2s, border-color .2s;
}
.auth-google:hover { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .18); }
.auth-google:disabled { opacity: .6; cursor: not-allowed; }
.auth-google img { width: 19px; height: 19px; }

/* Google renderButton wrapper */
.auth-google-wrap {
  display: flex;
  justify-content: center;
  min-height: 44px;
}
.auth-google-wrap #gsi-btn-container {
  width: 100%;
  display: flex;
  justify-content: center;
}
/* Google iframe scales to fit */
.auth-google-wrap #gsi-btn-container iframe {
  border-radius: 12px !important;
}

/* ── Footer links ── */
.auth-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, .05);
  gap: 8px;
  flex-wrap: wrap;
}
.auth-footer a {
  font-size: 13px;
  color: rgba(255, 255, 255, .32);
  text-decoration: none;
  transition: color .15s;
  font-weight: 500;
}
.auth-footer a:hover { color: rgba(255, 255, 255, .7); }
.auth-footer .auth-link-accent { color: #ef4444; }
.auth-footer .auth-link-accent:hover { color: #f87171; }

/* ── Success state (sent email, reset done) ── */
.auth-success-state {
  text-align: center;
  padding: 12px 0 8px;
  display: none;
}
.auth-success-state.show { display: block; }
.auth-success-state__icon {
  font-size: 52px;
  display: block;
  margin: 0 auto 16px;
  animation: authSuccessIcon .5s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes authSuccessIcon {
  from { opacity: 0; transform: scale(.5) rotate(-10deg); }
  to   { opacity: 1; transform: none; }
}
.auth-success-state__title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}
.auth-success-state__desc {
  font-size: 13px;
  color: rgba(255, 255, 255, .45);
  line-height: 1.6;
}
.auth-success-state__desc strong { color: rgba(255, 255, 255, .7); }

/* ── hCaptcha container ── */
.auth-captcha {
  display: flex;
  justify-content: center;
  margin: 4px 0 16px;
}

/* ── Field hint ── */
.auth-field-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, .28);
  margin-top: 5px;
  line-height: 1.4;
}
.auth-field-hint.is-error { color: #fca5a5; }
.auth-field-hint.is-ok    { color: #86efac; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .auth-body   { padding: 20px 20px 24px; }
  .auth-header { padding: 26px 20px 22px; }
  .auth-card   { border-radius: 20px; }
  .auth-logo   { font-size: 24px; }
}
