/* Touch of Cure — AI Patient Assistant widget */
:root {
  --tcb-primary: #0d9488;
  --tcb-primary-dark: #0f766e;
  --tcb-accent: #14b8a6;
  --tcb-bg: #ffffff;
  --tcb-bubble-bot: #f0fdfa;
  --tcb-bubble-user: #0d9488;
  --tcb-text: #0f172a;
  --tcb-muted: #64748b;
  --tcb-border: #e2e8f0;
  --tcb-danger: #dc2626;
}

/* Tinni launcher — the character image itself, no button chrome/circle
   behind her; she just stands at the bottom-right corner of the screen. */
#tcbLauncher {
  position: fixed;
  right: 6px;
  bottom: 0;
  width: 128px;
  max-width: 32vw;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 99998;
  transition: transform .2s ease;
}
#tcbLauncher:hover { transform: scale(1.03); }
.tcb-launcher-img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 14px 22px rgba(15, 23, 42, .25));
}

/* Idle-state speech bubble, positioned near her raised/pointing hand
   (upper-left of the figure) and typewriter-animated from chatbot.js.
   Named .tcb-idle-bubble (NOT .tcb-bubble) on purpose — this used to share
   the .tcb-bubble class name with the actual chat message bubbles below.
   Because this rule sets opacity:0/position:absolute/pointer-events:none
   and the chat-bubble rule never re-declared those properties, EVERY chat
   bubble in the widget (bot replies, the visitor's own sent messages, even
   the typing indicator) silently inherited opacity:0 and was invisible —
   while chips (a different class) rendered fine. That's what made typed
   and clicked messages look like they "went nowhere": they were sent and
   in the DOM, just never painted. Giving this element its own class name
   is the actual fix; do not rename it back to .tcb-bubble. */
.tcb-idle-bubble {
  position: absolute;
  top: 2px;
  left: 0;
  transform: translate(-97%, 0) scale(.92);
  transform-origin: bottom right;
  min-width: 130px;
  max-width: 200px;
  background: #fff;
  color: var(--tcb-text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  padding: 10px 14px;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .18);
  opacity: 0;
  pointer-events: none;
  white-space: normal;
  text-align: left;
}
.tcb-idle-bubble::after {
  content: '';
  position: absolute;
  right: 20px;
  bottom: -5px;
  width: 12px;
  height: 12px;
  background: #fff;
  transform: rotate(45deg);
  border-radius: 2px;
}
@media (prefers-reduced-motion: no-preference) {
  .tcb-idle-bubble { transition: opacity .35s ease, transform .35s ease; }
}
.tcb-idle-bubble.tcb-bubble-show {
  opacity: 1;
  transform: translate(-100%, 0) scale(1);
}

#tcbLauncher .tcb-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--tcb-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 5px;
  min-width: 16px;
  text-align: center;
  border: 2px solid #fff;
}

/* Full-screen takeover on every device — laptop and mobile alike. */
#tcbPanel {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh; /* progressive enhancement: adjusts live when the mobile keyboard opens, where supported */
  background: var(--tcb-bg);
  z-index: 99999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
#tcbPanel.tcb-open { display: flex; animation: tcbFadeIn .2s ease; }
@keyframes tcbFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* On roomier screens, keep the header full-bleed but cap the chat column's width so
   messages don't stretch edge-to-edge and stay readable. */
@media (min-width: 640px) {
  .tcb-body, .tcb-footer { max-width: 720px; margin-left: auto; margin-right: auto; width: 100%; }
}

.tcb-header {
  background: linear-gradient(135deg, var(--tcb-primary), var(--tcb-primary-dark));
  color: #fff;
  padding: 18px 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.tcb-header-icon {
  width: 44px; height: 44px; border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 2.5px rgba(255,255,255,.55);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; line-height: 0;
}
.tcb-header-icon img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
}
.tcb-header-title { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 16.5px; line-height: 1.2; }
.tcb-header-sub { font-size: 12px; opacity: .9; margin-top: 2px; }
.tcb-close {
  margin-left: auto; background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tcb-close:hover { background: rgba(255,255,255,.28); }

.tcb-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 14px;
  background:
    radial-gradient(600px circle at 12% -8%, rgba(124, 108, 240, .07), transparent 55%),
    radial-gradient(600px circle at 100% 112%, rgba(20, 184, 166, .09), transparent 55%),
    #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
}

