/* ============================================================
   VOXLY Frontend Widget – Stylesheet
   ============================================================ */

:root {
  --vxw-primary:   #C8FF00;
  --vxw-secondary: #F4FFD0;
  --vxw-text:      #0A0A0F;
  --vxw-width:     360px;
  --vxw-height:    560px;
  --vxw-radius:    20px;
  --vxw-navy:      #0A0A0F;
  --vxw-gray:      #777;
  --vxw-light:     #F8F8FC;
  --vxw-border:    #E8E8F0;
}

/* ── Launcher Button ── */
.voxly-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--vxw-primary);
  color: #0A0A0F;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999998;
  box-shadow: 0 4px 20px rgba(74,97,0, 0.4);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  outline: none;
}
.voxly-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(74,97,0, 0.5);
}
.voxly-launcher:active { transform: scale(0.96); }
.voxly-launcher svg { transition: transform 0.25s, opacity 0.2s; }
.voxly-launcher.open .icon-chat   { transform: scale(0) rotate(-90deg); opacity: 0; position: absolute; }
.voxly-launcher.open .icon-close  { transform: scale(1) rotate(0deg);   opacity: 1; }
.voxly-launcher .icon-close { transform: scale(0) rotate(90deg); opacity: 0; position: absolute; }

/* ── VoxlyChat logo launcher (default icon) ──
   Black background with the brand color as a glow shadow; the lime logo
   artwork sits centered. Falls back gracefully via widget.js onerror. */
.voxly-launcher.launcher-logo {
  background: #0A0A0F;
  /* The close X uses stroke="currentColor" — on the black launcher it must be
     the primary brand color, not the default black text color. */
  color: var(--vxw-primary);
  box-shadow: 0 4px 20px rgba(200, 255, 0, 0.45), 0 0 0 1px rgba(200, 255, 0, 0.25);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--vxw-primary) 50%, transparent),
              0 0 0 1px color-mix(in srgb, var(--vxw-primary) 30%, transparent);
}
.voxly-launcher.launcher-logo:hover {
  box-shadow: 0 6px 28px rgba(200, 255, 0, 0.55), 0 0 0 1px rgba(200, 255, 0, 0.35);
  box-shadow: 0 6px 28px color-mix(in srgb, var(--vxw-primary) 60%, transparent),
              0 0 0 1px color-mix(in srgb, var(--vxw-primary) 40%, transparent);
}
.voxly-launcher .icon-logo {
  width: 32px;
  max-width: 60%;
  height: auto;
  display: block;
  user-select: none;
  transition: transform 0.25s, opacity 0.2s;
}
.voxly-launcher.open .icon-logo {
  transform: scale(0) rotate(-90deg);
  opacity: 0;
  position: absolute;
}

