/* ==============================================================
   AUTH PAGE – COMPLETE CONSOLIDATED STYLES
   ============================================================== */

/* ==============================================================
   INPUT GROUP & VALIDATION
   ============================================================== */

.input-group {
  position: relative;
}

.input-group input {
  transition: all 0.3s ease;
}

.input-group input:focus {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
  outline: none;
  border-color: currentColor;
}

.input-group .text-xs {
  display: flex;
  align-items: center;
  gap: 4px;
}

#msg i {
  margin-right: 6px;
}

/* Input validation states */
input:valid {
  border-color: #10b981 !important;
}

input:invalid {
  border-color: #ef4444 !important;
}

/* OTP & Text Input Spinner Removal */
input[type="text"]::-webkit-outer-spin-button,
input[type="text"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Better password toggle visibility */
.password-toggle {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ==============================================================
   AUTH CONTAINER & BACKDROP
   ============================================================== */

#auth .container {
  backdrop-filter: blur(10px);
}

/* ==============================================================
   BUTTON STATES & STYLING
   ============================================================== */

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

button, a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==============================================================
   LOADING SPINNER
   ============================================================== */

.spinner {
  border: 3px solid #f3f4f6;
  border-top: 3px solid #4f46e5;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  margin-right: 8px;
}

@keyframes spin {
  0% { 
    transform: rotate(0deg); 
  }
  100% { 
    transform: rotate(360deg); 
  }
}

/* ==============================================================
   ANIMATIONS
   ============================================================== */

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.4s ease-out;
}

#msg {
  animation: fadeIn 0.5s ease;
}

/* Slide Down Animation */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slideDown {
  animation: slideDown 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Shake Animation for Error Messages */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

.text-red-600 {
  animation: shake 0.3s ease-in-out;
}

/* ==============================================================
   GLOBAL PAGE STYLES
   ============================================================== */

body {
  overflow-x: hidden;
}

/* Smooth transitions for all elements */
* {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* ==============================================================
   MOBILE OPTIMIZATIONS (max-width: 640px)
   ============================================================== */

@media (max-width: 640px) {
  .container {
    margin-top: 2rem !important;
    padding: 1.5rem !important;
  }

  h2 {
    font-size: 1.5rem !important;
  }

  input, button {
    font-size: 16px !important; /* Prevents zoom on iOS */
  }

  .text-xs {
    font-size: 0.7rem !important;
  }
}

/* ==============================================================
   VISUAL REDESIGN — brand header, card entrance, tab-style
   switcher, input focus polish. Logic/IDs untouched.
   ============================================================== */

@keyframes authCardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 28px auto 0;
  text-align: center;
}

.auth-brand-tagline {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
  max-width: 280px;
  line-height: 1.4;
}

.container {
  animation: authCardIn 0.35s ease;
  position: relative;
}

.container::before {
  content: "";
  position: absolute;
  top: 0; left: 16px; right: 16px;
  height: 4px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(90deg, #4f46e5, #6366f1, #818cf8);
}

/* Login / Signup pill switcher */
.auth-switch-row {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}
.auth-switch-row a {
  transition: color 0.15s ease;
}
.auth-switch-row a:hover {
  color: #4338ca !important;
}

/* Password-recovery option buttons: subtle lift on hover, handled by
   existing Tailwind hover: classes already present on the buttons. */
#forgotSection button[type="button"] {
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

/* OTP inputs: make the 6-digit code visually distinct/engaging */
#signupOtpInput, #otpInput {
  letter-spacing: 6px !important;
}

/* Trust note under the card */
.auth-trust-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px auto 24px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}
.auth-trust-note i { color: #a5b4fc; }

@media (max-width: 480px) {
  .auth-brand { margin-top: 18px; }
}

/* ==============================================================
   MODERN REDESIGN v2 — tab pill, glass card, icon inputs, buttons.
   Purely visual. No IDs/classes used by auth.js are removed.
   ============================================================== */

.container {
  border-radius: 20px !important;
  box-shadow: 0 20px 45px -12px rgba(79, 70, 229, 0.22), 0 4px 14px rgba(0,0,0,0.04) !important;
}

.container::before { display: none; }

/* --- Login / Sign Up pill toggle --- */
.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f1f2f9;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 22px;
  overflow: hidden;
}

.auth-tabs.is-hidden { display: none; }

.auth-tab {
  position: relative;
  z-index: 2;
  border: none;
  background: transparent;
  padding: 9px 0;
  font-size: 14px;
  font-weight: 700;
  color: #6b7280;
  border-radius: 9px;
  cursor: pointer;
  transition: color 0.25s ease;
  min-height: 38px;
}

.auth-tab.active { color: #4338ca; }

.auth-tab-glider {
  position: absolute;
  top: 4px; bottom: 4px; left: 4px;
  width: calc(50% - 4px);
  background: #ffffff;
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(79,70,229,0.18);
  transition: transform 0.28s cubic-bezier(0.65, 0, 0.35, 1);
  z-index: 1;
}

.auth-tabs.is-signup .auth-tab-glider {
  transform: translateX(100%);
}

/* --- Inputs: icon badge + soft focus glow --- */
.relative input[type="text"],
.relative input[type="email"],
.relative input[type="password"] {
  border-color: #e5e7eb !important;
  border-radius: 12px !important;
  background: #fafafe;
}

.relative input[type="text"]:focus,
.relative input[type="email"]:focus,
.relative input[type="password"]:focus {
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12) !important;
}

#loginSection .relative > i.fas:first-of-type,
#signupSection .relative > i.fas:first-of-type,
#forgotSection .relative > i.fas:first-of-type {
  width: 22px;
  height: 22px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5 !important;
  border-radius: 7px;
  font-size: 11px !important;
}

/* --- Primary action buttons: gradient + lift --- */
#loginBtn, #signupBtn, #resetBtn, #verifyBtn, #getUsernameBtn, #verifyOtpBtn {
  border: none !important;
  background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
  box-shadow: 0 8px 20px -6px rgba(79, 70, 229, 0.55) !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease !important;
}

#loginBtn:hover, #signupBtn:hover, #resetBtn:hover,
#verifyBtn:hover, #getUsernameBtn:hover, #verifyOtpBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px -6px rgba(79, 70, 229, 0.6) !important;
}

#loginBtn:active, #signupBtn:active, #resetBtn:active,
#verifyBtn:active, #getUsernameBtn:active, #verifyOtpBtn:active {
  transform: translateY(0);
}

/* --- OTP boxes --- */
#signupOtpInput, #otpInput {
  border-radius: 10px !important;
  background: #fafafe;
}

/* --- Forgot-password option cards --- */
#showUsernameRecovery, #showPasswordRecovery {
  border-radius: 12px !important;
  box-shadow: 0 8px 18px -6px rgba(0,0,0,0.15) !important;
  transition: transform 0.18s ease !important;
}

#showUsernameRecovery:hover, #showPasswordRecovery:hover {
  transform: translateY(-2px);
}

@media (max-width: 480px) {
  .auth-tab { font-size: 13px; }
}