/* ========================================
   auth.css — Modern Premium Auth Styling
   Design System | Mesh Gradients | Glassmorphism
   ======================================== */

/* ---------- Design System Tokens ---------- */
:root {
  --auth-primary: #0f73a7;
  --auth-primary-hover: #0c5f8a;
  --auth-primary-light: #e0f2fe;
  --auth-secondary: #578fca;
  --auth-accent: #a1e3f9;

  --auth-bg: #f8fafc;
  --auth-card-bg: #ffffff;
  --auth-border: #e2e8f0;
  --auth-text: #0f172a;
  --auth-text-muted: #64748b;

  --auth-input-height: 48px;
  --auth-input-radius: 10px;
  --auth-btn-radius: 10px;
  --auth-card-radius: 1.25rem;

  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-premium: 0 20px 40px -15px rgba(15, 115, 167, 0.08), 0 0 0 1px rgba(15, 115, 167, 0.04);
}

/* ---------- Global Reset & Body ---------- */
body.auth-page {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  margin: 0;
  background-color: var(--auth-bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Split Layout Grid ---------- */
.auth-split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  min-height: 100vh;
  width: 100%;
}

/* ---------- Left Visual Panel (Desktop) ---------- */
.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4rem;
  /* Softly fade the right 25% of the image to solid white to blend with the form panel seamlessly */
  background-image: linear-gradient(to right, transparent 75%, rgba(255, 255, 255, 0.4) 90%, #ffffff 100%), 
                    url("/static/app/backdrop_auth.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--auth-text);
  overflow: hidden;
  border-right: none; /* Removed the sharp border to eliminate the harsh boundary */
}

/* Grid Pattern Overlay - Extremely soft & subtle */
.auth-visual::before {
  display: none;
}

/* Glowing Ambient Blobs - Ultra soft & diffused */
.auth-visual-glow {
  display: none;
}

.auth-visual-glow--1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(161, 227, 249, 0.15) 0%, rgba(15, 115, 167, 0.03) 70%);
  top: -150px;
  right: -100px;
  animation: glow-pulse-1 12s ease-in-out infinite alternate;
}

.auth-visual-glow--2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(107, 127, 215, 0.12) 0%, rgba(87, 143, 202, 0.03) 70%);
  bottom: -100px;
  left: -80px;
  animation: glow-pulse-2 15s ease-in-out infinite alternate;
}

@keyframes glow-pulse-1 {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(-30px, 40px) scale(1.08);
  }
}

@keyframes glow-pulse-2 {
  0% {
    transform: translate(0, 0) scale(1);
  }

  100% {
    transform: translate(40px, -20px) scale(1.1);
  }
}

/* Rotating Decorative Rings - Hidden for ultra-clean look */
.auth-visual-rings {
  display: none;
}

.auth-visual-rings .ring {
  position: absolute;
  border-radius: 50%;
  opacity: 0.75;
}

.auth-visual-rings .ring--1 {
  width: 280px;
  height: 280px;
  top: 10%;
  right: 5%;
  border: 1px dashed rgba(15, 115, 167, 0.08);
  animation: ring-spin 40s linear infinite;
}

.auth-visual-rings .ring--2 {
  width: 200px;
  height: 200px;
  bottom: 15%;
  left: 8%;
  border: 1px solid rgba(15, 115, 167, 0.05);
  animation: ring-spin 30s linear infinite reverse;
}

.auth-visual-rings .ring--3 {
  width: 110px;
  height: 110px;
  top: 45%;
  left: 20%;
  border: 1px dotted rgba(6, 182, 212, 0.08);
  animation: ring-float 8s ease-in-out infinite;
}

@keyframes ring-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes ring-float {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-15px) rotate(180deg);
  }
}

/* Inner Content & Branding */
.auth-visual-inner {
  display: none;
}

.auth-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 2rem;
  filter: drop-shadow(0 10px 25px rgba(15, 115, 167, 0.1));
  border-radius: 50%;
  border: 1px solid rgba(15, 115, 167, 0.06);
  background-color: #ffffff;
  padding: 2px;
}

.auth-visual-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-visual-desc {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--auth-text-muted);
  margin: 0;
}



