/* ============================================
   AUTH PAGES — Đăng nhập / Đăng ký / Chờ duyệt
   ============================================ */

.auth-body {
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 50%, #E0F2FE 100%);
  min-height: 100vh;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-container {
  width: 100%;
  max-width: 440px;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.auth-container-wide {
  max-width: 560px;
}

/* -- Brand / Logo -- */
.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo {
  width: 60px; height: 60px;
  background: #fff;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 4px 16px rgba(37,99,235,0.15);
}
.auth-brand-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.auth-brand-sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* -- Card -- */
.auth-card {
  background: var(--bg-surface);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(37,99,235,0.12);
  animation: authCardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.auth-card-wide { max-width: 560px; }
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
  color: var(--text-primary);
}

/* -- Back link -- */
.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  margin-bottom: 20px;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}
.auth-back-link:hover { text-decoration: underline; }

/* -- Alert / Error -- */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  line-height: 1.5;
}
.auth-alert-error {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA;
}
.auth-alert-warning {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}
.auth-alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.shake { animation: authShake 0.4s ease; }
@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  60% { transform: translateX(8px); }
}

/* -- Fields -- */
.auth-field { margin-bottom: 18px; }
.auth-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.auth-label small { color: var(--text-muted); font-weight: 400; }
.required { color: var(--danger); }

.auth-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  transition: all var(--transition);
  gap: 10px;
}
.auth-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.auth-input-readonly {
  background: #F1F5F9;
  border-color: #E2E8F0;
}
.auth-input-icon { color: var(--text-muted); flex-shrink: 0; display: flex; }
.auth-input {
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-primary);
  padding: 12px 0;
  width: 100%;
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-input[readonly] { color: var(--text-secondary); cursor: default; }

.auth-readonly-badge {
  font-size: 0.7rem;
  background: var(--primary-100);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.auth-eye-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  transition: color var(--transition);
}
.auth-eye-btn:hover { color: var(--text-primary); }

.auth-field-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.auth-field-hint.error { color: var(--danger); }

.auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* -- Remember checkbox -- */
.auth-remember { margin-bottom: 20px; }
.auth-checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  user-select: none;
}
.auth-checkbox-wrap input[type="checkbox"] { display: none; }
.auth-checkbox-custom {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  position: relative;
}
.auth-checkbox-wrap input:checked + .auth-checkbox-custom {
  background: var(--primary);
  border-color: var(--primary);
}
.auth-checkbox-wrap input:checked + .auth-checkbox-custom::after {
  content: '';
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}
.auth-checkbox-wrap input:disabled + .auth-checkbox-custom {
  opacity: 0.4;
}

/* -- Buttons -- */
.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 24px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  text-align: center;
}
.auth-btn-primary {
  background: var(--primary);
  color: #fff;
}
.auth-btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.auth-btn-primary:disabled {
  background: #94A3B8;
  cursor: not-allowed;
  transform: none;
}
.auth-btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.auth-btn-outline:hover { background: var(--primary-50); }
.auth-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.auth-btn-ghost:hover { background: #F1F5F9; }

.auth-btn.loading .auth-btn-text { visibility: hidden; }
.auth-btn.loading .auth-btn-loading { display: inline-block !important; }
.auth-btn-loading {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin 0.8s linear infinite;
  position: absolute;
}
@keyframes authSpin { to { transform: rotate(360deg); } }
.auth-btn { position: relative; }

.auth-btn-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.auth-btn-row .auth-btn { flex: 1; }

/* -- Divider -- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.auth-switch-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* -- Footer -- */
.auth-footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 24px;
}

/* =====================
   STEPPER (Đăng ký)
   ===================== */
.auth-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 24px;
  width: 100%;
  max-width: 400px;
}
.auth-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.auth-step span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}
.auth-step.active span { color: var(--primary); }
.auth-step-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #E2E8F0;
  color: #94A3B8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.3s ease;
}
.auth-step.active .auth-step-dot {
  background: var(--primary);
  color: #fff;
  animation: stepPulse 0.3s ease;
}
.auth-step.completed .auth-step-dot {
  background: var(--success);
  color: #fff;
}
@keyframes stepPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.auth-step-line {
  width: 60px;
  height: 2px;
  background: #E2E8F0;
  margin: 0 8px;
  margin-bottom: 22px;
  transition: background 0.3s ease;
}
.auth-step-line.active { background: var(--primary); }

