/* === CDK Chat Widget Styles ============================================ */
:root {
  --cdk-bg: #ffffff;
  --cdk-text: #1f2937;
  --cdk-border: #e5e7eb;
  --cdk-muted: #f8fafc;
  --cdk-primary: #0d6efd;
  --cdk-primary-contrast: #ffffff;
  --cdk-shadow: 0 10px 30px rgba(0,0,0,.15), 0 4px 12px rgba(0,0,0,.08);
  --cdk-radius: 14px;
  --cdk-radius-bubble: 18px;
  --cdk-z: 1060;
}

/* Fixed launcher container (id or class, both supported) */
#cdk-chat-launcher,
.cdk-chat-launcher {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: var(--cdk-z);
}

/* Circular FAB */
#cdk-chat-launcher .cdk-fab,
.cdk-chat-launcher .cdk-fab {
  width: 56px !important;
  height: 56px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  display: inline-grid !important;
  place-items: center !important;
  aspect-ratio: 1 / 1;
  font-size: 0;
  background: var(--cdk-primary);
  color: var(--cdk-primary-contrast);
  border: none;
  box-shadow: 0 8px 22px rgba(0,0,0,.25);
  cursor: pointer;
}
#cdk-chat-launcher .cdk-fab::after,
.cdk-chat-launcher .cdk-fab::after {
  content: "💬";
  font-size: 22px;
  line-height: 1;
}
#cdk-chat-launcher .cdk-fab:hover,
.cdk-chat-launcher .cdk-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(0,0,0,.18), 0 6px 12px rgba(0,0,0,.10);
}
#cdk-chat-launcher .cdk-fab:focus-visible,
.cdk-chat-launcher .cdk-fab:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(13,110,253,.25), var(--cdk-shadow);
}

/* Panel (hidden until .open) */
.cdk-chat-panel {
  display: none;
  position: fixed;
  right: 16px;
  bottom: 84px;
  width: 380px;
  max-width: 92vw;
  height: 66vh;
  max-height: 85vh;
  background: var(--cdk-bg);
  color: var(--cdk-text);
  border: 1px solid var(--cdk-border);
  border-radius: var(--cdk-radius);
  box-shadow: var(--cdk-shadow);
  overflow: hidden;
  z-index: var(--cdk-z);
}
.cdk-chat-panel.open {
  display: flex;
  flex-direction: column;
}

.cdk-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--cdk-border);
  background: var(--cdk-muted); font-weight: 600;
}
.cdk-chat-close { appearance: none; border: 0; background: transparent;
  font-size: 20px; line-height: 1; cursor: pointer; color: #64748b; }
.cdk-chat-close:hover { color: #0f172a; }

.cdk-chat-body { flex: 1 1 auto; overflow: auto; padding: 14px 14px 6px; }
.cdk-msg { display: flex; margin: 8px 0; }
.cdk-bubble { max-width: 82%; padding: 10px 12px; border-radius: var(--cdk-radius-bubble);
  line-height: 1.35; word-wrap: break-word; white-space: pre-wrap; border: 1px solid var(--cdk-border); }
.cdk-user { justify-content: flex-end; }
.cdk-user .cdk-bubble { background: var(--cdk-primary); color: var(--cdk-primary-contrast);
  border-color: transparent; border-bottom-right-radius: 6px; }
.cdk-ai { justify-content: flex-start; }
.cdk-ai .cdk-bubble { background: #f1f5f9; color: var(--cdk-text); border-bottom-left-radius: 6px; }

.cdk-chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--cdk-border); }
.cdk-chat-input textarea { flex: 1 1 auto; min-height: 42px; max-height: 140px; resize: vertical;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--cdk-border); outline: none; }
.cdk-chat-input textarea:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(13,110,253,.15); }

@media (max-width: 480px) {
  .cdk-chat-panel { right: 10px; left: 10px; bottom: 88px; width: auto; height: 72vh; }
  .cdk-bubble { max-width: 88%; }
}
@media (prefers-color-scheme: dark) {
  :root { --cdk-bg: #0b1220; --cdk-text: #e5e7eb; --cdk-border: #1f2937; --cdk-muted: #0f172a; }
  .cdk-ai .cdk-bubble { background: #111827; border-color: #1f2937; }
  .cdk-chat-input textarea { background: #0b1020; color: var(--cdk-text); }
}
