:root {
  --sedia-primary: #0B5FA5;
  --sedia-secondary: #16A34A;
  --sedia-bg: #F5F7FB;
  --sedia-text: #132238;
  --sedia-muted: #6B7280;
  --sedia-white: #FFFFFF;
  --sedia-border: rgba(11, 95, 165, 0.15);
}

* { box-sizing: border-box; }
body { font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

.sedia-chatbot {
  position: fixed;
  right: 16px;
  bottom: 16px;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}
.sedia-chatbot .chatbot-overlay {
  position: fixed; inset: 0; background: rgba(3, 8, 20, 0.2); opacity: 0; pointer-events: none; transition: opacity 220ms ease;
}
.sedia-chatbot.is-open .chatbot-overlay { opacity: 1; pointer-events: auto; }
.sedia-chatbot .chatbot-toggle, .sedia-chatbot .chatbot-window { pointer-events: auto; }
.sedia-chatbot .chatbot-toggle {
  width: 64px; height: 64px; border: none; border-radius: 50%; background: linear-gradient(135deg, var(--sedia-primary), var(--sedia-secondary));
  box-shadow: 0 16px 40px rgba(11, 95, 165, 0.25); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 180ms ease;
}
.sedia-chatbot .chatbot-toggle:hover { transform: translateY(-2px); }
.sedia-chatbot .chatbot-toggle img { width: 32px; height: 32px; }
.sedia-chatbot .chatbot-window {
  position: relative;
  margin-bottom: 12px;
  width: min(92vw, 400px);
  max-width: calc(100vw - 24px);
  max-height: min(76vh, 640px);
  background: rgba(255,255,255,0.92); backdrop-filter: blur(18px);
  border: 1px solid var(--sedia-border); border-radius: 20px; box-shadow: 0 24px 80px rgba(15, 23, 42, 0.16); display: flex; flex-direction: column; overflow: hidden; transform: translateY(18px) scale(0.96); opacity: 0; pointer-events: none; transition: all 220ms ease;
}
.sedia-chatbot.is-visible .chatbot-window { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.sedia-chatbot .chatbot-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; background: linear-gradient(135deg, rgba(11,95,165,0.98), rgba(22,163,74,0.95)); color: white; }
.sedia-chatbot .header-brand { display: flex; align-items: center; gap: 10px; }
.sedia-chatbot .header-brand img { width: 40px; height: 40px; border-radius: 50%; }
.sedia-chatbot .header-brand strong { display: block; font-size: 0.98rem; }
.sedia-chatbot .header-brand span { font-size: 0.75rem; opacity: 0.9; }
.sedia-chatbot .chatbot-close, .sedia-chatbot .chatbot-send { border: none; cursor: pointer; }
.sedia-chatbot .chatbot-close { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.16); display: flex; align-items: center; justify-content: center; }
.sedia-chatbot .chatbot-close img { width: 16px; height: 16px; filter: brightness(0) invert(1); }
.sedia-chatbot .chatbot-body { padding: 18px 16px 14px; background: #E5DDD5; min-height: 280px; max-height: 440px; overflow: hidden; display: flex; flex-direction: column; }
.sedia-chatbot .chatbot-quick-panel { order: 0; padding-bottom: 10px; position: sticky; top: 0; z-index: 2; background: #E5DDD5; }
.sedia-chatbot .chatbot-messages-wrapper { order: 1; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.sedia-chatbot .chatbot-messages { display: flex; flex-direction: column; gap: 10px; }
.sedia-chatbot .chatbot-suggestions { order: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 0 4px 8px; }
.sedia-chatbot .chatbot-suggestion { background: rgba(255,255,255,0.96); border: 1px solid rgba(0,0,0,0.08); border-radius: 999px; color: #111827; padding: 8px 12px; font-size: 0.88rem; cursor: pointer; transition: transform 150ms ease, box-shadow 150ms ease; }
.sedia-chatbot .chatbot-suggestion:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.sedia-chatbot .chat-bubble { display: flex; flex-direction: column; max-width: 84%; gap: 4px; padding: 0 4px; }
.sedia-chatbot .chat-bubble.user { align-self: flex-end; align-items: flex-end; }
.sedia-chatbot .chat-bubble.bot { align-self: flex-start; align-items: flex-start; }
.sedia-chatbot .bubble-content { padding: 10px 12px; border-radius: 20px; line-height: 1.45; font-size: 0.95rem; word-break: break-word; }
.sedia-chatbot .chat-bubble.user .bubble-content { background: #DCF8C6; color: #111827; border-bottom-right-radius: 4px; border-bottom-left-radius: 20px; border-top-left-radius: 20px; border-top-right-radius: 20px; }
.sedia-chatbot .chat-bubble.bot .bubble-content { background: #FFFFFF; color: #111827; border-bottom-left-radius: 4px; border-bottom-right-radius: 20px; border-top-left-radius: 20px; border-top-right-radius: 20px; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.sedia-chatbot .bubble-meta { color: #54656F; font-size: 0.72rem; align-self: flex-end; }
.sedia-chatbot .chatbot-body::-webkit-scrollbar { width: 8px; }
.sedia-chatbot .chatbot-body::-webkit-scrollbar-track { background: transparent; }
.sedia-chatbot .chatbot-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 999px; }
.sedia-chatbot .chatbot-footer { padding: 12px; border-top: 1px solid rgba(11,95,165,0.1); display: flex; gap: 8px; align-items: flex-end; background: white; }
.sedia-chatbot .chatbot-input { flex: 1; border: 1px solid rgba(11,95,165,0.12); border-radius: 14px; padding: 10px 12px; resize: none; min-height: 44px; max-height: 120px; font-family: inherit; outline: none; }
.sedia-chatbot .chatbot-send { background: var(--sedia-primary); color: white; border-radius: 14px; padding: 10px 14px; min-width: 70px; }
.sedia-chatbot .chatbot-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sedia-chatbot .chatbot-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 12px; border-radius: 999px; color: white; text-decoration: none; font-size: 0.9rem; font-weight: 600; border: none; cursor: pointer;
}
.sedia-chatbot .chatbot-action.whatsapp { background: linear-gradient(135deg, var(--sedia-secondary), #15803d); box-shadow: 0 8px 20px rgba(22, 163, 74, 0.2); }
.sedia-chatbot .chatbot-action.secondary { background: white; color: var(--sedia-primary); border: 1px solid rgba(11, 95, 165, 0.16); }
.sedia-chatbot .chatbot-quick-panel { border-top: 1px solid rgba(0,0,0,0.08); margin-top: 12px; padding-top: 10px; }
.sedia-chatbot .panel-header { font-size: 0.82rem; font-weight: 700; color: #374151; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.sedia-chatbot .chatbot-menu-list, .sedia-chatbot .chatbot-faq-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sedia-chatbot .chatbot-menu-chip, .sedia-chatbot .chatbot-faq-chip { border: 1px solid rgba(0,0,0,0.08); background: #FFFFFF; border-radius: 999px; color: #111827; padding: 8px 12px; font-size: 0.88rem; cursor: pointer; transition: transform 150ms ease, box-shadow 150ms ease; }
.sedia-chatbot .chatbot-menu-chip:hover, .sedia-chatbot .chatbot-faq-chip:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.sedia-chatbot .action-bubble .bubble-content { padding: 10px 14px; }
.sedia-chatbot .bubble-button { display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--sedia-secondary), #15803d); color: white; text-decoration: none; border-radius: 999px; padding: 10px 14px; font-weight: 700; }
.sedia-chatbot .typing-dots { display: flex; gap: 4px; padding: 6px 8px; }
.sedia-chatbot .typing-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--sedia-primary); animation: bounce 1s infinite ease-in-out; }
.sedia-chatbot .typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.sedia-chatbot .typing-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes bounce { 0%,80%,100% { transform: scale(0.7); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }

@media (max-width: 600px) {
  .sedia-chatbot { right: 12px; bottom: 12px; }
  .sedia-chatbot .chatbot-window { width: min(100vw - 24px, 420px); max-width: calc(100vw - 24px); height: calc(100vh - 96px); max-height: none; border-radius: 18px 18px 0 0; }
  .sedia-chatbot .chatbot-body { min-height: 0; }
}
