/* Frontend Lead Registration Form Styling */
.wa-crm-form-container {
  max-width: 800px;
  margin: 30px auto;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-radius: 12px !important;
  box-shadow: 0 15px 35px rgba(0, 94, 255, 0.05) !important;
  padding: 35px !important;
  font-family: var(--font-primary), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  box-sizing: border-box;
  transition: all 0.3s ease;
  
  /* Running 1px gradient border */
  border: 1px solid transparent !important;
  background: linear-gradient(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)) padding-box,
              linear-gradient(120deg, rgba(0, 94, 255, 0.35), rgba(190, 255, 1, 0.35), rgba(0, 94, 255, 0.35), rgba(190, 255, 1, 0.35)) border-box !important;
  background-size: 100% 100%, 300% 300% !important;
  animation: waBorderGlow 8s ease infinite !important;
}

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

.wa-crm-form-container:hover {
  box-shadow: 0 20px 45px rgba(0, 94, 255, 0.1) !important;
}

/* Theme specific overrides for soft semi-transparency */
html[data-theme="light"] .wa-crm-form-container {
  border: 1px solid transparent !important;
  background: linear-gradient(rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92)) padding-box,
              linear-gradient(120deg, rgba(0, 94, 255, 0.35), rgba(190, 255, 1, 0.35), rgba(0, 94, 255, 0.35), rgba(190, 255, 1, 0.35)) border-box !important;
  background-size: 100% 100%, 300% 300% !important;
  animation: waBorderGlow 8s ease infinite !important;
}

html[data-theme="dark"] .wa-crm-form-container {
  border: 1px solid transparent !important;
  background: linear-gradient(rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.85)) padding-box,
              linear-gradient(120deg, rgba(0, 94, 255, 0.45), rgba(190, 255, 1, 0.45), rgba(0, 94, 255, 0.45), rgba(190, 255, 1, 0.45)) border-box !important;
  background-size: 100% 100%, 300% 300% !important;
  animation: waBorderGlow 8s ease infinite !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3) !important;
}

.wa-crm-form-container * {
  box-sizing: border-box;
}

.wa-crm-form-header {
  text-align: center;
  margin-bottom: 30px;
}

.wa-crm-form-header h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary, #0f172a) !important;
  margin: 0 0 10px 0;
  font-family: var(--font-display), sans-serif !important;
}

.wa-crm-form-header p {
  font-size: 14px;
  color: var(--text-secondary, #64748b) !important;
  margin: 0;
}

.wa-crm-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 600px) {
  .wa-crm-form-grid {
    grid-template-columns: 1fr;
  }
  .wa-crm-form-container {
    padding: 15px !important;
  }
}

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

.wa-crm-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #334155) !important;
  margin-bottom: 8px;
}

.wa-crm-form-group label .required {
  color: #ef4444;
}

.wa-crm-form-group input,
.wa-crm-form-group select {
  height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border-color, #cbd5e1) !important;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-primary, #0f172a) !important;
  background-color: var(--bg-primary, #ffffff) !important;
  transition: all 0.2s ease-in-out;
  outline: none;
}

.wa-crm-form-group input:focus,
.wa-crm-form-group select:focus {
  border-color: var(--accent-primary, #005eff) !important;
  box-shadow: 0 0 0 3px rgba(0, 94, 255, 0.15) !important;
}

.wa-crm-form-footer {
  margin-top: 30px;
  text-align: center;
}

.wa-crm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--accent-primary, #005eff) !important;
  color: #ffffff !important;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 30px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  width: 100%;
  position: relative;
}

.wa-crm-btn:hover {
  background-color: #004ecc !important;
  box-shadow: 0 4px 15px rgba(0, 94, 255, 0.2) !important;
}

.wa-crm-btn:disabled {
  background-color: #94a3b8 !important;
  cursor: not-allowed;
}

/* Loading Spinner */
.btn-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: wa-spin 0.8s linear infinite;
}