/* ---------- Right Form Panel ---------- */
.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  background-color: #ffffff;
  /* Clean white cardless background */
}

/* ---------- Auth Form Container (Flat Cardless style) ---------- */
.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  /* More compact for modern flat look */
  background: transparent;
  padding: 0;
  box-shadow: none;
  border: none;
  overflow: visible;
  animation: auth-card-appear 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Gradient accent bar on top - Removed for cardless layout */
.auth-card::before {
  display: none;
}

@keyframes auth-card-appear {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

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

.auth-card-subtitle {
  font-size: 0.95rem;
  color: var(--auth-text-muted);
  margin: 0 0 2rem;
  line-height: 1.5;
}

/* ---------- Mobile Logo ---------- */
.auth-mobile-logo {
  display: none;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.auth-mobile-logo img {
  width: 60px;
  height: 60px;
  filter: drop-shadow(0 4px 10px rgba(15, 115, 167, 0.15));
}

/* ---------- Form Labels ---------- */
.auth-card .form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--auth-text-muted);
  margin-bottom: 0.5rem;
}

/* ---------- Form Controls & Custom styling ---------- */
.auth-card .form-control,
.auth-card .form-select {
  height: var(--auth-input-height);
  border-radius: var(--auth-input-radius);
  padding: 0 1rem;
  font-size: 0.925rem;
  color: var(--auth-text);
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  transition: var(--transition-smooth);
  width: 100%;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.auth-card .form-control::placeholder {
  color: #94a3b8;
}

.auth-card .form-control:focus,
.auth-card .form-select:focus {
  background-color: #ffffff;
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 4px rgba(15, 115, 167, 0.1);
}

.auth-card .form-control.is-invalid,
.auth-card .form-select.is-invalid {
  border-color: #ef4444;
}

.auth-card .form-control.is-invalid:focus,
.auth-card .form-select.is-invalid:focus {
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

/* Custom Select Arrow */
.auth-card .form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 14px 12px;
  padding-right: 2.5rem;
}

/* ---------- Input Group (Connected Layouts) ---------- */
.auth-card .input-group {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  width: 100% !important;
}

.auth-card .input-group>.form-control {
  flex: 1 1 auto !important;
  width: 1% !important;
  min-width: 0 !important;
  border-radius: var(--auth-input-radius) !important;
}

/* If the form-control is the FIRST child (Password inputs) */
.auth-card .input-group>.form-control:first-child {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-right: none !important;
}

/* The password eye toggle (always after the input) */
.auth-card .input-group-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: var(--auth-input-height);
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: none !important;
  border-top-right-radius: var(--auth-input-radius) !important;
  border-bottom-right-radius: var(--auth-input-radius) !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  color: var(--auth-text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  box-sizing: border-box;
}

.auth-card .input-group:focus-within .input-group-toggle {
  border-color: var(--auth-primary) !important;
  background-color: #ffffff;
}

.auth-card .input-group-toggle:hover {
  color: var(--auth-primary);
  background-color: #f1f5f9;
}

/* If the button is the FIRST child (WhatsApp Phone input) */
.auth-card .input-group>.btn-outline-secondary {
  height: var(--auth-input-height) !important;
  border-top-left-radius: var(--auth-input-radius) !important;
  border-bottom-left-radius: var(--auth-input-radius) !important;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1 !important;
  border-right: none !important;
  color: var(--auth-text);
  font-weight: 600;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-size: 0.925rem;
  box-sizing: border-box;
}

.auth-card .input-group>.btn-outline-secondary:hover {
  background-color: #e2e8f0;
}

.auth-card .input-group:focus-within .btn-outline-secondary {
  border-color: var(--auth-primary) !important;
}

/* If the form-control is after the country code button (WhatsApp Phone input) */
.auth-card .input-group>.btn-outline-secondary+.form-control {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  border-left: none !important;
  border-top-right-radius: var(--auth-input-radius) !important;
  border-bottom-right-radius: var(--auth-input-radius) !important;
  border-right: 1px solid #cbd5e1 !important;
}

.auth-card .input-group>.btn-outline-secondary+.form-control:focus {
  border-color: var(--auth-primary) !important;
  border-left: none !important;
}

/* ---------- Dropdown Menu Customization ---------- */
.auth-card .dropdown-menu {
  background-color: #ffffff;
  border: 1px solid var(--auth-border);
  border-radius: 0.75rem;
  padding: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  margin-top: 5px;
}

.auth-card .dropdown-item {
  color: var(--auth-text);
  border-radius: 0.5rem;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.auth-card .dropdown-item:hover {
  background-color: #f1f5f9;
  color: var(--auth-primary);
}

/* ---------- Custom Checkbox ---------- */
.auth-card .form-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
}

.auth-card .form-check-input {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  cursor: pointer;
  transition: var(--transition-smooth);
  margin: 0;
  flex-shrink: 0;
}

.auth-card .form-check-input:checked {
  background-color: var(--auth-primary);
  border-color: var(--auth-primary);
}

.auth-card .form-check-label {
  font-size: 0.875rem;
  color: var(--auth-text-muted);
  cursor: pointer;
  line-height: 1.4;
  user-select: none;
}

/* ---------- Modern Row Layouts ---------- */
.auth-row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* ---------- Links & Custom Anchor Colors ---------- */
.auth-link,
.auth-card .text-primary,
.auth-footer-text a {
  color: var(--auth-primary) !important;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition-smooth);
}

