/* =========================================================
   Web Panchayat - Modern Full-Width Authentication Pages
   Zero side gaps, perfect eye toggle, responsive layout
   ========================================================= */

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  min-height: 100vh !important;
  background: #ffffff !important;
  font-family: "DM Sans", -apple-system, sans-serif;
  overflow-x: hidden;
}

/* FULL-WIDTH LAYOUT (NO GAPS ON LEFT OR RIGHT) */
.auth-layout {
  min-height: 100vh !important;
  width: 100vw !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  display: grid !important;
  grid-template-columns: 40% 60% !important;
  background: #ffffff !important;
}

/* =========================================================
   LEFT ASIDE BANNER
   ========================================================= */
.auth-aside {
  position: relative;
  overflow: hidden;
  padding: 48px clamp(24px, 5vw, 60px);
  color: #ffffff;
  background: linear-gradient(150deg, #092c22 0%, #174f3a 55%, #157347 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-aside::before {
  content: "";
  position: absolute;
  width: 480px;
  height: 480px;
  right: -140px;
  bottom: -140px;
  border-radius: 50%;
  border: 44px solid rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.auth-aside::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  left: -80px;
  top: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(134, 239, 172, 0.18) 0%, transparent 70%);
  pointer-events: none;
}

.auth-aside-navigation {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  position: relative;
  z-index: 5;
  width: 100% !important;
}

/* Clean, transparent Logo (No white rectangle box) */
.auth-brand {
  display: inline-flex !important;
  align-items: center !important;
  background: #ffffff !important;
  padding: 8px 16px !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
  text-decoration: none !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
  max-width: fit-content;
}

.auth-brand:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18) !important;
}

.auth-brand img.auth-brand-logo {
  height: 38px !important;
  width: auto !important;
  max-width: 170px !important;
  display: block !important;
  object-fit: contain !important;
}

.auth-aside-home-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  color: #ffffff !important;
  text-decoration: none !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  padding: 8px 16px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  background: rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease !important;
}

.auth-aside-home-link:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  border-color: rgba(255, 255, 255, 0.45) !important;
  transform: translateY(-1px);
}

.auth-aside-content {
  position: relative;
  z-index: 5;
  margin-top: auto;
  margin-bottom: auto;
  padding: 40px 0;
}

.auth-aside .eyebrow {
  margin: 0 0 12px;
  color: #86efac;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-aside h1 {
  font: 800 clamp(28px, 3.4vw, 46px) / 1.15 "Plus Jakarta Sans", sans-serif;
  letter-spacing: -0.03em;
  margin: 0;
  color: #ffffff;
}

/* =========================================================
   RIGHT FORM PANEL
   ========================================================= */
.panel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px clamp(20px, 4vw, 60px);
  background: #ffffff;
  overflow-y: auto;
  min-height: 100vh;
}

.screen {
  width: min(100%, 460px);
  margin: auto;
}

.screen.register-screen {
  width: min(100%, 520px);
}

.heading {
  margin-bottom: 24px;
}

.heading .eyebrow {
  margin: 0 0 8px;
  color: #15803d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.heading h2 {
  font: 800 30px "Plus Jakarta Sans", sans-serif;
  letter-spacing: -0.03em;
  color: #0f172a;
  margin: 0 0 8px;
}

.heading p:last-child {
  margin: 0;
  color: #64748b;
  font-size: 13.5px;
  line-height: 1.5;
}

/* =========================================================
   FORM FIELDS & INPUTS
   ========================================================= */
