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

:root {
  --vxw-primary:   #6C3AFF;
  --vxw-secondary: #EDE9FF;
  --vxw-text:      #ffffff;
  --vxw-width:     360px;
  --vxw-height:    560px;
  --vxw-radius:    20px;
  --vxw-navy:      #1A1A2E;
  --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: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999998;
  box-shadow: 0 4px 20px rgba(108, 58, 255, 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(108, 58, 255, 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; }

/* 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), #2E1899);
  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(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; color: #fff;
  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: #fff; }
.vxw-agent-status {
  font-size: 12px; color: rgba(255,255,255,0.8);
  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(255,255,255,0.15);
  border: none; cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
  transition: background 0.15s;
}
.vxw-header-close:hover { background: rgba(255,255,255,0.25); }

/* ── 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-primary); border-bottom-color: var(--vxw-primary); }
.vxw-tab:hover  { color: var(--vxw-primary); }

/* ── 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: var(--vxw-primary);
  opacity: 0.4;
  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(108,58,255,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: var(--vxw-primary);
  color: var(--vxw-primary);
}
.vxw-option-btn.selected {
  background: var(--vxw-primary);
  border-color: var(--vxw-primary);
  color: #fff;
}
.vxw-option-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── 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: var(--vxw-primary);
  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;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 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: var(--vxw-primary); background: #fff; }
.vxw-send-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--vxw-primary);
  color: #fff;
  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-primary); }

/* ── 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;
}

/* ── 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; }
}
