/* ====================================================
   SyncStream - Multi-Method Authentication Portal
   Theme: SQUAP 24px Glassmorphism & Electric Blue Glow
   ==================================================== */

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

:root {
  color-scheme: dark;
}

html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
  color-scheme: dark;
}

body.auth-body {
  color-scheme: dark;
  background-color: #08090d !important;
  background-image: radial-gradient(circle at 50% 0%, rgba(54, 80, 253, 0.28) 0%, rgba(54, 80, 253, 0.08) 45%, transparent 75%) !important;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  background-attachment: fixed !important;
  color: var(--text-main, rgba(255, 255, 255, 0.9));
  font-family: var(--font-persian, 'Vazirmatn', system-ui, sans-serif);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: max(24px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
  position: relative;
  overflow-x: hidden;
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
}

/* ── Custom Sleek Minimal Scrollbars ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill, 9999px);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-main, #3650fd);
}

/* ── Matrix Dot Grid & Top Ambient Glow Background (Exact Lobby Background) ── */
#matrix-bg-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: #08090d;
  background-image: radial-gradient(circle at 50% 0%, rgba(54, 80, 253, 0.22) 0%, rgba(54, 80, 253, 0.05) 50%, transparent 80%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  overflow: hidden;
}

.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 1;
}

#axis-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--axis-bg, #08090e);
  overflow: hidden;
}

/* MAIN WRAPPER */
.auth-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 460px;
  margin: auto;
}

/* 24PX GLASS CARD */
.auth-card {
  position: relative;
  background: var(--glass-bg, rgba(10, 10, 12, 0.68));
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-2xl, 24px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.08);
  padding: 32px 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* BRAND & STROBI HEADER */
.auth-brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  width: 100%;
}

.auth-avatar-circle {
  width: 80px;
  height: 80px;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: visible;
}

.auth-avatar-circle:hover {
  transform: scale(1.08);
}

.auth-avatar-circle strobi-avatar {
  width: 100%;
  height: 100%;
}

.auth-brand-title {
  font-family: var(--font-display, 'Outfit', sans-serif);
  font-size: 24px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.auth-brand-subtitle {
  font-size: 13px;
  color: var(--text-muted, rgba(255, 255, 255, 0.65));
}

/* TABS NAVIGATION */
.auth-tabs-nav {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-pill, 9999px);
  padding: 4px;
  gap: 4px;
}

.auth-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 8px;
  background: transparent;
  border: none;
  border-radius: var(--radius-pill, 9999px);
  color: var(--text-muted, rgba(255, 255, 255, 0.65));
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  white-space: nowrap;
}