@keyframes wa-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Feedback messages */
.wa-crm-message {
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

.wa-crm-message.success {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.wa-crm-message.error {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

/* Wizard step structures */
.wa-crm-form-step {
  display: none;
}

.wa-crm-form-step.active {
  display: block;
  animation: waFadeSlideIn 0.4s ease forwards;
}

@keyframes waFadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Progress bar styles */
.wa-crm-wizard-progress-bar {
  margin-bottom: 35px;
  position: relative;
}

.wa-crm-wizard-progress-line {
  height: 6px;
  background-color: #e2e8f0;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}

.wa-crm-wizard-progress-fill {
  height: 100%;
  width: 33.33%;
  background: linear-gradient(90deg, #005eff 0%, #beff01 100%);
  border-radius: 10px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.wa-crm-wizard-steps-indicator {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}

.wa-crm-wizard-step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  text-align: center;
}

.wa-crm-wizard-step-node .step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #f1f5f9;
  border: 2px solid #cbd5e1;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  margin-bottom: 6px;
  z-index: 2;
}

.wa-crm-wizard-step-node .step-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  transition: all 0.3s ease;
}

.wa-crm-wizard-step-node.active .step-num {
  background-color: #005eff;
  border-color: #005eff;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(0, 94, 255, 0.15);
}

.wa-crm-wizard-step-node.active .step-label {
  color: #005eff;
}

.wa-crm-wizard-step-node.completed .step-num {
  background-color: #beff01;
  border-color: #beff01;
  color: #0f172a;
}

.wa-crm-wizard-step-node.completed .step-label {
  color: #0f172a;
}

.wa-crm-wizard-navigation {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 15px;
  width: 100%;
}

.wa-crm-nav-btn {
  width: 180px;
  max-width: 100%;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  border: none;
  box-sizing: border-box;
}

.wa-crm-btn-prev {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

.wa-crm-btn-prev:hover {
  background-color: #e2e8f0 !important;
}

.wa-crm-btn-next {
  background-color: var(--accent-primary, #005eff) !important;
  color: #ffffff !important;
}

.wa-crm-btn-next:hover {
  background-color: #004ecc !important;
  box-shadow: 0 4px 15px rgba(0, 94, 255, 0.2) !important;
}

/* Form container wizard submit adjustments */
.wa-crm-form-container[data-layout="wizard"] #wa-crm-submit-btn {
  width: 180px;
  max-width: 100%;
  height: 48px;
}

/* Error styles & animations */
.wa-crm-form-group input.input-error,
.wa-crm-form-group select.input-error {
  border-color: #ef4444 !important;
  background-color: #fef2f2 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.wa-crm-shake {
  animation: waShake 0.4s ease;
}

@keyframes waShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* Mobile-first overrides */
@media (max-width: 600px) {
  .wa-crm-form-container {
    padding: 20px !important;
    margin: 20px auto;
  }
  .wa-crm-form-header h3 {
    font-size: 20px;
  }
  .wa-crm-wizard-progress-bar {
    margin-bottom: 25px;
  }
  .wa-crm-wizard-step-node .step-label {
    font-size: 11px;
  }
  .wa-crm-wizard-step-node .step-num {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  .wa-crm-nav-btn, 
  #wa-crm-submit-btn {
    height: 46px;
    font-size: 14px;
  }
}

/* Glassmorphic Success Overlay */
.wa-crm-success-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  overflow: hidden;
  animation: waFadeIn 0.3s ease forwards;
}

.wa-crm-success-modal {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 24px 30px;
  max-width: 450px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-sizing: border-box;
  animation: waScaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
  
  /* Modal scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.wa-crm-success-modal::-webkit-scrollbar {
  width: 6px;
}
.wa-crm-success-modal::-webkit-scrollbar-track {
  background: transparent;
}
.wa-crm-success-modal::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 10px;
}

@keyframes waFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes waScaleIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Success Checkmark Animation */
.wa-crm-success-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 15px auto;
}

.wa-crm-checkmark {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: block;
  stroke-width: 2;
  stroke: #22c55e;
  stroke-miterlimit: 10;
  box-shadow: inset 0px 0px 0px #22c55e;
  animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
}

.wa-crm-checkmark-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 2;
  stroke-miterlimit: 10;
  stroke: #22c55e;
  fill: none;
  animation: stroke .6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.wa-crm-checkmark-check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  stroke: #22c55e;
  animation: stroke .3s cubic-bezier(0.65, 0, 0.45, 1) .8s forwards;
}

@keyframes stroke {
  100% { stroke-dashoffset: 0; }
}

@keyframes scale {
  0%, 100% { transform: none; }
  50% { transform: scale3d(1.1, 1.1, 1); }
}

@keyframes fill {
  100% { box-shadow: inset 0px 0px 0px 40px rgba(34, 197, 94, 0.1); }
}

/* Success Badge (VIP) */
.wa-crm-success-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: waPulse 2s infinite;
}

@keyframes waPulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.wa-crm-success-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px 0;
}