/* =====================
   NỘI QUY (Bước 2)
   ===================== */
.auth-rules-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.auth-rules-header h3 { font-size: 1rem; font-weight: 700; margin-bottom: 2px; }
.auth-rules-header p { font-size: 0.82rem; color: var(--text-secondary); }

.auth-rules-box {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
  background: #F8FAFC;
  scroll-behavior: smooth;
}
.auth-rules-box::-webkit-scrollbar { width: 6px; }
.auth-rules-box::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.auth-rule-section { margin-bottom: 20px; }
.auth-rule-section:last-child { margin-bottom: 0; }
.auth-rule-section h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.auth-rule-section ul {
  list-style: none;
  padding: 0;
}
.auth-rule-section li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.auth-rule-section li::before {
  content: '\2022';
  position: absolute;
  left: 6px;
  color: var(--primary);
  font-weight: 700;
}

.auth-rules-scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--warning);
  font-weight: 600;
  margin-bottom: 12px;
  animation: bounceHint 2s ease infinite;
}
@keyframes bounceHint {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

.auth-rules-check {
  margin-bottom: 0;
  padding: 12px 16px;
  background: #F1F5F9;
  border-radius: 12px;
  border: 1.5px solid transparent;
  transition: all var(--transition);
}
.auth-rules-check.enabled {
  background: var(--primary-50);
  border-color: var(--primary-200);
}

/* =====================
   HOÀN TẤT (Bước 3)
   ===================== */
.auth-success-content {
  text-align: center;
  padding: 16px 0;
}
.auth-success-icon {
  width: 64px; height: 64px;
  background: var(--success);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 16px;
  animation: successBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes successBounce {
  from { transform: scale(0) rotate(-180deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
.auth-success-content h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.auth-success-greeting { font-size: 1rem; color: var(--text-secondary); margin-bottom: 4px; }
.auth-success-code {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 24px;
}

.auth-pending-box {
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
  text-align: center;
}
.auth-pending-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  animation: pendingPulse 2s ease-in-out infinite;
}
@keyframes pendingPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
}
.auth-pending-box h3 { font-size: 0.95rem; font-weight: 700; color: #92400E; margin-bottom: 8px; }
.auth-pending-box p { font-size: 0.85rem; color: #92400E; line-height: 1.6; }

/* =====================
   PENDING PAGE
   ===================== */
.auth-pending-content {
  text-align: center;
  padding: 12px 0;
}
.auth-pending-icon-lg {
  font-size: 3rem;
  margin-bottom: 12px;
  animation: pendingPulse 2s ease-in-out infinite;
}
.auth-pending-content h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.auth-pending-name {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.auth-pending-status-box {
  background: #F8FAFC;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
  text-align: left;
}
.auth-pending-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-light);
}
.auth-pending-status-row:last-of-type { border-bottom: none; }
.auth-pending-label { color: var(--text-secondary); }
.auth-status-badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.auth-status-badge.pending { background: #FEF3C7; color: #92400E; }
.auth-status-badge.active { background: #D1FAE5; color: #065F46; }

.auth-pending-info-text {
  padding-top: 16px;
  text-align: center;
}
.auth-pending-info-text p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}
.auth-pending-phone {
  font-size: 0.9rem;
  color: var(--primary);
}

.auth-pending-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.auth-pending-actions .auth-btn { flex: 1; }

.auth-pending-auto-text {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* =====================
   RESPONSIVE
   ===================== */
@media (max-width: 600px) {
  .auth-container { padding: 24px 16px; }
  .auth-card { padding: 24px 20px; border-radius: 16px; }
  .auth-row { grid-template-columns: 1fr; }
  .auth-stepper { gap: 0; }
  .auth-step-line { width: 40px; }
  .auth-btn-row { flex-direction: column; }
  .auth-pending-actions { flex-direction: column; }
}