/* ==========================================================================
   WhatsApp Floating Widget & Multi-Step Inquiry Modal
   ========================================================================== */

/* Variables */
:root {
  --wa-primary: #25D366;
  --wa-primary-hover: #20ba5a;
  --wa-dark: #128C7E;
  --wa-darker: #075E54;
  --wa-text: #111827;
  --wa-muted: #64748b;
  --wa-border: #e2e8f0;
  --wa-bg-light: #f8fafc;
  --wa-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --wa-glow: 0 4px 20px rgba(37, 211, 102, 0.45);
}

/* Floating WhatsApp Button (Bottom Left) */
.wa-float-btn {
  position: fixed;
  bottom: 25px;
  left: 25px;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #25D366 0%, #1ea952 100%);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5), 0 2px 6px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  z-index: 999990;
  border: none;
  outline: none;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  animation: wa-bounce-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.wa-float-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 10px 26px rgba(37, 211, 102, 0.6), 0 4px 10px rgba(0, 0, 0, 0.2);
}

.wa-float-btn:active {
  transform: scale(0.96);
}

.wa-float-btn svg {
  width: 34px;
  height: 34px;
  fill: #ffffff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

/* Pulse animation ripple ring */
.wa-float-btn::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid #25D366;
  opacity: 0.8;
  animation: wa-pulse-ring 2.2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  pointer-events: none;
}

@keyframes wa-pulse-ring {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.3);
    opacity: 0;
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

@keyframes wa-bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.3) translateY(20px);
  }
  60% {
    opacity: 1;
    transform: scale(1.08) translateY(-4px);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

/* Tooltip badge on WhatsApp button */
.wa-float-tooltip {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: #111827;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wa-float-tooltip::after {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border-width: 5px 6px 5px 0;
  border-style: solid;
  border-color: transparent #111827 transparent transparent;
}

.wa-float-tooltip-dot {
  width: 7px;
  height: 7px;
  background: #25D366;
  border-radius: 50%;
  display: inline-block;
}

.wa-float-btn:hover .wa-float-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(2px);
}

/* Modal Overlay Backdrop */
.wa-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  box-sizing: border-box;
}

.wa-modal-backdrop.wa-show {
  opacity: 1;
  visibility: visible;
}

