/* =====================================================================
   Smiley — Floating AI Dental Chat Widget
   Dr. Parmod's Speciality Dental Clinic
   ===================================================================== */

#smiley-widget {
  position: fixed;
  right: 22px;
  bottom: 160px;
  z-index: 200;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ── Toggle Button ─────────────────────────────────────────────────── */
#smiley-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #0A2352;
  border: none;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 22px rgba(10,35,82,.38);
  transition: transform .2s, box-shadow .2s;
  position: relative;
}
#smiley-btn:hover { transform: scale(1.08); box-shadow: 0 8px 30px rgba(10,35,82,.48); }
#smiley-btn:focus-visible { outline: 3px solid #60a5fa; outline-offset: 3px; }

.smiley-btn-tip {
  position: absolute; right: 66px; top: 50%; transform: translateY(-50%);
  background: #0A2352; color: #fff;
  font-size: 12.5px; font-weight: 700;
  padding: 7px 12px; border-radius: 8px;
  white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .15s;
}
#smiley-btn:hover .smiley-btn-tip { opacity: 1; }

.smiley-unread {
  position: absolute; top: -7px; right: -7px;
  background: #DC2626; color: #fff;
  font-size: 10px; font-weight: 800;
  width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid #fff;
  animation: smilelyPop .3s ease;
}
@keyframes smilelyPop {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ── Chat Panel ────────────────────────────────────────────────────── */
#smiley-panel {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: 318px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 14px 52px rgba(7,26,61,.18), 0 2px 8px rgba(7,26,61,.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(.95);
  pointer-events: none;
  transition: opacity .22s cubic-bezier(.4,0,.2,1), transform .22s cubic-bezier(.4,0,.2,1);
}
#smiley-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.smiley-header {
  display: flex; align-items: center; justify-content: space-between;
  background: #0A2352;
  padding: 13px 14px;
  flex-shrink: 0;
}
.smiley-header-info { display: flex; align-items: center; gap: 10px; }
.smiley-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: grid; place-items: center; font-size: 22px;
  flex-shrink: 0;
}
.smiley-name { font-size: 15px; font-weight: 800; color: #fff; line-height: 1.2; }
.smiley-tagline {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: rgba(255,255,255,.65); margin-top: 1px;
}
.smiley-online-dot { width: 7px; height: 7px; border-radius: 50%; background: #3EE07E; flex-shrink: 0; }
.smiley-close {
  background: none; border: none; color: rgba(255,255,255,.6); cursor: pointer;
  padding: 5px; border-radius: 8px; line-height: 0;
  transition: color .15s, background .15s;
}
.smiley-close:hover { color: #fff; background: rgba(255,255,255,.12); }

/* Messages area */
.smiley-messages {
  flex: 1; overflow-y: auto;
  padding: 14px 12px 8px;
  display: flex; flex-direction: column; gap: 10px;
  background: #f1f5f9;
  min-height: 220px; max-height: 280px;
  scroll-behavior: smooth;
}
.smiley-messages::-webkit-scrollbar { width: 4px; }
.smiley-messages::-webkit-scrollbar-track { background: transparent; }
.smiley-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.smiley-msg { display: flex; }
.smiley-msg-user  { justify-content: flex-end; }
.smiley-msg-assistant { justify-content: flex-start; }

.smiley-bubble {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.58;
  word-break: break-word;
}
.smiley-msg-user .smiley-bubble {
  background: #0A2352;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.smiley-msg-assistant .smiley-bubble {
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(7,26,61,.06);
}

/* Typing indicator */
.smiley-typing-bubble {
  display: flex; align-items: center; gap: 5px;
  padding: 13px 16px;
}
.smiley-typing-bubble span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #94a3b8;
  animation: smileyBounce .9s ease-in-out infinite;
}
.smiley-typing-bubble span:nth-child(2) { animation-delay: .15s; }
.smiley-typing-bubble span:nth-child(3) { animation-delay: .30s; }
@keyframes smileyBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .7; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Input area */
.smiley-input-area {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}
#smiley-input {
  flex: 1;
  border: 1.5px solid #e2e8f0; border-radius: 12px;
  padding: 9px 12px;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 13.5px;
  color: #1e293b; background: #f8fafc;
  outline: none;
  transition: border-color .15s, background .15s;
}
#smiley-input:focus { border-color: #2563eb; background: #fff; }
#smiley-input::placeholder { color: #94a3b8; }

#smiley-send {
  width: 38px; height: 38px; border-radius: 50%;
  background: #0A2352; border: none;
  color: #fff; cursor: pointer;
  display: grid; place-items: center; flex-shrink: 0;
  transition: background .15s, transform .15s;
  line-height: 0;
}
#smiley-send:hover { background: #2563eb; transform: scale(1.08); }
#smiley-send:disabled { opacity: .45; cursor: not-allowed; transform: none; }
#smiley-send svg { width: 16px; height: 16px; }

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  #smiley-widget { right: 14px; bottom: 80px; }
  #smiley-panel { width: min(318px, calc(100vw - 28px)); }
}
