/* ============================================
   CLATMock Auth System — extracted from styles.css
   Loaded ONLY on pages that use the standalone design
   (homepage) so the global stylesheet cannot conflict.
   ============================================ */

:root {
  /* Core palette (subset needed by auth system) — aligned with design palette */
  --bg: #f3f3f3;
  --bg-alt: #f8fafc;
  --bg-secondary: #f1f3ee;
  --text: #1d2938;
  --text-secondary: #5f6e7c;
  --text-tertiary: #89949b;
  --line: #e8e7df;
  --line-strong: #d4d8d2;
  --card: #ffffff;

  /* Brand colors — design green */
  --primary: #2c806b;
  --primary-dark: #256e5c;
  --primary-darker: #1c5e50;
  --primary-light: #e4f1eb;
  --primary-glow: rgba(44, 128, 107, 0.22);

  /* Semantic */
  --success: #16a34a;
  --success-bg: #dcfce7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-border: #fca5a5;

  /* Geometry */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
  --shadow-xl: 0 24px 60px rgba(15, 23, 42, 0.18);

  /* Transitions */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 0.15s;
  --duration: 0.2s;
  --duration-slow: 0.3s;
}

/* ============================================
   Global Utilities
   ============================================ */

.hidden {
  display: none !important;
}

/* ============================================
   Auth Cluster — integrated into the design header
   ============================================ */

.auth-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
}

#authUserDropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.auth-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease-out);
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.auth-dropdown-trigger:hover {
  border-color: #2c806b;
  box-shadow: 0 4px 16px var(--primary-glow);
}

/* Avatar initials in the account trigger */
.auth-avatar {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2c806b 0%, #1c5e50 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1;
}

.auth-username-text {
  display: none !important;
}

/* Buy Coins standalone button */
.auth-btn-buy-coins {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  color: #1e293b;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  box-shadow: 0 2px 10px rgba(251, 191, 36, 0.4);
  letter-spacing: 0.02em;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.auth-btn-buy-coins:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(251, 191, 36, 0.55);
  background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 50%, #f59e0b 100%);
}

.auth-btn-buy-coins:active {
  transform: scale(0.96);
}

.auth-btn-buy-coins svg {
  stroke: #1e293b;
  flex-shrink: 0;
}

/* Buy Coins dropdown item */
.auth-dropdown-item.buy-coins {
  color: #b45309;
}

.auth-dropdown-item.buy-coins svg {
  stroke: #b45309;
}

.auth-dropdown-item.buy-coins:hover {
  background: #fffbeb;
  color: #b45309;
}

.auth-sub-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 20px;
  padding: 3px 10px 3px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.auth-sub-badge svg {
  width: 12px;
  height: 12px;
}

/* Icon-only gold subscribe button (header) */
.button.auth-subscribe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  box-shadow: none;
  white-space: nowrap;
}

.button.auth-subscribe-btn:hover {
  background: rgba(251, 191, 36, 0.22);
  box-shadow: 0 4px 14px rgba(251, 191, 36, 0.35);
  transform: translateY(-1px);
}

.button.auth-subscribe-btn svg {
  stroke: #fbbf24;
}

/* Gold star premium badge (icon only) */
.auth-sub-badge.auth-sub-gold {
  padding: 0;
  background: transparent;
  color: #fbbf24;
}

.auth-sub-badge.auth-sub-gold svg {
  stroke: #fbbf24;
}

/* Trial badge — warm amber */
.auth-sub-trial {
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
}

.auth-sub-trial svg {
  stroke: #fbbf24;
}

/* Premium badge — green */
.auth-sub-premium {
  background: rgba(34, 197, 94, 0.18);
  color: #22c55e;
}

.auth-sub-premium svg {
  stroke: #22c55e;
}

/* Expired badge — muted with action hint */
.auth-sub-expired {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
}

.auth-sub-expired svg {
  stroke: #94a3b8;
}

.auth-sub-expired:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.auth-sub-expired:hover svg {
  stroke: #ef4444;
}

.auth-chevron-down {
  transition: transform var(--duration) var(--ease-out);
  opacity: 0.6;
}

.auth-dropdown-trigger.open .auth-chevron-down {
  transform: rotate(180deg);
}

.auth-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 1001;
  animation: authFadeIn var(--duration) var(--ease-out);
}

.auth-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 18px;
  border: none;
  background: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-align: left;
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.auth-dropdown-item:hover {
  background: var(--bg);
  color: var(--danger);
}

.auth-dropdown-item svg {
  flex-shrink: 0;
}

/* ============================================
   Auth Modal
   ============================================ */

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: authFadeIn var(--duration) var(--ease-out);
}

.auth-overlay.hidden {
  display: none;
}

@keyframes authFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.auth-modal {
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 40px 36px 32px;
  width: min(420px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-xl);
  animation: authSlideUp var(--duration-slow) var(--ease-out);
  border: 1px solid var(--line);
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
}

@keyframes authSlideUp {
  from {
    transform: translateY(24px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) var(--ease-out);
  line-height: 1;
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.auth-close:hover {
  background: var(--bg);
  color: var(--text);
}

.auth-tab-content {
  display: flex;
  flex-direction: column;
}

.auth-tab-content.hidden {
  display: none;
}

.auth-title {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.auth-subtitle {
  margin: 0 0 24px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.auth-field {
  margin-bottom: 18px;
}

.auth-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}

.auth-field input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: all var(--duration-fast) var(--ease-out);
  box-sizing: border-box;
  outline: none;
  background: #f8fafc;
  color: var(--text);
  font-family: inherit;
}

.auth-field input:focus {
  border-color: #2c806b;
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.auth-field input::placeholder {
  color: var(--text-tertiary);
}

.auth-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin-bottom: 14px;
  border: 1px solid var(--danger-border);
  line-height: 1.4;
}

.auth-error.hidden {
  display: none;
}

.auth-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  font-family: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.auth-btn-primary {
  background: linear-gradient(135deg, #2c806b 0%, #1c5e50 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(44, 128, 107, 0.22);
}

.auth-btn-primary:hover {
  background: linear-gradient(135deg, #256e5c 0%, #174d40 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(20, 184, 166, 0.4);
}

.auth-btn-primary:active {
  transform: scale(0.98);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.auth-alt {
  text-align: center;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.auth-link {
  background: none;
  border: none;
  color: #2c806b;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--duration-fast) var(--ease-out);
}

.auth-link:hover {
  color: #1c5e50;
}

.auth-success-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 16px;
  font-weight: 700;
}

.auth-success-text {
  text-align: center;
  color: var(--success);
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 20px;
}

/* ============================================
   2FA Verification Tab
   ============================================ */

.auth-2fa-resend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.auth-2fa-cooldown {
  color: var(--text-tertiary);
  font-size: 0.78rem;
  font-weight: 600;
}

/* Loading spinner for auth buttons */
.auth-btn.loading {
  position: relative;
  color: transparent !important;
}

.auth-btn.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin 0.6s linear infinite;
}

@keyframes authSpin {
  to {
    transform: rotate(360deg);
  }
}