* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "vazir";
}

@font-face {
  font-family: "vazir";
  src: url("../font/vazir.331c39315fd6.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}

body {
  font-family: sans-serif;
  margin: 0;
  padding: 0;
  background: #f1f5f9;
  min-height: 100dvh;
  display: flex;
  overflow: hidden;
}

/* ===== SPLIT LAYOUT ===== */
.split-layout {
  display: flex;
  width: 100%;
  height: 100dvh;
}

/* ===== VISUAL SIDE ===== */
.split-visual {
  flex: 1.2;
  position: relative;
  background: linear-gradient(-45deg, var(--primary), var(--accent), var(--primary-hover), var(--accent-hover));
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
  padding: 40px;
  overflow: hidden;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.visual-content {
  position: relative;
  z-index: 10;
  text-align: center;
  max-width: 400px;
}
.visual-content h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 16px;
  text-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.visual-content p {
  font-size: 1.1rem;
  line-height: 1.6;
  opacity: 0.9;
}

/* Abstract glass shapes */
.shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: float 8s ease-in-out infinite;
}
.shape-1 {
  width: 300px; height: 300px;
  top: -100px; right: -50px;
  animation-delay: 0s;
}
.shape-2 {
  width: 200px; height: 200px;
  bottom: 10%; left: -40px;
  animation-delay: -2s;
}
.shape-3 {
  width: 150px; height: 150px;
  top: 40%; right: 20%;
  animation-delay: -4s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

/* ===== FORM SIDE ===== */
.split-form {
  flex: 1;
  max-width: 550px;
  background: #f8fafc;
  background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 24px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  box-shadow: 15px 0 40px rgba(0,0,0,0.08); /* shadow on right side of form pane */
  z-index: 5;
}

.login-box {
  width: 100%;
  max-width: 400px;
  min-height: 500px; /* Increased height to add more space */
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #ffffff;
  padding: 40px 32px;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0,0,0,0.05);
  position: relative;
  overflow: hidden; /* Fix top accent border bleeding */
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-box.fade-out {
  opacity: 0 !important;
  transform: translateY(-15px) !important;
  pointer-events: none;
}

.login-box.fade-in {
  opacity: 0 !important;
  transform: translateY(15px) !important;
}

.login-box.fade-in-active {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Creative top accent border */
.login-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 20px 20px 0 0;
}

.login-logo {
  text-align: center;
  margin-bottom: 16px;
}
.login-logo img {
  width: 80px; height: 80px;
  object-fit: contain;
}

.login-title {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
}
.login-description {
  text-align: center;
  font-size: 0.95rem;
  color: #6b7280;
  margin-bottom: 40px; /* Increased margin to avoid sticking to inputs */
}

/* ===== FLOATING LABELS ===== */
.form-group.floating {
  position: relative;
  margin-bottom: 20px;
}

.form-group.floating input {
  width: 100%;
  padding: 22px 14px 8px 14px;
  font-size: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
  color: #111827;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group.floating label {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14.5px;
  color: #9ca3af;
  pointer-events: none;
  transition: all 0.2s ease-out;
}

.form-group.floating input:focus,
.form-group.floating input.has-val {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 10%, transparent);
}

.form-group.floating input:focus + label,
.form-group.floating input.has-val + label {
  top: 12px;
  font-size: 11.5px;
  color: var(--primary);
  font-weight: 500;
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrapper input {
  padding-left: 45px !important; /* Space for eye icon */
}

.toggle-password {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: #9ca3af;
  transition: color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.toggle-password:hover {
  color: var(--primary);
}
.toggle-password svg {
  width: 20px; height: 20px;
}

/* ===== BUTTON ===== */
.btn-glow {
  width: 100%;
  padding: 14px;
  margin-top: 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px color-mix(in srgb, var(--primary) 30%, transparent);
}
.btn-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px color-mix(in srgb, var(--primary) 40%, transparent);
}

/* ===== ERROR STATE ===== */
.inline-error {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 12px;
  border-radius: 10px;
  font-size: 13.5px;
  text-align: center;
  margin-bottom: 20px;
  font-weight: 600;
}

.login-box.error-shake input {
  border-color: #ef4444 !important;
}
.login-box.error-shake input:focus {
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15) !important;
}

.error-shake {
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* ===== MOBILE & TABLET (Glassmorphism over Visual) ===== */
@media (max-width: 900px) {
  body {
    overflow-y: auto;
  }
  .split-layout {
    position: relative;
    justify-content: center;
    align-items: center;
    min-height: 100dvh; /* Allow it to grow */
    padding: 20px;
  }
  
  .split-visual {
    display: none !important; /* Hide visual side completely on mobile to prevent layout issues with custom templates */
  }
  .visual-content {
    display: none; 
  }
  
  .split-form {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 400px;
    background: #ffffff;
    background-image: none; /* Reset pattern */
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 30px 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    margin: auto; /* Centers it perfectly since the parent is flex */
  }

  .login-box {
    max-width: 100%;
    background: transparent; /* Reset desktop solid background */
    padding: 0;
    box-shadow: none;
  }
  .login-box::before {
    display: none; /* Hide accent line on mobile */
  }
  .login-logo img {
    width: 70px; height: 70px;
  }
}

@media (max-width: 400px) {
  .split-form {
    padding: 24px 20px;
    margin: auto; /* Ensure centered on small screens too */
  }
  .visual-content h1 {
    font-size: 1.5rem;
  }
  .login-title {
    font-size: 1.4rem;
  }
}


/* ===== DARK MODE ===== */
body.dark {
  background: #0f172a;
}
body.dark .split-form {
  background-color: #0f172a;
  background-image: radial-gradient(#334155 1px, transparent 1px);
  background-size: 24px 24px;
}
body.dark .login-box {
  background: #1e293b;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0,0,0,0.2);
}
body.dark .login-title {
  color: #f1f5f9;
}
body.dark .login-description {
  color: #94a3b8;
}
body.dark .form-group.floating input {
  background-color: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}
body.dark .form-group.floating input:focus,
body.dark .form-group.floating input.has-val {
  background-color: #1e293b;
}
body.dark .remember-me-container label {
  color: #94a3b8 !important;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  left: auto;
  z-index: 100;
  background: rgba(0,0,0,0.05);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}
.theme-toggle-btn:hover {
  background: rgba(0,0,0,0.1);
}
body.dark .theme-toggle-btn {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  color: #fff;
}
#iconSunLogin { display: none; }
#iconMoonLogin { display: block; }
body.dark #iconSunLogin { display: block; }
body.dark #iconMoonLogin { display: none; }

@media (max-width: 900px) {
  body.dark .split-form {
    background-color: #1e293b;
    border: 1px solid #334155;
    background-image: none; /* Make sure it overrides the desktop dot pattern */
  }
  body.dark .login-box {
    background: transparent;
    box-shadow: none;
  }
}

/* ===== OTP 5 SQUARES ===== */
.otp-container {
  display: flex;
  gap: 10px;
  justify-content: center;
  direction: ltr;
  margin-bottom: 20px;
}
.otp-box {
  width: 50px;
  height: 55px;
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  color: #111827;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.otp-box:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent);
  transform: translateY(-2px);
}
body.dark .otp-box {
  background-color: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}
body.dark .otp-box:focus {
  background-color: #1e293b;
}

/* ===== OTP VALIDATION STATES ===== */
.otp-box.otp-success {
  border-color: #10b981 !important;
  background-color: rgba(16, 185, 129, 0.05) !important;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15) !important;
}

body.dark .otp-box.otp-success {
  background-color: rgba(16, 185, 129, 0.1) !important;
}

.otp-box.otp-error {
  border-color: #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.05) !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15) !important;
  animation: otp-shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

body.dark .otp-box.otp-error {
  background-color: rgba(239, 68, 68, 0.1) !important;
}

@keyframes otp-shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

/* ===== CHOICE BUTTONS ===== */
.btn-choice {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1.5px solid #e5e7eb;
  background: #f8fafc;
  color: #374151;
  white-space: nowrap;
}
.btn-choice:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 15%, transparent);
}
.btn-choice svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  transition: all 0.25s ease;
  flex-shrink: 0;
}
.btn-choice:hover svg {
  transform: scale(1.1);
}
body.dark .btn-choice {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}
body.dark .btn-choice:hover {
  background: #1e293b;
  border-color: var(--primary);
  color: var(--primary);
}