.auth-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.auth-tab-btn.active {
  background: linear-gradient(135deg, var(--accent-main, #3650fd), #6366f1);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(54, 80, 253, 0.35);
}

.auth-tab-btn i {
  width: 14px;
  height: 14px;
}

/* ALERT BANNER */
.auth-alert-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 600;
  animation: fadeIn 0.2s ease;
}

.auth-alert-banner.hidden {
  display: none !important;
}

.auth-alert-banner.error {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
}

.auth-alert-banner.success {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.auth-alert-banner i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* FORMS */
.auth-form {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.auth-form.active {
  display: flex;
}

/* Outgoing Form: Soft dissolve + subtle lift (Exact Lobby Transition) */
.auth-form.view-exiting {
  display: flex !important;
  opacity: 0 !important;
  transform: scale(0.97) translateY(-6px) !important;
  filter: blur(1px) !important;
  transition: opacity 0.13s cubic-bezier(0.4, 0, 1, 1), transform 0.13s cubic-bezier(0.4, 0, 1, 1), filter 0.13s ease !important;
  pointer-events: none !important;
}

/* Incoming Form: Smooth spring morph-in (Exact Lobby Transition) */
.auth-form.view-entering {
  animation: authFormMorphIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes authFormMorphIn {
  0% {
    opacity: 0;
    transform: scale(0.97) translateY(12px);
    filter: blur(1px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

/* Staggered smooth reveal for inputs and buttons inside incoming form */
.auth-form.view-entering .input-group,
.auth-form.view-entering .auth-submit-btn,
.auth-form.view-entering .guest-key-intro-box {
  animation: authElementMorphStagger 0.32s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.auth-form.view-entering .input-group:nth-child(1) { animation-delay: 0.03s; }
.auth-form.view-entering .input-group:nth-child(2) { animation-delay: 0.06s; }
.auth-form.view-entering .input-group:nth-child(3) { animation-delay: 0.09s; }
.auth-form.view-entering .input-group:nth-child(4) { animation-delay: 0.12s; }
.auth-form.view-entering .input-group:nth-child(5) { animation-delay: 0.15s; }
.auth-form.view-entering .auth-submit-btn { animation-delay: 0.18s; }

@keyframes authElementMorphStagger {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* INPUT GROUPS */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: right;
}

.input-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, rgba(255, 255, 255, 0.7));
}

.label-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-bg-input, rgba(8, 8, 10, 0.85));
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-pill, 9999px);
  padding: 0 16px;
  height: 44px;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.input-field:focus-within {
  border-color: var(--accent-main, #3650fd);
  box-shadow: 0 0 0 2px rgba(54, 80, 253, 0.3);
}

.input-field i {
  color: var(--theme-badge-color, #7c9dff);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.input-field input {
  background: transparent;
  border: none;
  color: var(--text-main, #ffffff);
  font-size: 13.5px;
  outline: none;
  width: 100%;
  height: 100%;
  font-family: inherit;
  color-scheme: dark;
}

.input-field input::placeholder {
  color: var(--text-dim, rgba(255, 255, 255, 0.35));
}

/* ── Prevent Chromium & Firefox from painting white/light autofill background ── */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active,
input:-internal-autofill-selected,
input:autofill,
input:autofill:hover,
input:autofill:focus,
input:autofill:active {
  -webkit-text-fill-color: #ffffff !important;
  color: #ffffff !important;
  -webkit-box-shadow: 0 0 0 1000px rgba(8, 8, 10, 0.95) inset !important;
  box-shadow: 0 0 0 1000px rgba(8, 8, 10, 0.95) inset !important;
  background-color: transparent !important;
  caret-color: #ffffff !important;
  transition: background-color 5000000s ease-in-out 0s !important;
  font-family: inherit !important;
  border-radius: var(--radius-pill, 9999px) !important;
}

.input-field input:-webkit-autofill,
.input-field input:-webkit-autofill:hover, 
.input-field input:-webkit-autofill:focus, 
.input-field input:-webkit-autofill:active,
.input-field input:-internal-autofill-selected,
.input-field input:autofill,
.input-field input:autofill:hover,
.input-field input:autofill:focus,
.input-field input:autofill:active {
  -webkit-text-fill-color: #ffffff !important;
  color: #ffffff !important;
  -webkit-box-shadow: 0 0 0 1000px rgba(8, 8, 10, 0.95) inset !important;
  box-shadow: 0 0 0 1000px rgba(8, 8, 10, 0.95) inset !important;
  background-color: transparent !important;
  caret-color: #ffffff !important;
  border-radius: var(--radius-pill, 9999px) !important;
  font-family: inherit !important;
  font-size: 13.5px !important;
  transition: background-color 5000000s ease-in-out 0s !important;
}

.input-field input::selection {
  background-color: rgba(54, 80, 253, 0.6);
  color: #ffffff;
}

.input-with-button {
  display: flex;
  gap: 8px;
}

.btn-otp-action {
  background: rgba(54, 80, 253, 0.18);
  border: 1px solid rgba(54, 80, 253, 0.4);
  color: #9cb5ff;
  border-radius: var(--radius-pill, 9999px);
  padding: 0 16px;
  height: 44px;
  box-sizing: border-box;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

.btn-otp-action:hover:not(:disabled) {
  background: var(--accent-main, #3650fd);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-glow, rgba(68, 92, 254, 0.6));
}

.btn-otp-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-otp-action i {
  width: 14px;
  height: 14px;
}

.input-with-toggle {
  position: relative;
}

.btn-eye-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted, rgba(255, 255, 255, 0.6));
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.btn-eye-toggle:hover {
  color: #fff;
}

.btn-eye-toggle i {
  width: 16px;
  height: 16px;
}

.field-hint {
  font-size: 11px;
  color: var(--text-dim, rgba(255, 255, 255, 0.45));
}

/* GUEST KEY INTRO BOX */
.guest-key-intro-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 4px;
}

.guest-key-intro-box i {
  color: #c084fc;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.guest-key-intro-box strong {
  display: block;
  font-size: 12.5px;
  color: #f3e8ff;
  margin-bottom: 2px;
}

.guest-key-intro-box p {
  font-size: 11px;
  color: #d8b4fe;
  line-height: 1.5;
}

/* SUBMIT BUTTON */
.auth-submit-btn {
  width: 100%;
  margin-top: 14px;
  background: linear-gradient(135deg, var(--accent-main, #3650fd), #6366f1);
  color: white;
  border: none;
  border-radius: var(--radius-pill, 9999px);
  padding: 13px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(54, 80, 253, 0.35);
  transition: all 0.2s ease;
  font-family: inherit;
}

.auth-submit-btn:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(54, 80, 253, 0.5);
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.auth-submit-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-submit-btn i {
  width: 18px;
  height: 18px;
}

/* FOOTER */
.auth-card-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.quick-guest-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-glow, #7c9dff);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill, 9999px);
  background: rgba(68, 92, 254, 0.1);
  border: 1px solid rgba(68, 92, 254, 0.25);
  transition: all 0.2s ease;
}

.quick-guest-link:hover {
  background: rgba(68, 92, 254, 0.2);
  color: #fff;
  transform: translateY(-1px);
}

.quick-guest-link i {
  width: 15px;
  height: 15px;
}

.footer-sub-links {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  color: var(--text-dim, rgba(255, 255, 255, 0.4));
}

.footer-sub-links a {
  color: var(--text-muted, rgba(255, 255, 255, 0.6));
  text-decoration: none;
}

.footer-sub-links a:hover {
  color: #fff;
}