.wa-crm-success-desc {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
  margin: 0 0 20px 0;
}

/* Zalo Box styling */
.wa-crm-success-zalo-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 20px;
}

.wa-crm-zalo-promo {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  margin: 0 0 10px 0;
}

.wa-crm-zalo-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.wa-crm-btn-zalo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #0068ff !important;
  color: #ffffff !important;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 20px;
  height: 38px;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
  width: 100%;
}

.wa-crm-btn-zalo:hover {
  background-color: #0056d6 !important;
  box-shadow: 0 4px 12px rgba(0, 104, 255, 0.25);
}

.wa-crm-zalo-qr-container {
  background: #ffffff;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  text-align: center;
  max-width: 210px;
  width: 100%;
  animation: waFadeIn 0.3s ease forwards;
}

.wa-crm-zalo-qr-img {
  width: 150px;
  height: 150px;
  display: block;
  margin: 0 auto 8px auto;
}

.wa-crm-zalo-qr-hint {
  font-size: 11px;
  color: #64748b;
  margin: 0;
  line-height: 1.3;
}

/* Side-by-side Zalo action on Desktop for safe-spacing and compactness */
@media (min-width: 601px) {
  .wa-crm-zalo-actions {
    flex-direction: row !important;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    text-align: left;
  }
  .wa-crm-btn-zalo {
    flex: 1;
    margin: 0;
  }
  .wa-crm-zalo-qr-container {
    flex: 0 0 130px;
    margin: 0 !important;
    padding: 8px !important;
  }
  .wa-crm-zalo-qr-img {
    width: 100px !important;
    height: 100px !important;
    margin-bottom: 4px !important;
  }
  .wa-crm-zalo-qr-hint {
    font-size: 9px !important;
  }
}

.wa-crm-success-divider {
  border: 0;
  height: 1px;
  background: #e2e8f0;
  margin: 0 0 15px 0;
}

/* Modal secondary buttons */
.wa-crm-success-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.wa-crm-success-buttons > * {
  flex: 1;
}

.wa-crm-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #f1f5f9 !important;
  color: #475569 !important;
  font-size: 13px;
  font-weight: 600;
  height: 38px;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid #cbd5e1 !important;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.wa-crm-btn-secondary:hover {
  background-color: #e2e8f0 !important;
  color: #1e293b !important;
}

.wa-crm-btn-close {
  background-color: #0f172a !important;
  color: #ffffff !important;
  font-size: 13px;
  font-weight: 600;
  height: 38px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.wa-crm-btn-close:hover {
  background-color: #1e293b !important;
}

/* Countdown bar styling */
.wa-crm-countdown-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
}

#wa-crm-countdown-text {
  font-size: 12px;
  color: #64748b;
}

.wa-crm-btn-pause {
  background: none;
  border: none;
  font-size: 11px;
  color: #005eff;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.wa-crm-btn-pause:hover {
  background-color: rgba(0, 94, 255, 0.08);
}

