/* =========================================================
   Login/Register Authentication Styles
   ========================================================= */

/* ---------- Global Reset for Auth Elements ---------- */
.auth-page,
.auth-page * {
  box-sizing: border-box;
}

.auth-page {
  position: relative;
  z-index: 99999;
  font-family: var(--font-family, "Inter", sans-serif);
}

/* Small link buttons (e.g. Back) */
.auth-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--primary, #6366f1);
  font-weight: 700;
  font-family: inherit;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-footer-text {
  font-size: 0.8rem;
  margin-top: 15px;
  color: var(--text-muted);
  opacity: 0.7;
}

.auth-footer-text .link-highlight {
  color: var(--primary);

}

/* ---------- Overlay ---------- */
.auth-overlay {
  position: fixed;
  inset: 0;
  padding: 15px;
  /* Adds safe space on small mobile screens */
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card-solid);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: authFadeIn 0.2s ease-out;
  overflow-y: auto;
  /* Allow scroll on short screens */
}

/* ---------- Modal Card ---------- */
.auth-modal {
  width: 100%;
  max-width: 980px;
  min-height: 600px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  background: var(--bg-card-solid, var(--bg-modal, #0f1014));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.10));
  border-radius: var(--radius-modal, 20px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.80);
}

/* ---------- Topbar (Back/Close) ---------- */
.auth-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 20px;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.auth-topbtn {
  pointer-events: auto;
  appearance: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 50px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.auth-topbtn:hover {
  color: var(--text-main);
  box-shadow: 0 0px 10px var(--primary-glow);
  transform: translateY(-1px);
}

.auth-topbtn .ico {
  font-size: 18px;
  line-height: 1;
}

.auth-topbtn-close {
  font-size: 20px;
  line-height: 1;
  padding: 8px 12px;
}

/* ---------- Messages ---------- */
.auth-msg {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 80px;
  width: 90%;
  max-width: 400px;
  z-index: 60;
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  border: 1px solid transparent;
}

.auth-msg.err {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.3);
  color: #fca5a5;
}

.auth-msg.ok {
  background: rgba(22, 163, 74, 0.15);
  border-color: rgba(22, 163, 74, 0.3);
  color: #86efac;
}

/* ---------- Views Wrapper ---------- */
.auth-body {
  flex: 1;
  display: flex;
  width: 100%;
  position: relative;
}

.auth-view {
  width: 100%;
  display: none;
}

.auth-view.is-active {
  display: flex;
  width: 100%;
  animation: authViewIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =========================================================
   FIRST INTERFACE (Split: Video Card Left + Actions Right)
   ========================================================= */
.auth-choose {
  width: 100%;
  flex-direction: row;
}

/* Left Promo Side */
.auth-promo {
  width: 45%;
  background: var(--border);
  border-right: 1px solid var(--border);
  padding: 30px;
  display: flex;
  flex-direction: column;
}

.promo-phone {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* The Video Container (Card Style) */
.promo-media {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-card-solid);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.promo-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.promo-media video.is-active {
  opacity: 1;
}

/* Text Below Video */
.promo-text {
  margin-bottom: 10px;
}

.promo-caption,
.promo-sub {
  display: none;

}

.promo-caption.is-active,
.promo-sub.is-active {
  display: block;

}

.promo-text p {
  margin: 0 0 8px 0;
  color: var(--text-main);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.promo-text .muted {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* Dots at Bottom */
.promo-dots {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

.promo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s;
}

.promo-dot.is-active {
  background: var(--user-nav-active-bg);
  width: 24px;
  border-radius: 10px;
}

/* Right Action Panel */
.auth-panel {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: var(--bg-card-solid);
}

.auth-h1 {
  margin: 0 0 40px 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main, #fff);
  line-height: 1.25;
}

.auth-stack {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-bottom {
  margin-top: 24px;
  font-size: 14px;
  text-align: center;
  color: var(--text-muted);
}

.auth-bottom a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

/* =========================================================
   BUTTON STYLES
   ========================================================= */
.auth-btn,
.auth-submit {
  width: 100%;
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.2s;
  background: transparent;
}

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

/* Google Outline Style */
.auth-btn-google {
  border-color: var(--border);
  color: var(--text-main);
}

.auth-btn-google:hover {
  box-shadow: 0 0px 10px var(--primary-glow);
  transform: translateY(-1px);
}

.auth-btn-google::before {
  content: "";
  width: 18px;
  height: 18px;
  background: url("https://www.gstatic.com/firebasejs/ui/2.0.0/images/auth/google.svg") no-repeat center;
  background-size: contain;
}

/* Email Outline Style */
.auth-btn-email {
  border-color: var(--border);
  color: var(--text-main);
}

.auth-btn-email:hover {
  box-shadow: 0 0px 10px var(--primary-glow);
  transform: translateY(-1px);
  color: var(--text-muted);
}

.auth-btn-email::before {
  content: "✉";
  font-size: 30px;
  color: var(--primary);
  line-height: 1;
}

/* Primary Gradient Button (Login) */
.auth-btn-primary {
  background: linear-gradient(135deg,
      var(--primary, #6366f1) 0%,
      var(--accent, #a855f7) 100%);
  color: #fff;
  border: none;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.auth-btn-primary:hover {
  box-shadow: 0 0px 10px var(--primary-glow);
  transform: translateY(-1px);
}

/* Wide Google White (For Forms) */
.auth-google-wide {
  width: 100%;
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  color: var(--text-main);
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s;
}

.auth-google-wide:hover {
  box-shadow: 0 0px 10px var(--primary-glow);
  transform: translateY(-1px);
}

.auth-google-wide::before {
  content: "";
  width: 18px;
  height: 18px;
  margin-right: 10px;
  background: url("https://www.gstatic.com/firebasejs/ui/2.0.0/images/auth/google.svg") no-repeat center;
  background-size: contain;
}

/* =========================================================
   FORMS (Login/Register Views)
   ========================================================= */
/* Center the form view vertically and horizontally */
.auth-view.is-active:not(.auth-choose) {
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.auth-formwrap {
  width: 100%;
  max-width: 400px;
  /* Restrict max width */
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.auth-title {
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  text-transform: uppercase;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
  text-align: center;

}

.auth-span {
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 20px;

}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

/* Inputs */
.auth-field {
  position: relative;
  width: 100%;
}

.auth-input {
  width: 100%;
  height: 52px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 16px;
  color: var(--text-main);
  font-size: 15px;
  outline: none;
  transition: 0.2s;
}

.auth-input:focus {
  border-color: var(--primary, #6366f1);
}

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

/* Eye Icon */
.auth-eye {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 46px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-eye:hover {
  color: var(--text-main);
  transform: translateY(-1px);
}

.auth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.auth-forgot {
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.auth-forgot:hover {
  text-decoration: underline;
}

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.auth-divider::before {
  margin-right: 15px;
}

.auth-divider::after {
  margin-left: 15px;
}

/* =========================================================
   ANIMATIONS
   ========================================================= */
@keyframes authFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes authViewIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

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

/* =========================================================
   RESPONSIVE (Mobile Fixes)
   ========================================================= */
@media (max-width: 900px) {

  /* Tablet / Vertical Layout */
  .auth-modal {
    max-width: 500px;
    height: auto;
    min-height: auto;
  }

  .auth-choose {
    flex-direction: column;
  }

  /* Hide Promo on Mobile to save space */
  .auth-promo {
    display: none;
  }

  .auth-panel {
    padding: 40px 25px;
  }
}

/* =========================================================
   MOBILE RESPONSIVE FIX (Top Bar & Spacing)
   ========================================================= */
@media (max-width: 480px) {

  /* 1. Adjust Top Bar spacing to be closer to edges */
  .auth-topbar {
    padding: 12px 15px;
    height: auto;
    z-index: 100;
    /* Ensure buttons are always on top */
  }

  /* 2. Resize buttons slightly for mobile to look cleaner */
  .auth-topbtn {
    padding: 6px 12px;
    font-size: 13px;
    -webkit-backdrop-filter: blur(8px);
    /* Enhance blur so text behind is less visible */
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.6);
    /* Darker background for better contrast */
  }

  .auth-topbtn-close {
    padding: 6px 10px;
    font-size: 18px;
  }

  /* 3. CRITICAL FIX: Push the form content down */
  /* Remove vertical centering so content starts below buttons */
  .auth-view.is-active:not(.auth-choose) {
    align-items: flex-start;
    padding: 0;
  }

  /* Add padding to the top of the form wrapper so Title doesn't touch buttons */
  .auth-formwrap {
    padding-top: 80px;
    /* Creates space for the Back button */
    padding-bottom: 40px;
    padding-left: 20px;
    padding-right: 20px;
    justify-content: flex-start;
    min-height: 100%;
    /* Allows scrolling on small screens */
  }

  /* Optional: Adjust Title size for mobile */
  .auth-title {
    font-size: 24px;
    margin-bottom: 25px;
  }
}

/* Ensure inputs don't stretch */
.auth-input,
.auth-btn,
.auth-submit,
.auth-google-wide {
  height: 48px;
  font-size: 14px;
  width: 100%;
  /* Strict width */
}