/* =========================
   WHATSAPP CHAT WIDGET
   fidus.one — v1.0
   Separate from main.css.
   Remove old .whatsapp-float
   rules from main.css.
   ========================= */

/* ----- RESET OLD FLOAT ----- */
.whatsapp-float { display: none !important; }

/* ----- ROOT ----- */
#wa-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: inherit;
}

/* ----- TRIGGER BUTTON ----- */
#wa-trigger {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: #25D366;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 20px rgba(37,211,102,.45),
    0 2px 8px rgba(0,0,0,.25);
  transition: transform .2s cubic-bezier(.2,.8,.2,1),
              box-shadow .2s cubic-bezier(.2,.8,.2,1);
  position: relative;
  flex-shrink: 0;
}

#wa-trigger:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 8px 28px rgba(37,211,102,.55),
    0 4px 12px rgba(0,0,0,.3);
}

#wa-trigger svg {
  width: 30px;
  height: 30px;
  fill: #fff;
  transition: opacity .15s ease, transform .15s ease;
}

/* Close X shown when card is open */
#wa-trigger .wa-close-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: rotate(-90deg) scale(.7);
  transition: opacity .2s ease, transform .2s ease;
}

#wa-trigger .wa-close-icon svg {
  width: 22px;
  height: 22px;
}

#wa-trigger .wa-wa-icon {
  transition: opacity .2s ease, transform .2s ease;
}

#wa-widget.open #wa-trigger .wa-wa-icon {
  opacity: 0;
  transform: rotate(90deg) scale(.7);
}

#wa-widget.open #wa-trigger .wa-close-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Notification dot */
#wa-trigger::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ff4757;
  border: 2px solid #0d1018;
  animation: wa-pulse 2.2s ease-in-out infinite;
}

#wa-widget.open #wa-trigger::after {
  display: none;
}

@keyframes wa-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.2); opacity: .7; }
}

/* ----- CHAT CARD ----- */
#wa-card {
  width: 320px;
  border-radius: 20px;
  overflow: hidden;
  background: #161a27;
  border: 1px solid rgba(255,255,255,.09);
  box-shadow:
    0 24px 64px rgba(0,0,0,.55),
    0 0 0 1px rgba(124,92,255,.12),
    0 0 80px rgba(37,211,102,.06);

  /* Hidden state */
  opacity: 0;
  transform: translateY(14px) scale(.97);
  pointer-events: none;
  transition:
    opacity .25s cubic-bezier(.2,.8,.2,1),
    transform .25s cubic-bezier(.2,.8,.2,1);
}

#wa-widget.open #wa-card {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Card header — green band */
.wa-card-header {
  background: linear-gradient(135deg, #1a8c47 0%, #128c3e 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.wa-header-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  object-fit: contain;
  padding: 4px;
  flex-shrink: 0;
}

.wa-header-text {
  flex: 1;
  min-width: 0;
}

.wa-header-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin: 0 0 2px;
}

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

.wa-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7affa0;
  animation: wa-blink 2.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes wa-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .45; }
}

/* Chat bubble area */
.wa-card-body {
  padding: 18px;
  background: #0f1320;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-blend-mode: overlay;
}

.wa-bubble {
  background: #1e2338;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 4px 16px 16px 16px;
  padding: 12px 14px;
  margin-bottom: 8px;
  position: relative;
  animation: wa-bubble-in .3s .1s cubic-bezier(.2,.8,.2,1) both;
}

.wa-bubble::before {
  content: "";
  position: absolute;
  top: 0; left: -6px;
  border: 6px solid transparent;
  border-top-color: #1e2338;
  border-right-color: #1e2338;
}

@keyframes wa-bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wa-bubble p {
  font-size: 14px;
  color: #e4e7f0;
  line-height: 1.55;
  margin: 0;
}

.wa-bubble p + p { margin-top: 6px; }

.wa-bubble-time {
  font-size: 11px;
  color: rgba(255,255,255,.35);
  text-align: right;
  margin-top: 4px;
}

/* Message input row */
.wa-card-input {
  padding: 14px 16px;
  background: #161a27;
  display: flex;
  gap: 8px;
  align-items: center;
  border-top: 1px solid rgba(255,255,255,.07);
}

#wa-message {
  flex: 1;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: #e4e7f0;
  outline: none;
  resize: none;
  font-family: inherit;
  line-height: 1.4;
  min-height: 40px;
  max-height: 100px;
  transition: border-color .15s ease;
}

#wa-message::placeholder { color: rgba(255,255,255,.3); }
#wa-message:focus { border-color: rgba(37,211,102,.45); }

#wa-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #25D366;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s ease, transform .15s ease;
}

#wa-send:hover {
  background: #20c45c;
  transform: scale(1.06);
}

#wa-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Privacy note */
.wa-privacy {
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,.25);
  padding: 8px 16px 12px;
  background: #161a27;
}

.wa-privacy a {
  color: rgba(255,255,255,.35);
  text-decoration: none;
}

/* ----- RESPONSIVE ----- */
@media (max-width: 420px) {
  #wa-widget {
    right: 14px;
    bottom: 14px;
  }

  #wa-card {
    width: calc(100vw - 28px);
    max-width: 320px;
  }

  #wa-trigger {
    width: 52px;
    height: 52px;
  }
}

/* ----- REDUCED MOTION ----- */
@media (prefers-reduced-motion: reduce) {
  #wa-card,
  #wa-trigger,
  .wa-bubble,
  .wa-status-dot,
  #wa-trigger::after {
    animation: none !important;
    transition: none !important;
  }
}
