/* ============================================================
   ARRIAZA'S CLEANING — Chatbot Widget Styles
   ============================================================ */

:root {
  --cb-primary: #0d61df;
  --cb-primary-dark: #0848b0;
  --cb-accent: #0db8df;
  --cb-gradient: linear-gradient(135deg, #0d61df 0%, #0db8df 100%);
  --cb-bg: #0a0a0a;
  --cb-surface: #1a1a1a;
  --cb-surface2: #242424;
  --cb-border: rgba(13, 97, 223, 0.3);
  --cb-text: #f0f0f0;
  --cb-text-muted: rgba(240, 240, 240, 0.55);
  --cb-user-msg: linear-gradient(135deg, #0d61df 0%, #418dff 100%);
  --cb-bot-msg: #1a1a1a;
  --cb-shadow: 0 20px 60px rgba(13, 97, 223, 0.35);
  --cb-radius: 20px;
  --cb-font: 'Inter', sans-serif;
}

/* ── Keyframes ────────────────────────────────────────────── */
@keyframes cb-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(13, 97, 223, 0.5); }
  50%       { box-shadow: 0 0 0 12px rgba(13, 97, 223, 0); }
}

@keyframes cb-bounce-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-6px); opacity: 1; }
}

@keyframes cb-slide-in {
  from { opacity: 0; transform: scale(0.88) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes cb-msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cb-badge-pop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

@keyframes cb-shimmer {
  0%   { opacity: 0.6; }
  50%  { opacity: 1; }
  100% { opacity: 0.6; }
}

@keyframes cb-spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Floating Button ──────────────────────────────────────── */
#cb-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 64px;
  height: 64px;
  background: var(--cb-gradient);
  border: none;
  cursor: pointer;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Diamond/shield shape — clip-path hexagon */
  clip-path: polygon(50% 0%, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1), filter 0.25s;
  animation: cb-pulse 2.8s ease-in-out infinite;
  padding: 0;
}

#cb-toggle:hover {
  transform: scale(1.12);
  filter: drop-shadow(0 0 14px rgba(13, 97, 223, 0.8));
  animation: none;
}

#cb-toggle:active {
  transform: scale(0.96);
}

#cb-toggle .cb-icon-closed,
#cb-toggle .cb-icon-open {
  position: absolute;
  transition: opacity 0.22s, transform 0.22s;
}

#cb-toggle .cb-icon-open {
  opacity: 0;
  transform: rotate(-45deg) scale(0.7);
}

#cb-toggle.cb-open .cb-icon-closed {
  opacity: 0;
  transform: rotate(45deg) scale(0.7);
}

#cb-toggle.cb-open .cb-icon-open {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* ── Notification Badge ───────────────────────────────────── */
#cb-badge {
  position: fixed;
  bottom: 76px;
  right: 26px;
  width: 20px;
  height: 20px;
  background: #e53935;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--cb-font);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: cb-badge-pop 0.35s cubic-bezier(.34,1.56,.64,1) forwards;
  pointer-events: none;
}

/* ── Chat Window ──────────────────────────────────────────── */
#cb-window {
  position: fixed;
  bottom: 104px;
  right: 28px;
  width: 380px;
  height: 520px;
  background: var(--cb-bg);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  border: 1px solid var(--cb-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99997;
  font-family: var(--cb-font);
  animation: cb-slide-in 0.3s cubic-bezier(.34,1.2,.64,1) forwards;
}

#cb-window.cb-hidden {
  display: none;
}

/* ── Header ───────────────────────────────────────────────── */
#cb-header {
  background: var(--cb-gradient);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}

#cb-header .cb-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.4);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#cb-header .cb-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#cb-header .cb-info {
  flex: 1;
}

#cb-header .cb-name {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}

#cb-header .cb-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255,255,255,0.85);
  font-size: 11px;
  margin-top: 2px;
}

#cb-header .cb-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4cff72;
  animation: cb-shimmer 2s ease-in-out infinite;
  flex-shrink: 0;
}

#cb-close-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

#cb-close-btn:hover {
  background: rgba(255,255,255,0.3);
}

/* ── Messages Area ────────────────────────────────────────── */
#cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#cb-messages::-webkit-scrollbar {
  width: 4px;
}
#cb-messages::-webkit-scrollbar-track {
  background: transparent;
}
#cb-messages::-webkit-scrollbar-thumb {
  background: var(--cb-border);
  border-radius: 4px;
}

/* ── Message Bubbles ──────────────────────────────────────── */
.cb-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  animation: cb-msg-in 0.25s ease forwards;
  word-break: break-word;
}

.cb-msg a {
  color: #7dc7ff;
  text-decoration: underline;
}

.cb-msg ul, .cb-msg ol {
  margin: 6px 0 0 16px;
  padding: 0;
}

.cb-msg li {
  margin-bottom: 3px;
}

.cb-msg-bot {
  background: var(--cb-bot-msg);
  color: var(--cb-text);
  border: 1px solid var(--cb-border);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.cb-msg-user {
  background: var(--cb-user-msg);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* ── Typing Indicator ─────────────────────────────────────── */
#cb-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: var(--cb-bot-msg);
  border: 1px solid var(--cb-border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: fit-content;
}

#cb-typing span {
  width: 7px;
  height: 7px;
  background: var(--cb-primary);
  border-radius: 50%;
  display: inline-block;
  animation: cb-bounce-dot 1.2s ease-in-out infinite;
}

#cb-typing span:nth-child(2) { animation-delay: 0.2s; }
#cb-typing span:nth-child(3) { animation-delay: 0.4s; }

/* ── Quick Options ────────────────────────────────────────── */
#cb-quick-wrap {
  padding: 8px 14px 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  border-top: 1px solid var(--cb-border);
  background: rgba(13, 97, 223, 0.04);
}

.cb-quick-btn {
  background: transparent;
  border: 1px solid var(--cb-primary);
  color: var(--cb-primary);
  font-family: var(--cb-font);
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.15s;
  white-space: nowrap;
}

.cb-quick-btn:hover {
  background: var(--cb-primary);
  color: #fff;
  transform: translateY(-1px);
}

/* ── Input Area ───────────────────────────────────────────── */
#cb-input-area {
  padding: 10px 14px 14px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  border-top: 1px solid var(--cb-border);
}

#cb-input {
  flex: 1;
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  border-radius: 12px;
  color: var(--cb-text);
  font-family: var(--cb-font);
  font-size: 13px;
  padding: 9px 12px;
  resize: none;
  outline: none;
  max-height: 100px;
  min-height: 38px;
  line-height: 1.4;
  transition: border-color 0.2s;
  overflow-y: auto;
}

#cb-input::placeholder {
  color: var(--cb-text-muted);
}

#cb-input:focus {
  border-color: var(--cb-primary);
}

#cb-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--cb-gradient);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, filter 0.2s;
}

#cb-send:hover {
  transform: scale(1.1);
  filter: brightness(1.15);
}

#cb-send:active {
  transform: scale(0.94);
}

#cb-send svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

/* ── Responsive Mobile ────────────────────────────────────── */
@media (max-width: 480px) {
  #cb-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  #cb-toggle {
    bottom: 20px;
    right: 20px;
  }

  #cb-badge {
    bottom: 68px;
    right: 18px;
  }
}