/* Notification Badge */
.voxly-launcher-badge {
  position: absolute;
  top: -3px; right: -3px;
  width: 20px; height: 20px;
  background: #EF4444;
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  animation: vxw-badge-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: system-ui, sans-serif;
}
@keyframes vxw-badge-in {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── Chat Window ── */
.voxly-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: var(--vxw-width);
  height: var(--vxw-height);
  background: #fff;
  border-radius: var(--vxw-radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999997;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
}
.voxly-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Mobile */
@media (max-width: 430px) {
  .voxly-window {
    width: 100vw;
    height: 100dvh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }
  .voxly-launcher { bottom: 16px; right: 16px; }
}

/* ── Widget Header ── */
.vxw-header {
  background: linear-gradient(135deg, var(--vxw-primary), #B5EB00);
  padding: 16px 18px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}

.vxw-header-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(10,10,15,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; color: #0A0A0F;
  flex-shrink: 0;
  overflow: hidden;
}
.vxw-header-avatar img { width: 100%; height: 100%; object-fit: cover; }

.vxw-header-info { flex: 1; min-width: 0; }
.vxw-agent-name  { font-size: 14.5px; font-weight: 700; color: #0A0A0F; }
.vxw-agent-status {
  font-size: 12px; color: rgba(10,10,15,0.65);
  display: flex; align-items: center; gap: 5px; margin-top: 2px;
}
.vxw-agent-status .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #22C55E;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.3);
  animation: vxw-pulse 2s infinite;
}
.vxw-agent-status.offline .dot { background: #EF4444; box-shadow: none; animation: none; }
.vxw-agent-status.busy .dot    { background: #F59E0B; box-shadow: none; animation: none; }

.vxw-header-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(10,10,15,0.12);
  border: none; cursor: pointer; color: #0A0A0F;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
  transition: background 0.15s;
}
.vxw-header-close:hover { background: rgba(10,10,15,0.2); }

/* ── Mode Tabs ── */
.vxw-tabs {
  display: flex;
  border-bottom: 1px solid var(--vxw-border);
  background: #fff;
  flex-shrink: 0;
}
.vxw-tab {
  flex: 1;
  padding: 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--vxw-gray);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2.5px solid transparent;
  transition: all 0.18s;
  font-family: inherit;
}
.vxw-tab.active { color: var(--vxw-navy); border-bottom-color: var(--vxw-primary); }
.vxw-tab:hover  { color: var(--vxw-navy); }

/* ── GDPR Banner ── */
.vxw-gdpr {
  padding: 14px 16px;
  background: var(--vxw-secondary);
  border-bottom: 1px solid var(--vxw-border);
  font-size: 12px;
  color: var(--vxw-navy);
  line-height: 1.5;
  flex-shrink: 0;
}
.vxw-gdpr label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.vxw-gdpr input[type=checkbox] { margin-top: 2px; accent-color: var(--vxw-primary); }

/* ── Bot Panel ── */
.vxw-bot-panel {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--vxw-light);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vxw-bot-panel::-webkit-scrollbar { width: 4px; }
.vxw-bot-panel::-webkit-scrollbar-thumb { background: var(--vxw-border); border-radius: 4px; }

/* ── Message Bubbles ── */
.vxw-msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: vxw-msg-in 0.22s ease;
}
.vxw-msg.visitor { align-items: flex-end; }
.vxw-msg.bot, .vxw-msg.agent { align-items: flex-start; }

.vxw-bubble {
  max-width: 82%;
  padding: 10px 14px;
  line-height: 1.55;
  font-size: 13.5px;
  word-break: break-word;
}
.vxw-msg.bot .vxw-bubble, .vxw-msg.agent .vxw-bubble {
  background: #fff;
  color: var(--vxw-navy);
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
.vxw-msg.visitor .vxw-bubble {
  background: var(--vxw-primary);
  color: var(--vxw-text);
  border-radius: 18px 18px 4px 18px;
}

.vxw-msg-time {
  font-size: 10.5px;
  color: var(--vxw-gray);
  padding: 0 4px;
}

/* ── Typing Indicator ── */
.vxw-typing {
  display: flex;
  align-items: center;
  gap: 10px;
  animation: vxw-msg-in 0.22s ease;
}
.vxw-typing-dots {
  background: #fff;
  border-radius: 18px 18px 18px 4px;
  padding: 12px 16px;
  display: flex;
  gap: 5px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
.vxw-typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #9CA3AF;
  animation: vxw-dot-wave 1.2s infinite ease-in-out;
}
.vxw-typing-dot:nth-child(1) { animation-delay: 0s; }
.vxw-typing-dot:nth-child(2) { animation-delay: 0.18s; }
.vxw-typing-dot:nth-child(3) { animation-delay: 0.36s; }

/* ── Quick Reply Options ── */
.vxw-options {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
}
.vxw-option-btn {
  padding: 10px 16px;
  background: #fff;
  border: 1.5px solid rgba(74,97,0,0.2);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--vxw-navy);
  cursor: pointer;
  text-align: left;
  transition: all 0.18s;
  font-family: inherit;
  line-height: 1.4;
}
.vxw-option-btn:hover {
  background: var(--vxw-secondary);
  border-color: #8FBF00;
  color: var(--vxw-navy);
}
.vxw-option-btn.selected {
  background: var(--vxw-primary);
  border-color: var(--vxw-primary);
  color: #0A0A0F;
}
.vxw-option-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Email Follow-up Bar (no agent available) ── */
.vxw-followup-bar {
  margin: 0 12px 8px;
  padding: 12px;
  background: var(--vxw-secondary);
  border: 1px solid rgba(74,97,0,0.18);
  border-radius: 12px;
}
.vxw-followup-text {
  font-size: 12.5px;
  color: #3A3A4A;
  line-height: 1.45;
  margin-bottom: 8px;
}
.vxw-followup-row {
  display: flex;
  gap: 6px;
}
.vxw-followup-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1.5px solid rgba(74,97,0,0.2);
  border-radius: 9px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--vxw-navy);
  outline: none;
}
.vxw-followup-row input:focus { border-color: #8FBF00; }
.vxw-followup-btn {
  padding: 8px 14px;
  background: var(--vxw-primary);
  border: none;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  color: #0A0A0F;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: filter 0.15s;
}
.vxw-followup-btn:hover { filter: brightness(0.94); }

/* ── Inline Form ── */
.vxw-form-wrap {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  width: 100%;
}
.vxw-form-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--vxw-navy);
  margin: 0 0 14px;
}
.vxw-form-field { margin-bottom: 10px; }
.vxw-form-label { font-size: 12px; font-weight: 600; color: var(--vxw-gray); margin-bottom: 4px; display: block; }
.vxw-form-input,
.vxw-form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--vxw-border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--vxw-navy);
  background: var(--vxw-light);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.18s;
}
.vxw-form-input:focus, .vxw-form-textarea:focus {
  border-color: #8FBF00;
  background: #fff;
}
.vxw-form-textarea { resize: none; min-height: 72px; }
.vxw-form-submit {
  width: 100%;
  padding: 10px;
  background: var(--vxw-primary);
  color: var(--vxw-text);
  border: none;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
  margin-top: 4px;
}
.vxw-form-submit:hover { opacity: 0.9; }
.vxw-form-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.vxw-form-success {
  text-align: center;
  padding: 16px;
  color: #22C55E;
  font-weight: 600;
  font-size: 14px;
}

