/* ==========================================
   YouShop — Chat Widget Styles
   ========================================== */

/* ===== FAB (botão flutuante) ===== */
.chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 50px;
  padding: 14px 20px 14px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 32px rgba(200,241,53,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-fab:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(200,241,53,0.45);
}

.chat-fab .fab-label { letter-spacing: 0.01em; }

/* Pulso animado */
.fab-pulse {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  background: #ff4757;
  border-radius: 50%;
  border: 2px solid var(--bg);
}

.fab-pulse::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: rgba(255,71,87,0.4);
  animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

/* ===== WIDGET ===== */
.chat-widget {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 998;
  width: 380px;
  max-height: 580px;
  display: flex;
  flex-direction: column;
  background: #111118;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(200,241,53,0.08);
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s ease;
  transform-origin: bottom right;
}

.chat-widget.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ===== HEADER ===== */
.chat-header {
  background: linear-gradient(135deg, #1a1a24, #0f0f18);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.chat-header-info { display: flex; align-items: center; gap: 12px; }

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.chat-name { font-size: 15px; font-weight: 700; color: #fff; }

.chat-status {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2ed573;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.chat-close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.6);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.chat-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ===== MESSAGES ===== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Mensagem */
.msg { display: flex; flex-direction: column; max-width: 85%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.bot { align-self: flex-start; align-items: flex-start; }

.msg-bubble {
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
}

.msg.bot .msg-bubble {
  background: rgba(255,255,255,0.07);
  color: #fff;
  border-bottom-left-radius: 4px;
}

.msg.user .msg-bubble {
  background: var(--accent);
  color: #000;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.msg-bubble ul {
  margin: 8px 0 4px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.msg-bubble li { font-size: 13px; }

.msg-time {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  margin-top: 4px;
  padding: 0 4px;
}

/* Loading dots */
.msg.typing .msg-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 56px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  animation: typing-anim 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-anim {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Escalação para humano */
.msg.escalated .msg-bubble {
  border-left: 3px solid #ff9f43;
  background: rgba(255,159,67,0.08);
}

/* ===== QUICK REPLIES ===== */
.quick-replies {
  padding: 8px 16px 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.quick-replies button {
  background: rgba(200,241,53,0.1);
  border: 1px solid rgba(200,241,53,0.25);
  color: var(--accent);
  padding: 7px 13px;
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.quick-replies button:hover {
  background: rgba(200,241,53,0.2);
  transform: translateY(-1px);
}

/* ===== INPUT AREA ===== */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  flex-shrink: 0;
}

#chatInput {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50px;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 16px;
  outline: none;
  transition: border-color 0.2s;
}

#chatInput::placeholder { color: rgba(255,255,255,0.3); }
#chatInput:focus { border-color: rgba(200,241,53,0.4); }

.send-btn {
  background: var(--accent);
  border: none;
  color: #000;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, background 0.2s;
}

.send-btn:hover { transform: scale(1.08); background: var(--accent-dark, #a8d020); }

.chat-footer {
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.2);
  padding: 6px 0 10px;
  flex-shrink: 0;
}

/* ===== RESPONSIVO ===== */
@media (max-width: 480px) {
  .chat-widget {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-height: 100dvh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }

  .chat-widget.open { transform: translateY(0); }

  .chat-fab {
    right: 20px;
    bottom: 20px;
  }
}