.tcb-msg { display: flex; max-width: 88%; }
.tcb-msg.bot { align-self: flex-start; }
.tcb-msg.user { align-self: flex-end; }
.tcb-bubble {
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
  word-wrap: break-word;
}
.tcb-msg.bot .tcb-bubble {
  background: var(--tcb-bubble-bot);
  color: var(--tcb-text);
  border: 1px solid #d3ece9;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.tcb-msg.user .tcb-bubble { background: var(--tcb-bubble-user); color: #fff; border-bottom-right-radius: 4px; }
.tcb-staff-label { font-size: 11px; font-weight: 700; color: var(--tcb-primary); margin-bottom: 3px; padding-left: 2px; }
.tcb-bubble a { color: var(--tcb-primary); font-weight: 600; text-decoration: underline; word-break: break-all; }
.tcb-msg.bot .tcb-bubble a:hover { color: var(--tcb-primary-dark); }

/* A named location card — e.g. a branch address — with its own "open in
   Google Maps" button, instead of a raw link sitting in the chat text. */
.tcb-map-card {
  background: #fff;
  border: 1px solid var(--tcb-border);
  border-radius: 14px;
  padding: 14px 16px;
  max-width: 280px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.tcb-map-card-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--tcb-text);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}
.tcb-map-card-name i { color: var(--tcb-primary); font-size: 13px; }
.tcb-map-card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--tcb-primary);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 10px;
  transition: background .15s;
}
.tcb-map-card-btn:hover { background: var(--tcb-primary-dark); }
.tcb-map-card-btn i { font-size: 12px; }

/* One card per doctor — name as the heading, then specialization, experience
   and branch each on their own row — instead of every doctor run together
   in a single paragraph. */
.tcb-doctor-card {
  background: #fff;
  border: 1px solid var(--tcb-border);
  border-radius: 14px;
  padding: 14px 16px;
  max-width: 280px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.tcb-doctor-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--tcb-text);
  margin-bottom: 8px;
}
.tcb-doctor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--tcb-muted);
  line-height: 1.6;
}
.tcb-doctor-row i { color: var(--tcb-primary); font-size: 11px; width: 12px; text-align: center; flex-shrink: 0; }

/* The one shortcut style used everywhere in the widget — from the opening
   menu to every step of a flow — a single wrapping row of pill buttons. */
.tcb-quick-replies { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; align-self: flex-start; max-width: 100%; }
.tcb-chip {
  background: #fff;
  border: 1.5px solid var(--tcb-primary);
  color: var(--tcb-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}
.tcb-chip i { font-size: 12px; }
.tcb-chip:hover { background: var(--tcb-primary); color: #fff; }
.tcb-chip:disabled { opacity: .5; cursor: default; }

.tcb-typing { display: flex; gap: 4px; padding: 12px 14px; }
.tcb-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #94a3b8;
  animation: tcbBlink 1.2s infinite ease-in-out;
}
.tcb-typing span:nth-child(2) { animation-delay: .2s; }
.tcb-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes tcbBlink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }

.tcb-btn-primary {
  background: linear-gradient(135deg, var(--tcb-primary), var(--tcb-accent));
  color: #fff; border: none; padding: 10px 16px; border-radius: 10px;
  font-weight: 700; font-size: 13.5px; cursor: pointer; flex: 1;
}
.tcb-btn-primary:disabled { opacity: .5; cursor: default; }
.tcb-btn-secondary {
  background: #fff; border: 1.5px solid var(--tcb-border); color: var(--tcb-text);
  padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 13.5px; cursor: pointer;
}

.tcb-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--tcb-border);
  background: #fff;
}
.tcb-footer input {
  flex: 1;
  border: 1.5px solid var(--tcb-border);
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 14px;
  font-family: inherit;
}
.tcb-footer input:focus { outline: none; border-color: var(--tcb-primary); }
.tcb-send {
  width: 40px; height: 40px; border-radius: 50%; border: none; flex-shrink: 0;
  background: var(--tcb-primary); color: #fff; cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.tcb-send:disabled { opacity: .5; cursor: default; }

@media (max-width: 480px) {
  #tcbLauncher { width: 92px; right: 2px; }
  .tcb-idle-bubble { font-size: 12px; max-width: 168px; padding: 8px 12px; }
}