.wa-crm-countdown-progress-bar {
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 4px;
  position: relative;
}

.wa-crm-countdown-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: #005eff;
  border-radius: 10px;
  transition: width 1s linear;
}

/* Success Overlay Responsive overrides */
@media (max-width: 600px) {
  .wa-crm-success-modal {
    padding: 20px 15px !important;
    max-height: calc(100vh - 30px) !important;
  }
  .wa-crm-success-icon {
    width: 50px !important;
    height: 50px !important;
    margin-bottom: 12px !important;
  }
  .wa-crm-checkmark {
    width: 50px !important;
    height: 50px !important;
  }
  .wa-crm-success-title {
    font-size: 18px !important;
    margin-bottom: 6px !important;
  }
  .wa-crm-success-desc {
    font-size: 12px !important;
    margin-bottom: 12px !important;
  }
  .wa-crm-success-zalo-box {
    padding: 12px !important;
    margin-bottom: 12px !important;
  }
  .wa-crm-zalo-actions {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .wa-crm-zalo-qr-container {
    display: none !important;
  }
  .wa-crm-success-buttons {
    flex-direction: column !important;
    gap: 6px !important;
    margin-bottom: 12px !important;
  }
  .wa-crm-success-buttons > * {
    width: 100% !important;
  }
  .wa-crm-btn-close, .wa-crm-btn-secondary {
    height: 36px !important;
    font-size: 12px !important;
  }
  .wa-crm-countdown-container {
    padding: 6px 8px !important;
  }
}

/* Privacy Consent Checkbox (Decree 13 / GDPR) */
.wa-crm-privacy-group {
  margin-top: 15px;
  margin-bottom: 10px;
}
.wa-crm-privacy-label input[type="checkbox"] {
  accent-color: var(--accent-primary, #005eff) !important;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  border-radius: 4px !important;
  cursor: pointer;
  margin-top: 3px;
}
.wa-crm-privacy-label span {
  font-size: 13px;
  color: var(--text-secondary, #475569) !important;
  line-height: 1.4;
}
.wa-crm-privacy-label span a {
  color: var(--accent-primary, #005eff) !important;
  text-decoration: none;
  font-weight: 600;
}
.wa-crm-privacy-label span a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Dark Mode Contrast Overrides
   ========================================================================== */
html[data-theme="dark"] .wa-crm-form-group label {
  color: var(--text-secondary, #94a3b8) !important;
}

html[data-theme="dark"] .wa-crm-form-group input,
html[data-theme="dark"] .wa-crm-form-group select {
  background-color: var(--bg-secondary, #1b253b) !important;
  color: var(--text-primary, #ffffff) !important;
  border-color: var(--border-color, rgba(255, 255, 255, 0.1)) !important;
}

html[data-theme="dark"] .wa-crm-form-group select option {
  background-color: var(--bg-secondary, #1b253b) !important;
  color: var(--text-primary, #ffffff) !important;
}

html[data-theme="dark"] .wa-crm-privacy-label span {
  color: var(--text-secondary, #94a3b8) !important;
}

/* Success Modal Dark Mode Override */
html[data-theme="dark"] .wa-crm-success-modal {
  background: var(--bg-secondary, #0c101d) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: var(--text-primary, #ffffff) !important;
}

html[data-theme="dark"] .wa-crm-success-title {
  color: var(--text-primary, #ffffff) !important;
}

html[data-theme="dark"] .wa-crm-success-desc {
  color: var(--text-secondary, #94a3b8) !important;
}

html[data-theme="dark"] .wa-crm-success-zalo-box {
  background: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .wa-crm-zalo-promo {
  color: var(--text-primary, #ffffff) !important;
}

html[data-theme="dark"] .wa-crm-countdown-pause {
  color: var(--text-primary, #ffffff) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  background: rgba(255, 255, 255, 0.03) !important;
}
html[data-theme="dark"] .wa-crm-countdown-pause:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}
