/* ===================================================
   AUTH MODAL CSS — Đăng nhập / Đăng ký
   =================================================== */

/* ── Overlay ── */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.auth-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Modal box ── */
.auth-modal {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.18);
  transform: translateY(24px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.34,1.4,0.64,1), opacity 0.25s ease;
  padding-bottom: 32px;
}
.auth-overlay.open .auth-modal {
  transform: translateY(0) scale(1);
}

/* ── Close button ── */
.auth-modal__close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--light);
  border: none;
  font-size: 0.9rem;
  color: var(--mid);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  z-index: 1;
}
.auth-modal__close:hover { background: var(--border); color: var(--dark); }

/* ── Tabs ── */
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0;
}
.auth-tab {
  flex: 1;
  padding: 16px 12px 14px;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--mid);
  cursor: pointer;
  position: relative;
  transition: color var(--transition);
}
.auth-tab::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}
.auth-tab.active { color: var(--primary); }
.auth-tab.active::after { transform: scaleX(1); }
.auth-tab:hover:not(.active) { color: var(--dark); }

/* ── Panels ── */
.auth-panel {
  display: none;
  padding: 24px 28px 0;
}
.auth-panel.active { display: block; }

/* ── Brand inside modal ── */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--primary-lt);
  border-radius: var(--radius);
}
.auth-brand__icon { font-size: 2.2rem; flex-shrink: 0; }
.auth-brand p { font-size: 0.9rem; color: var(--mid); line-height: 1.5; }
.auth-brand strong { color: var(--dark); font-size: 1rem; }

/* ── Form group ── */
.auth-form-group {
  margin-bottom: 16px;
}
.auth-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}
.auth-optional {
  font-weight: 400;
  color: var(--mid);
  font-size: 0.78rem;
}

/* ── Input wrapper ── */
.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input-icon {
  position: absolute;
  left: 12px;
  font-size: 1rem;
  pointer-events: none;
  line-height: 1;
  z-index: 1;
}
.auth-input {
  width: 100%;
  padding: 11px 40px 11px 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--dark);
  background: #fff;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(181,137,106,0.15);
}
.auth-input.invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220,53,69,0.1);
}
.auth-input.valid {
  border-color: #28a745;
}

/* Password eye toggle */
.auth-eye {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--mid);
  padding: 4px;
  display: flex; align-items: center;
  transition: color var(--transition);
}
.auth-eye:hover { color: var(--dark); }

/* Field error */
.auth-field-error {
  display: block;
  font-size: 0.78rem;
  color: #dc3545;
  margin-top: 4px;
  min-height: 16px;
  transition: var(--transition);
}

/* ── Alert (form-level) ── */
#loginAlert, #registerAlert {
  margin-bottom: 14px;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  padding: 0;
}
#loginAlert:not(:empty), #registerAlert:not(:empty) {
  padding: 10px 14px;
}
.auth-alert--error   { background: #fdecea; color: #c62828; border: 1px solid #f5aaaa; }
.auth-alert--success { background: #e9f7ef; color: #1d7a3f; border: 1px solid #a7ddb8; }

/* ── Submit button ── */
.auth-submit {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}
.auth-submit:hover:not(:disabled) {
  background: var(--primary-dk);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(181,137,106,0.3);
}
.auth-submit:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

/* Spinner */
.auth-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Switch link ── */
.auth-switch {
  text-align: center;
  font-size: 0.85rem;
  color: var(--mid);
  margin-top: 18px;
}
.auth-switch__btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font-body);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-switch__btn:hover { color: var(--primary-dk); }

/* ── Password strength indicator ── */
.pwd-strength {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pwd-strength__bars {
  display: flex;
  gap: 3px;
  flex: 1;
}
.pwd-bar {
  height: 3px;
  flex: 1;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s ease;
}
.pwd-bar.weak   { background: #dc3545; }
.pwd-bar.medium { background: #ffc107; }
.pwd-bar.strong { background: #28a745; }
.pwd-strength__label {
  font-size: 0.72rem;
  color: var(--mid);
  white-space: nowrap;
  min-width: 60px;
}

/* ── Success state ── */
.auth-success {
  text-align: center;
  padding: 24px 20px 8px;
}
.auth-success__icon { font-size: 3.5rem; margin-bottom: 12px; }
.auth-success h3 {
  font-family: var(--font-head);
  font-size: 1.4rem;
  color: var(--dark);
  margin-bottom: 8px;
}
.auth-success p { font-size: 0.9rem; color: var(--mid); }

/* ── Responsive ── */
@media (max-width: 480px) {
  .auth-modal { border-radius: 16px 16px 0 0; max-height: 95vh; }
  .auth-overlay { align-items: flex-end; padding: 0; }
  .auth-panel { padding: 20px 18px 0; }
}

/* ── Gợi ý trong form (đăng ký bằng email hoặc SĐT, quên mật khẩu) ── */
.auth-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f6f2ee;
  color: #6b5a4c;
  font-size: 0.84rem;
  line-height: 1.55;
}
.auth-hint i { margin-top: 2px; color: var(--primary, #a9785a); }

.auth-forgot { margin: -4px 0 12px; text-align: right; }
.auth-forgot .auth-switch__btn { font-size: 0.84rem; }

/* ── Thẻ nội dung cho trang đặt lại mật khẩu / xác thực email ── */
.account-card {
  max-width: 520px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border, #ece5de);
  border-radius: 14px;
  padding: 28px 26px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .05);
}
.account-card .auth-alert { margin-bottom: 16px; }
.account-card .btn { cursor: pointer; }

@media (max-width: 480px) {
  .account-card { padding: 22px 18px; }
}