/* ── Live Chat Panel ── */
.vxw-live-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.vxw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--vxw-light);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vxw-messages::-webkit-scrollbar { width: 4px; }
.vxw-messages::-webkit-scrollbar-thumb { background: var(--vxw-border); border-radius: 4px; }

.vxw-input-area {
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid var(--vxw-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
/* The input row: [attach] [textarea] [mic] [send] */
.vxw-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
/* Icon buttons (attach / mic) — secondary controls beside the text input */
.vxw-icon-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--vxw-gray);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.18s;
}
.vxw-icon-btn:hover { background: var(--vxw-light); color: var(--vxw-navy); }
.vxw-icon-btn:active { transform: scale(0.92); }
/* Recording state: red mic with a soft pulse ring */
.vxw-mic-btn.recording {
  background: #FEE2E2;
  color: #DC2626;
  animation: vxw-mic-pulse 1.4s infinite;
}
@keyframes vxw-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
  50%      { box-shadow: 0 0 0 7px rgba(220, 38, 38, 0); }
}
.vxw-text-input {
  flex: 1;
  padding: 9px 14px;
  border: 1.5px solid var(--vxw-border);
  border-radius: 20px;
  font-size: 13.5px;
  color: var(--vxw-navy);
  background: var(--vxw-light);
  resize: none;
  max-height: 90px;
  outline: none;
  font-family: inherit;
  line-height: 1.4;
  transition: border-color 0.18s;
}
.vxw-text-input:focus { border-color: #8FBF00; background: #fff; }
.vxw-send-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--vxw-primary);
  color: #0A0A0F;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.18s;
}
.vxw-send-btn:hover  { opacity: 0.88; transform: scale(1.06); }
.vxw-send-btn:active { transform: scale(0.96); }
.vxw-send-btn svg    { width: 16px; height: 16px; }

