/* ==========================================================================
   auth.css — Authentication UI & Sidebar History Styles
   Uses tokens from tokens.css only. Supports light and dark mode automatically.
   ========================================================================== */

/* ---------- Sidebar Auth Slot (#auth-slot) ---------- */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.auth-card-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
  min-width: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.user-sub {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.3;
}

/* ---------- Login Modal ---------- */
.modal-logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
}

.modal-reason {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-3);
  margin: 0 0 16px;
}

.login-step {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.otp-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.btn-link {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--brand-2);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity .15s;
}

.btn-link:hover {
  opacity: 0.8;
}

.btn-link:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: none;
}

.otp-input {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.4em;
  height: 48px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
  font-size: 13px;
  margin: 16px 0 12px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-error {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 12px;
}

.login-footer {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  margin-top: 16px;
  line-height: 1.45;
}

/* ---------- Sidebar History List ---------- */
.history-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 32px 14px;
  color: var(--text-3);
}

.history-hint svg {
  width: 28px;
  height: 28px;
  stroke-width: 1.75;
  color: var(--text-3);
}

.history-hint p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.history-group {
  margin-top: 14px;
}

.history-group:first-child {
  margin-top: 4px;
}

.history-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  padding: 6px 10px 4px;
}

.history-item {
  display: block;
  width: 100%;
  height: 36px;
  line-height: 36px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background .12s, color .12s;
}

.history-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.history-item.active {
  background: var(--surface-3);
  color: var(--text);
  font-weight: 600;
}

.history-empty {
  text-align: center;
  padding: 32px 12px;
  font-size: 13px;
  color: var(--text-3);
}

.skeleton {
  height: 36px;
  width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 25%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Login dialog is opened non-modal (see auth.js) so the reCAPTCHA challenge can sit above it. */
dialog.modal.modal-nonmodal[open] { position: fixed; inset: 0; z-index: 900; }
.login-backdrop { position: fixed; inset: 0; z-index: 899; background: var(--overlay); backdrop-filter: blur(2px); }
.login-backdrop[hidden] { display: none; }

/* Ẩn badge reCAPTCHA góc màn hình */
.grecaptcha-badge {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.recaptcha-legal-note {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-3);
  margin-top: 10px;
  text-align: center;
}

.recaptcha-legal-note a {
  color: var(--text-2);
  text-decoration: underline;
}