/* Modal Container */
.wa-modal-card {
  position: relative;
  background: #ffffff;
  width: 100%;
  max-width: 440px;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  transform: scale(0.94) translateY(15px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.wa-modal-backdrop.wa-show .wa-modal-card {
  transform: scale(1) translateY(0);
}

/* Top bar with Logo & Close */
.wa-modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 10px 20px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
}

.wa-modal-logo {
  height: 32px;
  max-width: 130px;
  object-fit: contain;
}

.wa-modal-logo-placeholder {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.3px;
}

.wa-modal-close {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  transition: background-color 0.2s, color 0.2s, transform 0.2s;
  padding: 0;
}

.wa-modal-close:hover {
  background: #fee2e2;
  color: #ef4444;
  transform: rotate(90deg);
}

/* Scrollable Body */
.wa-modal-body {
  padding: 18px 22px 22px 22px;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Header with WhatsApp Logo */
.wa-header-section {
  text-align: center;
  margin-bottom: 20px;
}

.wa-header-icon-circle {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #25D366 0%, #1ea952 100%);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(37, 211, 102, 0.35);
  margin-bottom: 12px;
}

.wa-header-icon-circle svg {
  width: 34px;
  height: 34px;
  fill: #ffffff;
}

.wa-header-title {
  margin: 0 0 6px 0;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.4px;
  line-height: 1.25;
}

.wa-header-subtitle {
  margin: 0 auto;
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.45;
  max-width: 320px;
}

/* Form Styles */
.wa-form-group {
  margin-bottom: 15px;
  text-align: left;
}

.wa-form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.wa-form-label svg {
  width: 14px;
  height: 14px;
  fill: #64748b;
  flex-shrink: 0;
}

.wa-req-star {
  color: #ef4444;
}

.wa-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.wa-form-input,
.wa-form-textarea {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14.5px;
  font-family: inherit;
  color: #0f172a;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.wa-form-input::placeholder,
.wa-form-textarea::placeholder {
  color: #94a3b8;
  font-size: 14px;
}

.wa-form-input:focus,
.wa-form-textarea:focus {
  border-color: #25D366;
  box-shadow: 0 0 0 3.5px rgba(37, 211, 102, 0.18);
  background: #ffffff;
}

.wa-form-textarea {
  resize: vertical;
  min-height: 80px;
  max-height: 160px;
  line-height: 1.45;
}

/* Mobile input group with country code */
.wa-phone-group {
  display: flex;
  gap: 8px;
}

.wa-country-select-wrapper {
  position: relative;
  flex-shrink: 0;
  width: 95px;
}

.wa-country-select {
  width: 100%;
  height: 100%;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #0f172a;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
  padding-right: 22px;
}

.wa-country-select:focus {
  border-color: #25D366;
  box-shadow: 0 0 0 3.5px rgba(37, 211, 102, 0.18);
}

.wa-country-arrow {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  width: 10px;
  height: 10px;
  fill: #64748b;
}

/* Input error state */
.wa-form-group.wa-has-error .wa-form-input,
.wa-form-group.wa-has-error .wa-form-textarea,
.wa-form-group.wa-has-error .wa-country-select {
  border-color: #ef4444;
  background-color: #fffaf0;
}

.wa-field-error {
  display: none;
  font-size: 12px;
  color: #ef4444;
  margin-top: 4px;
  font-weight: 500;
}

.wa-form-group.wa-has-error .wa-field-error {
  display: block;
}

/* Submit Button */
.wa-submit-btn {
  width: 100%;
  background: linear-gradient(135deg, #25D366 0%, #1ea952 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 13px 18px;
  font-size: 15.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s;
  margin-top: 18px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.wa-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.55);
}

.wa-submit-btn:active {
  transform: translateY(1px);
}

.wa-submit-btn svg {
  width: 20px;
  height: 20px;
  fill: #ffffff;
  flex-shrink: 0;
}

.wa-btn-chevron {
  font-size: 18px;
  margin-left: 2px;
  transition: transform 0.2s;
}

.wa-submit-btn:hover .wa-btn-chevron {
  transform: translateX(3px);
}

/* Trust footer note */
.wa-trust-footer {
  text-align: center;
  margin-top: 14px;
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.wa-trust-footer svg {
  width: 13px;
  height: 13px;
  fill: #94a3b8;
}

/* ==========================================================================
   State 2: Submitting State & State 3: Redirect State
   ========================================================================== */

.wa-state-container {
  display: none;
  text-align: center;
  padding: 50px 20px 40px 20px;
}

/* Spinner for Step 2 */
.wa-spinner {
  width: 56px;
  height: 56px;
  border: 4.5px solid #e2e8f0;
  border-top-color: #25D366;
  border-radius: 50%;
  animation: wa-spin 0.85s linear infinite;
  margin: 0 auto 22px auto;
}

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

.wa-state-title {
  margin: 0 0 10px 0;
  font-size: 21px;
  font-weight: 700;
  color: #0f172a;
}

.wa-state-subtitle {
  margin: 0 auto;
  font-size: 14.5px;
  color: #64748b;
  max-width: 300px;
  line-height: 1.5;
}

/* Step 3: Redirecting Animation */
.wa-redirect-icon {
  width: 72px;
  height: 72px;
  background: #25D366;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow: 0 10px 25px rgba(37, 211, 102, 0.45);
  animation: wa-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.wa-redirect-icon svg {
  width: 44px;
  height: 44px;
  fill: #ffffff;
}

@keyframes wa-pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.wa-redirect-manual-btn {
  display: inline-block;
  margin-top: 18px;
  padding: 10px 18px;
  background: #f1f5f9;
  color: #0f172a;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.wa-redirect-manual-btn:hover {
  background: #25D366;
  color: #ffffff;
  text-decoration: none;
}

/* Step Switching */
.wa-view-form .wa-state-form { display: block; }
.wa-view-submitting .wa-state-form { display: none; }
.wa-view-submitting .wa-state-submitting { display: block; }

.wa-view-redirect .wa-state-form { display: none; }
.wa-view-redirect .wa-state-submitting { display: none; }
.wa-view-redirect .wa-state-redirect { display: block; }

/* Responsive Adjustments */
@media screen and (max-width: 480px) {
  .wa-float-btn {
    bottom: 20px;
    left: 20px;
    width: 54px;
    height: 54px;
  }
  
  .wa-float-btn svg {
    width: 30px;
    height: 30px;
  }

  .wa-modal-backdrop {
    padding: 10px;
    align-items: flex-end; /* Bottom sheet on very small mobile */
  }

  .wa-modal-card {
    border-radius: 20px 20px 12px 12px;
    max-height: 94vh;
  }

  .wa-modal-body {
    padding: 14px 16px 20px 16px;
  }

  .wa-header-title {
    font-size: 20px;
  }

  .wa-float-tooltip {
    display: none; /* Hide hover tooltip on touch devices */
  }
}
