/* Sultanate Developers — on-site WhatsApp-style webchat (no external CDNs) */
:root {
  --wc-green: #075e54;
  --wc-green-2: #128c7e;
  --wc-green-3: #25d366;
  --wc-teal: #dcf8c6;
  --wc-bg: #e5ddd5;
  --wc-panel: #ffffff;
  --wc-text: #111b21;
  --wc-muted: #667781;
  --wc-border: rgba(0, 0, 0, 0.08);
  --wc-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
  --wc-radius: 16px;
  --wc-z: 99990;
}

#wc-root, #wc-root * { box-sizing: border-box; }

#wc-root {
  position: fixed;
  inset: auto 16px 16px auto;
  z-index: var(--wc-z);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: var(--wc-text);
  pointer-events: none;
}

#wc-root button, #wc-root a, #wc-root input, #wc-root textarea {
  pointer-events: auto;
  font: inherit;
}

.wc-panel {
  pointer-events: auto;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 96px));
  background: var(--wc-panel);
  border-radius: var(--wc-radius);
  box-shadow: var(--wc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  visibility: hidden;
  margin-bottom: 12px;
}

.wc-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.wc-header {
  background: linear-gradient(135deg, var(--wc-green), var(--wc-green-2));
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 56px;
}

.wc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #0b1f3a;
  border: 2px solid rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.wc-avatar img, .wc-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.wc-header-meta { flex: 1; min-width: 0; }
.wc-header-title {
  font-weight: 650;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wc-header-sub {
  font-size: 12px;
  opacity: 0.9;
}

.wc-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wc-icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.wc-icon-btn:hover, .wc-icon-btn:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}
.wc-icon-btn svg { width: 18px; height: 18px; fill: currentColor; }

.wc-fallback {
  display: none;
  position: absolute;
  right: 48px;
  top: 52px;
  background: #fff;
  color: var(--wc-text);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  padding: 8px;
  min-width: 180px;
  z-index: 2;
}
.wc-fallback.is-open { display: block; }
.wc-fallback a {
  display: block;
  padding: 8px 10px;
  color: var(--wc-green);
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
}
.wc-fallback a:hover, .wc-fallback a:focus-visible {
  background: #f0f2f5;
  outline: none;
}

.wc-header { position: relative; }

.wc-messages {
  flex: 1;
  overflow-y: auto;
  background: var(--wc-bg);
  background-image:
    radial-gradient(rgba(0,0,0,0.03) 1px, transparent 1px);
  background-size: 18px 18px;
  padding: 14px 12px 10px;
  -webkit-overflow-scrolling: touch;
}

.wc-day {
  text-align: center;
  margin: 6px 0 12px;
}
.wc-day span {
  display: inline-block;
  background: rgba(255,255,255,0.92);
  color: var(--wc-muted);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.06);
}

.wc-row {
  display: flex;
  margin: 0 0 6px;
}
.wc-row.is-user { justify-content: flex-end; }
.wc-row.is-bot { justify-content: flex-start; }

.wc-bubble {
  max-width: 82%;
  padding: 7px 9px 5px;
  border-radius: 8px;
  position: relative;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.08);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.wc-row.is-bot .wc-bubble {
  background: #fff;
  border-top-left-radius: 0;
}
.wc-row.is-user .wc-bubble {
  background: var(--wc-teal);
  border-top-right-radius: 0;
}
.wc-bubble-text { font-size: 14px; }
.wc-bubble-meta {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--wc-muted);
}

.wc-attach {
  display: block;
  margin-top: 6px;
  color: var(--wc-green-2);
  font-size: 13px;
}
.wc-attach img {
  max-width: 100%;
  border-radius: 6px;
  display: block;
  margin-top: 4px;
}

.wc-typing {
  display: none;
  align-items: center;
  gap: 4px;
  background: #fff;
  width: fit-content;
  padding: 10px 12px;
  border-radius: 8px;
  border-top-left-radius: 0;
  margin: 4px 0 8px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.08);
}
.wc-typing.is-on { display: inline-flex; }
.wc-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #90949c;
  animation: wc-bounce 1.2s infinite ease-in-out;
}
.wc-typing i:nth-child(2) { animation-delay: 0.15s; }
.wc-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes wc-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.wc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 0;
  background: transparent;
}
.wc-chip {
  appearance: none;
  border: 1px solid rgba(7, 94, 84, 0.35);
  background: #fff;
  color: var(--wc-green);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
}
.wc-chip:hover, .wc-chip:focus-visible {
  background: #e7f8f0;
  outline: none;
}
.wc-chips[hidden] { display: none !important; }

.wc-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 10px 10px;
  background: #f0f2f5;
  border-top: 1px solid var(--wc-border);
}
.wc-input-wrap {
  flex: 1;
  background: #fff;
  border-radius: 22px;
  padding: 8px 14px;
  border: 1px solid transparent;
}
.wc-input-wrap:focus-within {
  border-color: rgba(18, 140, 126, 0.45);
}
.wc-input {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  max-height: 96px;
  background: transparent;
  color: var(--wc-text);
  line-height: 1.35;
}
.wc-send {
  appearance: none;
  border: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--wc-green-2);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.wc-send:hover, .wc-send:focus-visible {
  background: var(--wc-green);
  outline: none;
}
.wc-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.wc-send svg { width: 20px; height: 20px; fill: currentColor; }

.wc-error {
  color: #b00020;
  font-size: 12px;
  padding: 0 12px 6px;
  background: #f0f2f5;
}

/* Hide legacy WA fab/dock when widget owns them (JS toggles body class) */
body.wc-active .wa-fab,
body.wc-active .wa-dock {
  /* keep visible — they open the widget; do not hide */
}

@media (max-width: 640px) {
  #wc-root {
    inset: 0;
    padding: 0;
  }
  .wc-panel {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    margin: 0;
  }
  .wc-panel:not(.is-open) {
    display: none;
  }
}

/* Voice note UI */
.wc-mic {
  appearance: none;
  border: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  color: var(--wc-green-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid rgba(7, 94, 84, 0.25);
}
.wc-mic svg { width: 20px; height: 20px; fill: currentColor; }
.wc-mic:hover, .wc-mic:focus-visible { background: #e7f8f0; outline: none; }
.wc-mic.is-on, .wc-mic:disabled { opacity: 0.7; }
.wc-mic.is-on { background: #ffe8e8; color: #b00020; border-color: #b00020; }

.wc-recbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #1f2c34;
  color: #fff;
  font-size: 13px;
}
.wc-recbar[hidden] { display: none !important; }
.wc-recdot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b30;
  animation: wc-recpulse 1s infinite;
}
@keyframes wc-recpulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.wc-rectime { font-variant-numeric: tabular-nums; min-width: 36px; }
.wc-reccancel, .wc-recstop {
  appearance: none;
  border: 0;
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.wc-reccancel { background: transparent; color: #eee; margin-left: auto; }
.wc-recstop { background: var(--wc-green-2); color: #fff; }
.wc-composer.is-recording .wc-input-wrap,
.wc-composer.is-recording .wc-send,
.wc-composer.is-recording .wc-mic { display: none; }

.wc-bubble.has-audio .wc-audio {
  margin-bottom: 4px;
}
.wc-audio-el {
  width: 220px;
  max-width: 100%;
  height: 36px;
}
.wc-row.is-user .wc-audio-el { filter: none; }