.auth-link:hover,
.auth-card .text-primary:hover,
.auth-footer-text a:hover {
  color: var(--auth-primary-hover) !important;
  text-decoration: underline;
}

/* ---------- Action Buttons ---------- */
.auth-card .btn-primary {
  height: var(--auth-input-height);
  border-radius: var(--auth-btn-radius);
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-secondary) 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 115, 167, 0.15);
  transition: var(--transition-smooth);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-family: inherit;
  text-decoration: none !important;
}

.auth-card .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 115, 167, 0.25);
  background: linear-gradient(135deg, var(--auth-primary-hover) 0%, var(--auth-primary) 100%);
}

.auth-card .btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(15, 115, 167, 0.15);
}

.auth-card .btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-card .alert {
  display: block;
  width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  border-radius: 0.75rem;
  padding: 1rem 1.125rem;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  border: 1px solid transparent;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  line-height: 1.5;
  text-align: left;
}

.auth-card .alert.d-none {
  display: none !important;
}

.auth-card .alert-danger {
  background-color: #fef2f2;
  border-color: rgba(239, 68, 68, 0.15);
  color: #991b1b;
}

.auth-card .alert-success {
  background-color: #f0fdf4;
  border-color: rgba(34, 197, 94, 0.15);
  color: #166534;
}

.auth-card .alert-warning {
  background-color: #fffbeb;
  border-color: rgba(245, 158, 11, 0.15);
  color: #78350f;
}

.auth-card .alert-info {
  background-color: #eff6ff;
  border-color: rgba(59, 130, 246, 0.15);
  color: #1e40af;
}

.auth-card .alert a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

.auth-card .alert a:hover {
  opacity: 0.8;
}

.auth-card .alert i {
  display: inline-block;
  margin-right: 0.5rem;
  font-size: 1.1rem;
  vertical-align: -0.125em;
}

.auth-card .alert:last-child {
  margin-bottom: 0;
}

/* ---------- Cloudflare Turnstile ---------- */
.auth-card .cf-turnstile {
  display: flex;
  justify-content: center;
  margin-bottom: 0.5rem;
}

/* ---------- OTP Code Input Box ---------- */
.auth-otp-input {
  height: 60px;
  font-size: 2rem;
  text-align: center;
  font-weight: 700;
  border-radius: var(--auth-input-radius);
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
  color: var(--auth-text);
  transition: var(--transition-smooth);
  width: 100%;
  outline: none;
  box-sizing: border-box;
  font-family: 'Consolas', 'Monaco', monospace;
  letter-spacing: 1.25rem;
  padding-left: 1.25rem;
  /* Centering offset for letter spacing */
}

.auth-otp-input::placeholder {
  color: #cbd5e1;
}

