/* ============================================
   WhatsApp Chat Widget — Raslans Marketing
   ============================================ */

/* ── Notification Badge ── */
.wa-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
  z-index: 2;
  animation: badgePulse 2s ease-in-out infinite;
  pointer-events: none;
  font-family: 'Inter', sans-serif;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ── Shake Animation on Button ── */
@keyframes waShake {
  0% { transform: rotate(0deg); }
  10% { transform: rotate(-12deg); }
  20% { transform: rotate(12deg); }
  30% { transform: rotate(-10deg); }
  40% { transform: rotate(10deg); }
  50% { transform: rotate(-6deg); }
  60% { transform: rotate(6deg); }
  70% { transform: rotate(-3deg); }
  80% { transform: rotate(3deg); }
  90% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.whatsapp-float__btn.wa-shaking {
  animation: waShake 0.8s ease-in-out !important;
}

/* ── Chat Widget Container ── */
.wa-chat-widget {
  position: fixed;
  bottom: 100px;
  left: var(--space-6, 24px);
  z-index: 451;
  width: 370px;
  max-width: calc(100vw - 32px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 12px 60px rgba(0, 0, 0, 0.25),
    0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif;
  direction: rtl;
}

[dir="ltr"] .wa-chat-widget {
  left: auto;
  right: var(--space-6, 24px);
  direction: ltr;
}

.wa-chat-widget.wa-chat--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Chat Header ── */
.wa-chat__header {
  background: linear-gradient(135deg, #075e54 0%, #128c7e 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.wa-chat__header-close {
  position: absolute;
  top: 12px;
  left: 14px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 18px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

[dir="ltr"] .wa-chat__header-close {
  left: auto;
  right: 14px;
}

.wa-chat__header-close:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.wa-chat__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366, #128c7e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.wa-chat__header-info {
  flex: 1;
  min-width: 0;
}

.wa-chat__header-name {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-chat__header-status {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.wa-chat__header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #25d366;
  display: inline-block;
  animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Chat Body ── */
.wa-chat__body {
  background: #e5ddd5;
  background-image: url("data:image/svg+xml,%3Csvg width='400' height='400' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='p' width='80' height='80' patternUnits='userSpaceOnUse'%3E%3Cpath d='M0 0h80v80H0z' fill='none'/%3E%3Ccircle cx='40' cy='40' r='1.5' fill='%23d4cfc4' opacity='.3'/%3E%3Ccircle cx='10' cy='10' r='1' fill='%23d4cfc4' opacity='.2'/%3E%3Ccircle cx='70' cy='20' r='1' fill='%23d4cfc4' opacity='.2'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='400' height='400' fill='url(%23p)'/%3E%3C/svg%3E");
  padding: 16px;
  min-height: 200px;
  max-height: 350px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

/* ── Chat Messages ── */
.wa-chat__msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.55;
  position: relative;
  word-break: break-word;
  animation: msgSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.wa-chat__msg--received {
  background: #fff;
  align-self: flex-start;
  border-top-right-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

[dir="ltr"] .wa-chat__msg--received {
  border-top-right-radius: 8px;
  border-top-left-radius: 2px;
}

.wa-chat__msg--sent {
  background: #dcf8c6;
  align-self: flex-end;
  border-top-left-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

[dir="ltr"] .wa-chat__msg--sent {
  border-top-left-radius: 8px;
  border-top-right-radius: 2px;
}

.wa-chat__msg-sender {
  font-size: 12px;
  font-weight: 700;
  color: #075e54;
  margin-bottom: 3px;
}

.wa-chat__msg-time {
  font-size: 10.5px;
  color: rgba(0,0,0,0.4);
  margin-top: 4px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 3px;
  justify-content: flex-end;
}

[dir="rtl"] .wa-chat__msg-time {
  text-align: right;
  justify-content: flex-start;
}

.wa-chat__msg-time .wa-check {
  color: #53bdeb;
  font-size: 12px;
}

/* ── Typing Indicator ── */
.wa-chat__typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 8px;
  align-self: flex-start;
  max-width: 70px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  animation: msgSlideIn 0.3s ease-out;
}

.wa-chat__typing-dot {
  width: 7px;
  height: 7px;
  background: #90959a;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

.wa-chat__typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.wa-chat__typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* ── Chat Input Area ── */
.wa-chat__input-area {
  background: #f0f0f0;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wa-chat__input {
  flex: 1;
  border: none;
  background: #fff;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  direction: rtl;
  min-height: 40px;
  resize: none;
  line-height: 1.4;
}

[dir="ltr"] .wa-chat__input {
  direction: ltr;
}

.wa-chat__input::placeholder {
  color: #999;
}

.wa-chat__send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #25d366;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.wa-chat__send-btn:hover {
  background: #20ba5a;
  transform: scale(1.05);
}

.wa-chat__send-btn:active {
  transform: scale(0.95);
}

/* ── Contact Form Step ── */
.wa-chat__contact-form {
  padding: 16px;
  background: #fff;
  animation: msgSlideIn 0.35s ease-out;
}

.wa-chat__contact-title {
  font-size: 13px;
  font-weight: 700;
  color: #075e54;
  margin-bottom: 12px;
  text-align: center;
}

.wa-chat__form-group {
  margin-bottom: 10px;
}

.wa-chat__form-label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
  display: block;
}

.wa-chat__form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  direction: ltr;
  box-sizing: border-box;
}

.wa-chat__form-input:focus {
  border-color: #25d366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.12);
}

.wa-chat__phone-wrapper {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ── Custom Country Dropdown ── */
.wa-country-dropdown {
  position: relative;
  flex-shrink: 0;
}

.wa-country-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  min-width: 95px;
}

.wa-country-trigger:hover {
  border-color: #bbb;
}

.wa-country-trigger:focus,
.wa-country-trigger--open {
  border-color: #25d366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.12);
  outline: none;
}

.wa-country-flag {
  border-radius: 2px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 2px rgba(0,0,0,0.15);
}

.wa-country-trigger-code {
  font-weight: 600;
  color: #333;
  direction: ltr;
  font-size: 12.5px;
}

.wa-country-arrow {
  font-size: 9px;
  color: #999;
  transition: transform 0.2s;
  margin-right: auto;
}

.wa-country-trigger--open .wa-country-arrow {
  transform: rotate(180deg);
}

.wa-country-list {
  position: absolute;
  bottom: calc(100% + 4px);
  right: 0;
  left: auto;
  width: 240px;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1.5px solid #e5e5e5;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  z-index: 10;
  display: none;
  animation: msgSlideIn 0.2s ease-out;
  direction: ltr;
}

.wa-country-list--open {
  display: block;
}

.wa-country-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 12.5px;
  direction: ltr;
}

.wa-country-item:hover {
  background: #f0fdf4;
}

.wa-country-item--active {
  background: #ecfdf5;
}

.wa-country-item--active::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 10px;
  color: #25d366;
  margin-left: auto;
}

.wa-country-name {
  font-weight: 600;
  color: #333;
}

.wa-country-code {
  color: #999;
  font-size: 11.5px;
  margin-left: auto;
}

.wa-chat__phone-input {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  direction: ltr;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.wa-chat__phone-input:focus {
  border-color: #25d366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.12);
}

/* ── Form Error Messages ── */
.wa-chat__form-error {
  display: none;
  font-size: 11.5px;
  color: #ef4444;
  margin-top: 4px;
  padding-right: 2px;
  font-weight: 600;
  animation: msgSlideIn 0.25s ease-out;
}

/* ── Action Buttons ── */
.wa-chat__form-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.wa-chat__btn {
  width: 100%;
  padding: 11px 16px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  font-family: inherit;
}

.wa-chat__btn--send-anyway {
  background: #25d366;
  color: #fff;
}

.wa-chat__btn--send-anyway:hover {
  background: #20ba5a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

.wa-chat__btn--send-both {
  background: linear-gradient(135deg, #075e54 0%, #25d366 100%);
  color: #fff;
  display: none;
}

.wa-chat__btn--send-both:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(7, 94, 84, 0.4);
}

.wa-chat__btn--send-both.wa-visible {
  display: flex;
}

.wa-chat__btn--send-anyway.wa-hidden {
  display: none;
}

/* ── Thank You Step ── */
.wa-chat__thank-you {
  padding: 24px 16px;
  text-align: center;
  background: #fff;
  animation: msgSlideIn 0.4s ease-out;
}

.wa-chat__thank-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 26px;
  color: #fff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

.wa-chat__thank-title {
  font-size: 15px;
  font-weight: 800;
  color: #1f2937;
  margin-bottom: 6px;
}

.wa-chat__thank-desc {
  font-size: 12.5px;
  color: #6b7280;
  line-height: 1.6;
  margin-bottom: 4px;
}

/* ── Countdown ── */
.wa-chat__countdown-wrapper {
  margin-top: 16px;
  text-align: center;
}

.wa-chat__countdown-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.wa-chat__countdown-label i {
  color: #25d366;
  font-size: 16px;
}

.wa-chat__countdown-number {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.35);
  animation: countdownPulse 1s ease-in-out infinite;
}

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

/* ── Fallback Link ── */
.wa-chat__thank-fallback {
  margin-top: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.wa-chat__thank-fallback span {
  font-size: 11.5px;
  color: #9ca3af;
}

.wa-chat__fallback-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: #25d366;
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
  font-family: inherit;
}

.wa-chat__fallback-btn:hover {
  background: #20ba5a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.45);
  color: #fff;
}

.wa-chat__fallback-btn:active {
  transform: scale(0.97);
}

.wa-chat__fallback-btn i {
  font-size: 14px;
}

.wa-chat__thank-redirect {
  font-size: 11.5px;
  color: #9ca3af;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.wa-chat__thank-redirect i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Overlay for mobile ── */
.wa-chat-overlay {
  display: none;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .wa-chat-widget {
    width: calc(100vw - 16px);
    bottom: 85px;
    left: 8px;
    right: 8px;
    border-radius: 14px;
  }

  [dir="ltr"] .wa-chat-widget {
    left: 8px;
    right: 8px;
  }

  .wa-chat__body {
    max-height: 280px;
  }

  .wa-chat-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 450;
    pointer-events: none;
    transition: background 0.3s;
  }

  .wa-chat-overlay.wa-active {
    background: rgba(0, 0, 0, 0.4);
    pointer-events: all;
  }
}

@media (max-width: 360px) {
  .wa-chat__header {
    padding: 12px 14px;
  }

  .wa-chat__avatar {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .wa-chat__header-name {
    font-size: 13px;
  }

  .wa-country-trigger {
    min-width: 80px;
    padding: 8px 8px;
    font-size: 11px;
  }

  .wa-country-list {
    width: 190px;
  }
}
