/* Mobile & tablet responsive overrides for sign page */
@media (max-width: 768px) {
  .toggle-container {
    position: sticky !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: auto !important;
    border-radius: 16px !important;
    z-index: 3;
    margin: 0 0 12px 0;
    padding-top: env(safe-area-inset-top);
    backdrop-filter: blur(6px);
    transform: none !important; /* keep visible on mobile */
  }

  .toggle {
    position: relative;
    left: 0 !important;
    width: 100% !important;
    height: auto !important;
    transform: none !important;
    background: linear-gradient(to right, #333, #111);
    padding: 8px 12px;
  }

  .toggle-panel {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    top: 0;
    transform: none !important;
    padding: 10px 8px;
    text-align: center;
  }

  /* Show only one toggle card at a time (mobile only) */
  /* Not active (Sign In shown): hide "Welcome Back!" (left), show "Hello, Friend!" (right) */
  .toggle .toggle-left { display: none; }
  .toggle .toggle-right { display: flex; }

  /* Active (Sign Up shown): show "Welcome Back!" (left), hide "Hello, Friend!" (right) */
  .container.active .toggle .toggle-left { display: flex !important; }
  .container.active .toggle .toggle-right { display: none !important; }

  /* Prevent desktop active-state slide on mobile */
  .container.active .toggle-container { 
    transform: none !important; 
  }

  /* Container sizing */
  .container {
    width: min(96vw, 460px);
    margin: 16px auto;
    min-height: auto;
    border-radius: 20px;
  }

  .form-container {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    transition: none;
  }

  .sign-in,
  .sign-up {
    position: relative !important;
    width: 100% !important;
    transform: none !important;
    opacity: 1 !important;
    z-index: auto !important;
  }

  .sign-up { display: none; }
  .container.active .sign-in { display: none !important; }
  .container.active .sign-up { display: block !important; }

  .container form {
    padding: 20px 16px;
  }

  .container input {
    padding: 12px 14px;
    font-size: 16px;
  }

  .container button {
    padding: 12px 18px;
    font-size: 14px;
    border-radius: 10px;
  }

  .social-icons {
    margin: 12px 0;
  }
  .social-icons a {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .home {
    top: 12px;
    left: 12px;
    font-size: 16px;
  }

  #forgotBox,
  .forgot-container {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: min(92vw, 420px) !important;
    max-width: 92vw !important;
    padding: 18px !important;
    border-radius: 16px !important;
    #forgotBox .close-btn {
      top: 8px;
      right: 10px;
      width: 36px;
      height: 36px;
      border-radius: 12px; /* slightly rounded square for better thumb hit area */
    }
    #forgotBox .close-btn i { font-size: 18px; }
  }
}

/* Small phones: tighter spacing */
@media (max-width: 480px) {
  .container {
    width: 95vw;
    margin: 12px auto;
    border-radius: 18px;
  }

  .container form {
    padding: 18px 14px;
  }

  .container input {
    padding: 12px 12px;
    font-size: 15px;
  }

  .container button {
    padding: 12px 16px;
    font-size: 14px;
  }

  .social-icons a {
    width: 40px;
    height: 40px;
  }

  #customAlert {
    font-size: 13px;
    padding: 10px 14px;
  }
}

/* Respect reduced motion to avoid jank on low-end mobiles */
@media (prefers-reduced-motion: reduce) {
  .toggle,
  .form-container,
  .container,
  .forgot-container {
    transition: none !important;
    animation: none !important;
  }
}