.auth-otp-input:focus {
  background-color: #ffffff;
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 4px rgba(15, 115, 167, 0.1);
}

.auth-otp-email {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--auth-text);
  margin-bottom: 1.5rem;
  background-color: var(--auth-primary-light);
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  border: 1px solid rgba(15, 115, 167, 0.1);
}

/* ---------- Success States & Icons ---------- */
.auth-success-icon {
  font-size: 4rem;
  color: #22c55e;
  margin-bottom: 1.5rem;
  display: inline-block;
  animation: success-pulse 2s infinite;
}

@keyframes success-pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

.auth-success-text {
  color: #166534;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* ---------- Text & Footer Utilities ---------- */
.auth-footer-text {
  font-size: 0.9rem;
  color: var(--auth-text-muted);
  text-align: center;
  margin-top: 2rem;
  line-height: 1.5;
}

.auth-footer-text p {
  margin-bottom: 0.5rem;
}

.auth-footer-text a {
  font-weight: 700;
}

.d-grid {
  display: grid;
  width: 100%;
}

.auth-small-link {
  font-size: 0.85rem;
}

/* Divider HR Styles */
.auth-card hr {
  border: none;
  border-top: 1px solid var(--auth-border);
  margin: 1.75rem 0;
  opacity: 0.8;
}

/* Disabled resend tags */
#resendOtpLink.disabled,
#resendViaWaLink.disabled,
#resendViaWaLink2.disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* General Layout helpers */
.text-center {
  text-align: center;
}

.text-decoration-none {
  text-decoration: none !important;
}

.ms-1 {
  margin-left: 0.25rem;
}

.mb-0 {
  margin-bottom: 0 !important;
}

.mb-2 {
  margin-bottom: 0.5rem !important;
}

.mb-3 {
  margin-bottom: 1.25rem !important;
}

.mb-4 {
  margin-bottom: 1.75rem !important;
}

.d-none {
  display: none !important;
}

/* ============================================
   RESPONSIVE — Desktop Medium (< 1200px)
   ============================================ */
@media (max-width: 1199.98px) {
  .auth-split {
    grid-template-columns: 1fr 1fr;
  }

  .auth-visual {
    padding: 3rem;
  }

  .auth-visual-title {
    font-size: 2rem;
  }
}

/* ============================================
   RESPONSIVE — Tablet & Mobile (< 992px)
   ============================================ */
@media (max-width: 991.98px) {
  .auth-split {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    display: none;
  }

  .auth-form-panel {
    padding: 2.5rem 1.5rem;
    min-height: 100vh;
  }

  .auth-card {
    padding: 0;
    max-width: 400px;
    box-shadow: none;
    background: transparent;
    border: none;
  }

  .auth-mobile-logo {
    display: flex;
  }

  .auth-card-title,
  .auth-card-subtitle {
    text-align: center;
  }
}

/* ============================================
   RESPONSIVE — Small Mobile (< 576px)
   ============================================ */
@media (max-width: 575.98px) {
  .auth-form-panel {
    padding: 1.5rem 1rem;
    align-items: center;
  }

  .auth-card {
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
    background: transparent;
  }

  .auth-card::before {
    display: none;
  }

  .auth-card-title {
    font-size: 1.5rem;
  }

  .auth-card-subtitle {
    font-size: 0.875rem;
    margin-bottom: 1.75rem;
  }

  .auth-card .form-control,
  .auth-card .form-select,
  .auth-card .input-group-toggle,
  .auth-card .input-group .btn-outline-secondary {
    height: 46px;
    font-size: 0.875rem;
  }

  .auth-card .btn-primary {
    height: 46px;
    font-size: 0.9rem;
  }

  .auth-row-between {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .auth-row-between .form-check,
  .auth-row-between a {
    width: 100%;
  }

  .auth-row-between a {
    text-align: right;
  }

  .auth-otp-input {
    height: 52px;
    font-size: 1.5rem;
    letter-spacing: 0.75rem;
    padding-left: 0.75rem;
  }

  .auth-card .alert {
    padding: 0.875rem 1rem;
    font-size: 0.8rem;
    gap: 0.5rem;
  }
}