/* ── Visitor Info Collect ── */
.vxw-visitor-form {
  padding: 20px 16px;
  background: #fff;
  border-bottom: 1px solid var(--vxw-border);
  flex-shrink: 0;
}
.vxw-visitor-form p {
  font-size: 13px; color: var(--vxw-gray); margin: 0 0 12px; line-height: 1.5;
}

/* ── Footer Branding ── */
.vxw-footer {
  text-align: center;
  padding: 8px;
  font-size: 10.5px;
  color: #bbb;
  background: #fff;
  border-top: 1px solid var(--vxw-border);
  flex-shrink: 0;
}
.vxw-footer a { color: inherit; text-decoration: none; }
.vxw-footer a:hover { color: var(--vxw-navy); }

/* ── Offline Banner ── */
.vxw-offline-banner {
  padding: 12px 16px;
  background: #FFF5F5;
  border-bottom: 1px solid rgba(239,68,68,0.15);
  font-size: 12.5px;
  color: #EF4444;
  text-align: center;
  flex-shrink: 0;
}

/* ── System Notes (human assigned / queued) ── */
.vxw-msg.system {
  align-items: center;
}
.vxw-msg.system .vxw-bubble {
  background: none;
  box-shadow: none;
  color: var(--vxw-gray);
  font-size: 11.5px;
  text-align: center;
  padding: 2px 8px;
}
.vxw-msg.system .vxw-msg-time { text-align: center; }

/* ── Attachment Previews (above the input row) ── */
.vxw-attach-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 2px 0;
}
.vxw-attach-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 140px;
  padding: 6px 24px 6px 6px;
  background: var(--vxw-light);
  border: 1px solid var(--vxw-border);
  border-radius: 10px;
  font-size: 11.5px;
  color: var(--vxw-navy);
  overflow: hidden;
}
.vxw-attach-chip img {
  width: 42px; height: 42px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.vxw-attach-chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vxw-attach-chip-name small { color: var(--vxw-gray); font-size: 10px; }
.vxw-attach-chip.error { border-color: #FCA5A5; background: #FEF2F2; }
.vxw-attach-chip-err {
  color: #DC2626;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
/* Thin upload progress bar across the chip while uploading */
.vxw-attach-chip.uploading::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  height: 2.5px;
  width: 40%;
  background: var(--vxw-primary);
  border-radius: 2px;
  animation: vxw-upload-slide 1s infinite ease-in-out;
}
@keyframes vxw-upload-slide {
  0%   { left: -40%; }
  100% { left: 100%; }
}
.vxw-attach-chip-progress { display: none; }
.vxw-attach-remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  border: none;
  background: rgba(10,10,15,0.55);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.vxw-attach-remove:hover { background: #EF4444; }

/* ── Attachments Inside Message Bubbles ── */
.vxw-attaches {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 82%;
}
.vxw-attach-img {
  display: block;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  line-height: 0;
}
.vxw-attach-img img {
  max-width: 200px;
  max-height: 180px;
  object-fit: cover;
  display: block;
}
.vxw-attach-file {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  color: var(--vxw-navy);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}
.vxw-attach-file:hover { background: var(--vxw-secondary); }
.vxw-attach-file small { color: var(--vxw-gray); font-size: 10.5px; font-weight: 400; }
.vxw-attach-file svg { flex-shrink: 0; color: var(--vxw-gray); }
.vxw-msg.visitor .vxw-attaches { align-items: flex-end; }

/* ── Toast (transient feedback) ── */
.vxw-toast {
  position: absolute;
  left: 12px; right: 12px; bottom: 76px;
  background: rgba(10,10,15,0.88);
  color: #fff;
  font-size: 12px;
  padding: 9px 14px;
  border-radius: 10px;
  text-align: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 10;
}
.vxw-toast.show { opacity: 1; transform: translateY(0); }

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .vxw-typing-dot,
  .vxw-attach-chip.uploading::after,
  .vxw-mic-btn.recording { animation: none; }
  .vxw-typing-dot { opacity: 0.7; }
}

/* ── Animations ── */
@keyframes vxw-msg-in {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
@keyframes vxw-dot-wave {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}
@keyframes vxw-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
