/* =========================
   Dhaka Dental AI Chat (Isolated)
   File: assets/css/chat.css
   ========================= */

:root{
  --dd-ai-c1:#f7f7f7;
  --dd-ai-c2:#E8DAF0;
  --dd-ai-c3:#ffffff;
  --dd-ai-c4:#FCDCE1;
  --dd-ai-c5:#D8BEE5;
  --dd-ai-c6:#A7ABDE;

  --dd-ai-ink:#0f172a;
  --dd-ai-muted:#64748b;
  --dd-ai-border:rgba(15,23,42,.10);
  --dd-ai-shadow:0 18px 45px rgba(15,23,42,.18);
}

/* Prevent overriding site styles by scoping EVERYTHING */
.dd-ai-fab,
.dd-ai-modal,
.dd-ai-modal *{
  box-sizing:border-box;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ---------- Floating morphing blob button ---------- */
.dd-ai-fab{
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999999;
  width: 78px;
  height: 78px;
  border: none;
  outline: none;
  cursor: pointer;

  /* pastel-ish blob gradient */
  background: linear-gradient(135deg, var(--dd-ai-c5) 0%, var(--dd-ai-c4) 45%, var(--dd-ai-c6) 100%);

  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  animation: ddAiMorph 8s ease-in-out infinite;
  box-shadow: 0 12px 24px rgba(15,23,42,.18);
  display:flex;
  align-items:center;
  justify-content:center;
  transition: transform .25s ease, filter .25s ease, opacity .2s ease;
}

@keyframes ddAiMorph{
  0%   { border-radius:30% 70% 70% 30% / 30% 30% 70% 70%; }
  25%  { border-radius:58% 42% 75% 25% / 76% 46% 54% 24%; }
  50%  { border-radius:50% 50% 33% 67% / 55% 27% 73% 45%; }
  75%  { border-radius:33% 67% 58% 42% / 63% 68% 32% 37%; }
  100% { border-radius:30% 70% 70% 30% / 30% 30% 70% 70%; }
}

.dd-ai-fab:hover{
  transform: scale(1.06);
  filter: brightness(1.03);
}

.dd-ai-fab img{
  width: 46px;
  height: 46px;
  /* keep icon dark as you want */
  filter: none;
  opacity: .95;
  pointer-events:none;
}

/* hide fab when chat open (Option-1) */
.dd-ai-fab.dd-ai-hide{
  opacity: 0;
  pointer-events:none;
  transform: scale(.85);
}

/* ---------- Modal shell ---------- */
.dd-ai-modal{
  position: fixed;
  inset: 0;
  z-index: 999998;
  display: none;
}

.dd-ai-modal.open{ display:block; }

.dd-ai-backdrop{
  position:absolute;
  inset:0;
  background: rgba(15,23,42,.35);
}

/* ---------- Panel ---------- */
.dd-ai-panel{
  position:absolute;
  right: 24px;
  bottom: 120px;
  width: min(420px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 160px));
  background: #fff;
  border: 1px solid var(--dd-ai-border);
  border-radius: 22px;
  box-shadow: var(--dd-ai-shadow);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

/* responsive bottom sheet on small screens */
@media (max-width: 520px){
  .dd-ai-panel{
    right: 12px;
    left: 12px;
    bottom: 96px;
    width: auto;
    height: min(70vh, 620px);
  }
}

/* ---------- Header (your “1st image” style = plain white) ---------- */
.dd-ai-header{
  padding: 14px 16px 12px 16px;
  background: #fff; /* important: plain white */
  border-bottom: 1px solid var(--dd-ai-border);
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
}

.dd-ai-title{
  font-weight: 800;
  color: var(--dd-ai-ink);
  font-size: 18px;
  line-height: 1.1;
}

.dd-ai-sub{
  margin-top: 4px;
  font-size: 12px;
  color: var(--dd-ai-muted);
}

.dd-ai-actions{
  display:flex;
  gap: 8px;
}

.dd-ai-icon-btn{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--dd-ai-border);
  background: #fff;
  color: var(--dd-ai-ink);
  cursor:pointer;
  font-size: 18px;
  line-height: 1;
}

/* ---------- Messages ---------- */
.dd-ai-messages{
  flex: 1 1 auto;
  padding: 14px 14px 10px 14px;
  overflow:auto;
  background:
    radial-gradient(900px 480px at 78% 5%, rgba(216,190,229,.35), transparent 60%),
    radial-gradient(900px 480px at 18% 10%, rgba(200,206,238,.32), transparent 60%),
    #fff;
}

