/* ============================================================
   DENTAL COIQUE — Chatbot Widget
   ============================================================ */

/* ---------- TRIGGER BUTTON ---------- */
.chat-trigger {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 500;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38CCC6, #08BCB5);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 28px rgba(8,188,181,0.45);
  transition: transform 0.25s cubic-bezier(0.16,1,0.3,1), box-shadow 0.25s;
  animation: chatFloat 3.5s ease-in-out infinite;
}
.chat-trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 36px rgba(8,188,181,0.55);
  animation: none;
}
@keyframes chatFloat {
  0%,100% { transform: translateY(0) rotate(-3deg); }
  25% { transform: translateY(-6px) rotate(3deg); }
  50% { transform: translateY(-3px) rotate(-2deg); }
  75% { transform: translateY(-8px) rotate(2deg); }
}
/* Tooth eyes blink */
@keyframes toothBlink {
  0%,92%,100% { transform: scaleY(1); }
  94%,98% { transform: scaleY(0.08); }
}
.icon-chat circle {
  transform-origin: center;
  animation: toothBlink 4s ease-in-out infinite;
}
.icon-chat circle:last-of-type {
  animation-delay: 0.06s;
}
/* Smile wave */
@keyframes toothSmile {
  0%,100% { d: path("M24 38 Q32 44 40 38"); }
  50% { d: path("M24 36 Q32 46 40 36"); }
}
.chat-trigger svg { transition: transform 0.3s cubic-bezier(0.16,1,0.3,1); }

/* Greeting bubble */
.chat-greeting {
  position: absolute;
  left: 72px;
  bottom: 8px;
  background: #fff;
  color: #0D1B2A;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  white-space: nowrap;
  box-shadow: 0 4px 18px rgba(0,0,0,.14);
  pointer-events: none;
  opacity: 0;
  transform: translateX(-10px) scale(0.92);
  transition: opacity 0.35s cubic-bezier(0.16,1,0.3,1), transform 0.35s cubic-bezier(0.16,1,0.3,1);
}
.chat-greeting::before {
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: #fff;
}
.chat-greeting.is-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
}
.chat-trigger.is-open svg.icon-chat { display: none; }
.chat-trigger.is-open svg.icon-close { display: block !important; }
.chat-trigger svg.icon-close { display: none; }

/* Notification badge */
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #F7924D;
  border-radius: 50%;
  border: 2.5px solid #fff;
  font-size: 0.625rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badgePop 0.4s cubic-bezier(0.16,1,0.3,1) 2s both;
}
@keyframes badgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}
.chat-badge.is-hidden { display: none; }

/* Chat tooltip label */
.chat-label {
  position: absolute;
  left: 72px;
  background: var(--ink, #0d2120);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 100px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.chat-label::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: var(--ink, #0d2120);
  border-left: none;
}
.chat-trigger:hover .chat-label {
  opacity: 1;
  transform: translateX(0);
}

/* ---------- CHAT PANEL ---------- */
.chat-panel {
  position: fixed;
  bottom: 6.5rem;
  left: 2rem;
  z-index: 501;
  width: 360px;
  max-height: calc(100vh - 9rem);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow:
    0 24px 80px rgba(8,188,181,0.18),
    0 4px 20px rgba(0,0,0,0.10),
    0 0 0 1px rgba(8,188,181,0.12);
  transform-origin: bottom left;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1), opacity 0.3s;
}
.chat-panel.is-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.chat-header {
  background: linear-gradient(135deg, #38CCC6 0%, #08BCB5 100%);
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-shrink: 0;
}
.chat-header-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.chat-header-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.85);
  margin-top: 0.15rem;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7eff9e;
  animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.chat-header-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.2s;
  flex-shrink: 0;
}
.chat-header-close:hover { background: rgba(255,255,255,0.25); }

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  min-height: 0;
  scroll-behavior: smooth;
  background: #f8fffe;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(8,188,181,0.2); border-radius: 99px; }

/* Message bubbles */
.msg {
  max-width: 88%;
  animation: msgIn 0.35s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg-bot { align-self: flex-start; }
.msg-user { align-self: flex-end; }

.msg-bubble {
  padding: 0.75rem 1rem;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.55;
}
.msg-bot .msg-bubble {
  background: #fff;
  color: #0d2120;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.msg-user .msg-bubble {
  background: linear-gradient(135deg, #38CCC6, #08BCB5);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
}
.msg-bubble strong { font-weight: 700; }
.msg-bubble ul {
  margin-top: 0.4rem;
  padding-left: 1rem;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.msg-bubble .emoji-list {
  padding-left: 0;
  list-style: none;
  margin-top: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.msg-bubble .emoji-list li::before { content: none; }

/* Typing indicator */
.msg-typing .msg-bubble {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 0.875rem 1.1rem;
  border-radius: 4px 16px 16px 16px;
}
.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}
.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38CCC6;
  animation: typingDot 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* WhatsApp CTA inside message */
.msg-wa-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  background: #25d366;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.55rem 1rem;
  border-radius: 100px;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
  white-space: nowrap;
}
.msg-wa-cta:hover {
  background: #20c55a;
  transform: translateY(-1px);
}

/* Quick replies */
.chat-quickreplies {
  padding: 0.75rem 1.25rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
  background: #f8fffe;
  border-top: 1px solid rgba(8,188,181,0.10);
}
.qr-btn {
  background: #fff;
  border: 1.5px solid rgba(8,188,181,0.3);
  color: #08BCB5;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.45rem 0.875rem;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
  white-space: nowrap;
}
.qr-btn:hover {
  background: #08BCB5;
  border-color: #08BCB5;
  color: #fff;
  transform: translateY(-1px);
}

/* Input row */
.chat-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  border-top: 1px solid rgba(8,188,181,0.10);
  background: #fff;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  border: 1.5px solid rgba(8,188,181,0.20);
  border-radius: 100px;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: #0d2120;
  background: #f8fffe;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: #08BCB5; }
.chat-input::placeholder { color: #6b9c99; }
.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38CCC6, #08BCB5);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 3px 12px rgba(8,188,181,0.30);
}
.chat-send:hover {
  transform: scale(1.08);
  box-shadow: 0 5px 18px rgba(8,188,181,0.40);
}

/* Footer disclaimer */
.chat-footer-note {
  text-align: center;
  font-size: 0.6875rem;
  color: #6b9c99;
  padding: 0.5rem 1rem 0.75rem;
  background: #fff;
  flex-shrink: 0;
}

/* ---------- ESPECIALIDAD PHOTO CARDS ---------- */
.esp-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  width: 100%;
  padding: 0.25rem 0;
}
.esp-card {
  background: #fff;
  border: 1.5px solid rgba(8,188,181,0.18);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.esp-card:hover {
  transform: translateY(-2px);
  border-color: #08BCB5;
  box-shadow: 0 4px 16px rgba(8,188,181,0.18);
}
.esp-card-img {
  width: 100%;
  height: 72px;
  background-size: cover;
  background-position: center;
}
.esp-card-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0D1B2A;
  padding: 0.4rem 0.6rem 0.5rem;
  line-height: 1.2;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 480px) {
  .chat-panel {
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    bottom: 5.5rem;
  }
  .chat-trigger {
    bottom: 1.25rem;
    left: 1.25rem;
  }
}