.auth-form {
  display: grid;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group > label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-group > label span.req {
  color: #dc2626;
  margin-left: 2px;
}

.form-group input,
.form-group select {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #174f3a;
  box-shadow: 0 0 0 3px rgba(23, 79, 58, 0.14);
}

/* =========================================================
   PREMIUM INTEGRATED PHONE INPUT (FLAG + +91)
   ========================================================= */
.phone-input-container {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 10px !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  cursor: text !important;
  padding: 0 !important;
}

.phone-input-container:hover {
  border-color: #94a3b8 !important;
}

.phone-input-container:focus-within {
  border-color: #174f3a !important;
  box-shadow: 0 0 0 3px rgba(23, 79, 58, 0.14) !important;
}

.phone-prefix {
  display: inline-flex !important;
  align-items: center !important;
  padding: 0 0 0 14px !important;
  user-select: none !important;
  flex-shrink: 0 !important;
  pointer-events: none !important;
  height: 48px !important;
  line-height: 48px !important;
  box-sizing: border-box !important;
}

.phone-flag {
  font-size: 17px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-right: 7px !important;
  transform: translateY(-0.5px) !important;
}

.phone-code {
  font-size: 14px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  letter-spacing: 0.3px !important;
  font-family: inherit !important;
  line-height: 48px !important;
  display: inline-flex !important;
  align-items: center !important;
}

.phone-divider {
  width: 1px !important;
  height: 18px !important;
  background: #cbd5e1 !important;
  margin: 0 10px !important;
  display: inline-block !important;
  align-self: center !important;
  flex-shrink: 0 !important;
}

.phone-input-container input {
  flex: 1 1 auto !important;
  width: 100% !important;
  height: 48px !important;
  line-height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  border: none !important;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 14px 0 0 !important;
  margin: 0 !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  font-family: inherit !important;
  color: #0f172a !important;
  letter-spacing: 0.6px !important;
  box-sizing: border-box !important;
  vertical-align: middle !important;
}

.phone-input-container input::placeholder {
  color: #94a3b8 !important;
  font-weight: 500 !important;
  font-size: 14px !important;
  line-height: 48px !important;
  letter-spacing: 0.4px !important;
  opacity: 1 !important;
}

.has-error .phone-input-container {
  border-color: #dc2626 !important;
  background-color: #fffafb !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

/* =========================================================
   PERFECT PASSWORD EYE TOGGLE (NO GREEN SQUARE)
   ========================================================= */
.password-input-wrap {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
}

.password-input-wrap input {
  width: 100% !important;
  padding-right: 44px !important;
}

.btn-toggle-eye,
button.btn-toggle-eye {
  position: absolute !important;
  right: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 6px !important;
  color: #64748b !important;
  transition: color 0.15s ease, background-color 0.15s ease !important;
  z-index: 5 !important;
  outline: none !important;
}

/* Explicitly destroy any injected pseudo-element icons like FontAwesome checkmarks or unicode */
.btn-toggle-eye::before,
.btn-toggle-eye::after,
button.btn-toggle-eye::before,
button.btn-toggle-eye::after,
.password-input-wrap button::before,
.password-input-wrap button::after,
.password-input-wrap *::before,
.password-input-wrap *::after {
  content: none !important;
  display: none !important;
}

.btn-toggle-eye:hover,
button.btn-toggle-eye:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

.btn-toggle-eye svg,
button.btn-toggle-eye svg {
  width: 20px !important;
  height: 20px !important;
  display: block !important;
  fill: none !important;
  stroke: #64748b !important;
  stroke-width: 2 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  transition: stroke 0.15s ease !important;
}

.btn-toggle-eye:hover svg,
button.btn-toggle-eye:hover svg {
  stroke: #174f3a !important;
}

/* =========================================================
   ERROR STATES & VALIDATION
   ========================================================= */
.has-error input,
.has-error select {
  border-color: #dc2626 !important;
  background-color: #fffafb !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

.field-error-text {
  display: block;
  color: #dc2626;
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 5px;
  animation: errorFadeIn 0.2s ease-in-out;
}

@keyframes errorFadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Form Two Column Row */
.form-row-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Gender Radio Cards */
.gender-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.gender-card {
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  transition: all 0.15s ease;
  user-select: none;
}

.gender-card input[type="radio"] {
  display: none;
}

.gender-card:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.gender-card.active {
  border-color: #16a34a;
  background: #f0fdf4;
  color: #15803d;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15);
}

/* Password Strength Bar */
.password-strength-wrap {
  margin-top: 7px;
}

.strength-bar-track {
  height: 4px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 4px;
}

.strength-bar-fill {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease, background 0.3s ease;
  border-radius: 99px;
}

.strength-text {
  font-size: 11px;
  font-weight: 700;
  display: block;
  text-align: right;
  color: #64748b;
}

/* Submit Button */
/* =========================================================
   SUBMIT BUTTON & MICRO-INTERACTIONS
   ========================================================= */
.btn-auth-submit {
  width: 100% !important;
  min-height: 50px !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #174f3a 0%, #15803d 100%) !important;
  color: #ffffff !important;
  font-family: inherit !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  letter-spacing: 0.2px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 22px -4px rgba(23, 79, 58, 0.35), 0 2px 6px rgba(0, 0, 0, 0.06) !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  margin-top: 8px !important;
  position: relative !important;
  overflow: hidden !important;
}

.btn-auth-submit::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  transition: left 0.6s ease;
  pointer-events: none;
}

.btn-auth-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #123e2e 0%, #166534 100%) !important;
  transform: translateY(-2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 12px 28px -4px rgba(23, 79, 58, 0.45), 0 4px 10px rgba(0, 0, 0, 0.08) !important;
}

.btn-auth-submit:hover:not(:disabled)::before {
  left: 100%;
}

.btn-auth-submit:active:not(:disabled) {
  transform: translateY(1px) scale(0.995);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(23, 79, 58, 0.25) !important;
}

.btn-auth-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-auth-submit span.arrow {
  display: inline-block;
  font-size: 16px;
  line-height: 1;
  transition: transform 0.25s ease;
}

.btn-auth-submit:hover:not(:disabled) span.arrow {
  transform: translateX(5px);
}

/* Spinner inside button */
.auth-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

/* =========================================================
   OTP INPUT BOXES (MODERN, RESPONSIVE, AUTO-ADVANCE)
   ========================================================= */
.otp-inputs {
  display: flex !important;
  justify-content: center !important;
  gap: 14px !important;
  margin: 12px 0 22px 0 !important;
}

.otp-inputs input {
  width: 64px !important;
  height: 70px !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: center !important;
  font-size: 28px !important;
  font-weight: 800 !important;
  font-family: "Plus Jakarta Sans", monospace !important;
  color: #0f172a !important;
  background: #f8fafc !important;
  border: 2px solid #cbd5e1 !important;
  border-radius: 14px !important;
  outline: none !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.otp-inputs input:hover {
  border-color: #94a3b8 !important;
  background: #ffffff !important;
}

.otp-inputs input:focus {
  border-color: #16a34a !important;
  background: #ffffff !important;
  color: #174f3a !important;
  transform: translateY(-2px) scale(1.04) !important;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.16), 0 6px 16px rgba(22, 163, 74, 0.12) !important;
}

.otp-inputs input.has-value {
  border-color: #174f3a !important;
  background: #ffffff !important;
  color: #174f3a !important;
}

/* =========================================================
   MODERN RESEND OTP CARD & BUTTON
   ========================================================= */
.resend-card {
  margin-top: 22px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.2s ease;
}

.resend-card:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.resend-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.resend-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.resend-subtitle {
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.35;
}

.btn-resend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  user-select: none;
}

/* When disabled (Cooldown active) */
.btn-resend:disabled {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #64748b;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-resend:disabled .resend-icon {
  opacity: 0.6;
}

/* When active (Ready to click) */
.btn-resend:not(:disabled) {
  background: #ffffff;
  border-color: #16a34a;
  color: #15803d;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.15);
}

.btn-resend:not(:disabled):hover {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
}

.btn-resend:not(:disabled):active {
  transform: translateY(1px);
}

.btn-resend .resend-icon {
  width: 15px;
  height: 15px;
  transition: transform 0.4s ease;
  flex-shrink: 0;
}

.btn-resend:not(:disabled):hover .resend-icon {
  transform: rotate(180deg);
}

.btn-resend.is-sending .resend-icon {
  animation: authSpin 0.8s linear infinite;
}

/* =========================================================
   AUTH MODE TABS (PASSWORD vs OTP)
   ========================================================= */
.auth-mode-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 20px;
  gap: 6px;
  border: 1px solid #e2e8f0;
}