/* rows */
.dd-ai-msg{
  display:flex;
  align-items:flex-start;
  gap: 10px;
  margin: 10px 0;
}

/* avatar (NO circle background, bigger icon) */
.dd-ai-avatar{
  width: 36px;
  min-width: 36px;
  height: 36px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.dd-ai-avatar img{
  width: 28px;
  height: 28px;
  display:block;
  /* no circle bg */
}

/* bubbles */
.dd-ai-bubble{
  max-width: 78%;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid var(--dd-ai-border);
  background: rgba(243,228,245,.55);
  color: var(--dd-ai-ink);
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.dd-ai-bubble strong{ font-weight: 800; }

.dd-ai-bubble a{
  color: var(--dd-ai-ink);
  text-decoration: none;
  font-weight: 800;
}
.dd-ai-bubble a:hover{
  text-decoration: underline;
}

/* user message aligns right */
.dd-ai-msg.user{
  justify-content:flex-end;
}
.dd-ai-msg.user .dd-ai-avatar{ display:none; }
.dd-ai-bubble.user{
  background: #0b2540;
  border-color: rgba(255,255,255,.08);
  color: #fff;
}

/* ---------- Footer / composer ---------- */
.dd-ai-footer{
  border-top: 1px solid var(--dd-ai-border);
  padding: 12px;
  background: #fff;
  display:flex;
  flex-wrap: wrap; /* allow preview row */
  gap: 10px;
  align-items:center;
}

/* Preview row (goes on top, full width) */
.dd-ai-preview{
  width: 100%;
  display:none;
  align-items:center;
  justify-content:flex-start;
  gap: 10px;
  order: 0;
}

.dd-ai-preview.open{ display:flex; }

.dd-ai-preview-thumb{
  width: 54px;
  height: 54px;
  border-radius: 12px;
  overflow:hidden;
  border: 1px solid var(--dd-ai-border);
  background: #fff;
  flex: 0 0 auto;
}
.dd-ai-preview-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}

.dd-ai-preview-meta{
  display:flex;
  flex-direction:column;
  gap: 2px;
  min-width: 0;
}
.dd-ai-preview-meta .name{
  font-size: 13px;
  color: var(--dd-ai-ink);
  font-weight: 700;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.dd-ai-preview-meta .hint{
  font-size: 12px;
  color: var(--dd-ai-muted);
}

.dd-ai-preview-remove{
  margin-left:auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--dd-ai-border);
  background: #fff;
  cursor:pointer;
  font-size: 18px;
  line-height: 1;
}

/* buttons + input row */
.dd-ai-upload{
  order: 1;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--dd-ai-border);
  background: rgba(232,218,240,.65);
  cursor:pointer;
  font-size: 22px;
  color: var(--dd-ai-ink);
  flex: 0 0 auto;
}

.dd-ai-input{
  order: 2;
  flex: 1 1 auto;
  height: 42px;
  border-radius: 14px;
  border: 2px solid rgba(167,171,222,.65);
  padding: 0 12px;
  outline:none;
  font-size: 14px;
  color: var(--dd-ai-ink);
  background:#fff;
}

.dd-ai-send{
  order: 3;
  width: 54px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--dd-ai-border);
  cursor:pointer;
  background: rgba(167,171,222,.75);
  color: var(--dd-ai-ink);
  font-size: 18px;
}

/* ---------- Typing indicator dots ---------- */
.dd-ai-typing .dd-ai-bubble{
  background: rgba(243,228,245,.50);
}

.dd-ai-dots{
  display:inline-flex;
  gap: 6px;
  align-items:center;
}
.dd-ai-dots span{
  width: 6px;
  height: 6px;
  border-radius:50%;
  background: rgba(15,23,42,.45);
  display:inline-block;
  animation: ddAiDot 1.1s infinite ease-in-out;
}
.dd-ai-dots span:nth-child(2){ animation-delay:.15s; }
.dd-ai-dots span:nth-child(3){ animation-delay:.30s; }

@keyframes ddAiDot{
  0%, 80%, 100%{ transform: translateY(0); opacity: .55; }
  40%{ transform: translateY(-4px); opacity: 1; }
}