.auth-mode-tab {
  flex: 1;
  padding: 10px 14px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-mode-tab.active {
  background: #ffffff;
  color: #174f3a;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.auth-mode-tab:hover:not(.active) {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.5);
}

/* =========================================================
   ALERTS, TOASTS & RATE LIMIT WARNING
   ========================================================= */
.rate-limit-warning {
  background: #fff1f2;
  border: 1.5px solid #fecdd3;
  border-left: 4px solid #e11d48;
  color: #9f1239;
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 18px;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.08);
  animation: errorFadeIn 0.25s ease;
}

.server-alert {
  background: #fff1f2;
  border: 1.5px solid #fecdd3;
  border-left: 4px solid #e11d48;
  color: #9f1239;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: errorFadeIn 0.2s ease-in-out;
}

.server-success {
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-left: 4px solid #16a34a;
  color: #166534;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: errorFadeIn 0.2s ease-in-out;
}

/* Quick Demo Helper Box */
.demo-helper-box {
  margin-top: 18px;
  padding: 12px 16px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  font-size: 12.5px;
  color: #166534;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.btn-demo-quick {
  background: #16a34a;
  color: #ffffff;
  border: none;
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-demo-quick:hover {
  background: #15803d;
  transform: translateY(-1px);
}

/* Footer Switch Text */
.switch-text {
  text-align: center;
  margin-top: 22px;
  font-size: 13.5px;
  color: #64748b;
}

.switch-text a {
  color: #16a34a;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s ease;
}

.switch-text a:hover {
  color: #15803d;
  text-decoration: underline;
}

/* =========================================================
   MOBILE RESPONSIVENESS (FLAWLESS TOUCH EXPERIENCE)
   ========================================================= */
@media (max-width: 920px) {
  .auth-layout {
    grid-template-columns: 1fr !important;
  }
  .auth-aside {
    padding: 30px 20px !important;
    min-height: auto;
  }
  .auth-aside-content {
    margin: 20px 0 !important;
    padding: 0 !important;
  }
  .auth-aside h1 {
    font-size: 26px !important;
  }
  .panel {
    padding: 30px 20px 50px !important;
    min-height: auto;
  }
  .screen.register-screen {
    width: 100% !important;
  }
}

@media (max-width: 540px) {
  .form-row-two {
    grid-template-columns: 1fr !important;
  }
  .gender-cards-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px;
  }
  .gender-card {
    padding: 8px 4px;
    font-size: 12px;
  }
  .otp-inputs {
    gap: 8px !important;
  }
  .otp-inputs input {
    width: 54px !important;
    height: 60px !important;
    font-size: 24px !important;
    border-radius: 12px !important;
  }
  .resend-card {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 12px;
    padding: 14px;
  }
  .resend-card-text {
    text-align: center;
  }
  .btn-resend {
    width: 100%;
    justify-content: center;
  }
}
