/* UniversaCare Chat widget — "Uni"
   Brand colors live in the variables below. */
#uc-chat-root {
  --uc-primary: #1b4f8a;      /* UniversaCare blue */
  --uc-primary-dark: #143d6b;
  --uc-accent: #2bb3a3;       /* teal accent */
  --uc-bg: #ffffff;
  --uc-body-bg: #f4f7fb;
  --uc-text: #1f2933;
  --uc-muted: #6b7a8c;
  --uc-bot-bubble: #ffffff;
  --uc-user-bubble: var(--uc-primary);
  --uc-radius: 18px;
  --uc-shadow: 0 12px 40px rgba(16, 42, 77, .22);
  --uc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  position: fixed; z-index: 2147483000; right: 20px; bottom: 20px;
  font-family: var(--uc-font); font-size: 15px; line-height: 1.45; color: var(--uc-text);
  -webkit-font-smoothing: antialiased;
}
#uc-chat-root *, #uc-chat-root *::before, #uc-chat-root *::after { box-sizing: border-box; }

/* Launcher */
#uc-chat-launcher {
  display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px 0 16px;
  border: 0; border-radius: 28px; cursor: pointer; color: #fff;
  background: linear-gradient(135deg, var(--uc-primary), var(--uc-primary-dark));
  box-shadow: 0 8px 24px rgba(16, 42, 77, .3); font: inherit; font-weight: 600; font-size: 15px;
  transition: transform .15s ease, box-shadow .15s ease;
}
#uc-chat-launcher:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(16, 42, 77, .36); }
#uc-chat-launcher:focus-visible { outline: 3px solid var(--uc-accent); outline-offset: 2px; }
.uc-launcher-icon { display: flex; }
.uc-launcher-close { display: none; font-size: 26px; line-height: 1; }
#uc-chat-root.uc-open #uc-chat-launcher { width: 56px; padding: 0; justify-content: center; }
#uc-chat-root.uc-open .uc-launcher-icon, #uc-chat-root.uc-open .uc-launcher-label { display: none; }
#uc-chat-root.uc-open .uc-launcher-close { display: block; }
.uc-nudge { animation: uc-bounce 1.2s ease 2; }
@keyframes uc-bounce { 0%,100% { transform: translateY(0); } 30% { transform: translateY(-8px); } 60% { transform: translateY(-3px); } }
.uc-nudge-bubble {
  position: absolute; right: 0; bottom: 68px; width: 260px; padding: 12px 14px; cursor: pointer;
  background: var(--uc-bg); color: var(--uc-text); border-radius: 14px; box-shadow: var(--uc-shadow);
  font-size: 14px; animation: uc-fade .3s ease;
}
.uc-nudge-bubble::after { content: ""; position: absolute; right: 22px; bottom: -7px; width: 14px; height: 14px; background: var(--uc-bg); transform: rotate(45deg); }

/* Panel */
#uc-chat-panel {
  position: absolute; right: 0; bottom: 72px; width: 380px; max-width: calc(100vw - 40px);
  height: 600px; max-height: calc(100vh - 110px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--uc-body-bg); border-radius: var(--uc-radius); box-shadow: var(--uc-shadow);
  opacity: 0; transform: translateY(12px) scale(.98); pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
#uc-chat-root.uc-open #uc-chat-panel { opacity: 1; transform: none; pointer-events: auto; }

.uc-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; color: #fff;
  background: linear-gradient(135deg, var(--uc-primary), var(--uc-primary-dark));
}
.uc-avatar { width: 40px; height: 40px; border-radius: 50%; background: #fff; flex: 0 0 auto; }
.uc-head-text { flex: 1; min-width: 0; }
.uc-head-name { font-weight: 700; font-size: 16px; }
.uc-head-sub { font-weight: 400; opacity: .8; font-size: 13px; margin-left: 4px; }
.uc-head-status { font-size: 12px; opacity: .9; display: flex; align-items: center; gap: 6px; }
.uc-dot { width: 8px; height: 8px; border-radius: 50%; background: #5ce0a8; box-shadow: 0 0 0 3px rgba(92,224,168,.25); }
.uc-head-call { display: flex; align-items: center; gap: 5px; color: #fff; text-decoration: none; font-size: 12px; font-weight: 600; padding: 6px 9px; border-radius: 20px; background: rgba(255,255,255,.14); white-space: nowrap; }
.uc-head-call:hover { background: rgba(255,255,255,.24); color: #fff; }
.uc-head-call span { display: none; }
.uc-head-min { border: 0; background: transparent; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; padding: 2px 6px; opacity: .85; }
.uc-head-min:hover { opacity: 1; }

.uc-body { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.uc-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; }
.uc-msg.uc-user { align-self: flex-end; flex-direction: row-reverse; }
.uc-msg-avatar { width: 26px; height: 26px; border-radius: 50%; background: #fff; flex: 0 0 auto; }
.uc-bubble { padding: 10px 14px; border-radius: 16px; background: var(--uc-bot-bubble); box-shadow: 0 1px 2px rgba(0,0,0,.06); word-wrap: break-word; overflow-wrap: anywhere; }
.uc-bot .uc-bubble { border-bottom-left-radius: 6px; }
.uc-user .uc-bubble { background: var(--uc-user-bubble); color: #fff; border-bottom-right-radius: 6px; }
.uc-bubble a { color: var(--uc-primary); text-decoration: underline; }
.uc-user .uc-bubble a { color: #fff; }
.uc-anim { animation: uc-fade .25s ease; }
@keyframes uc-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.uc-typing .uc-bubble { display: flex; gap: 4px; padding: 12px 14px; }
.uc-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--uc-muted); opacity: .5; animation: uc-blink 1.2s infinite; }
.uc-typing span:nth-child(2) { animation-delay: .2s; } .uc-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes uc-blink { 0%,80%,100% { opacity: .3; } 40% { opacity: 1; } }

.uc-chips { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 34px; }
.uc-chip { border: 1.5px solid var(--uc-primary); color: var(--uc-primary); background: #fff; border-radius: 20px; padding: 7px 13px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; }
.uc-chip:hover { background: var(--uc-primary); color: #fff; }

.uc-foot { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: var(--uc-bg); border-top: 1px solid #e5eaf0; }
.uc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#uc-chat-input { flex: 1; resize: none; border: 1.5px solid #d6dde6; border-radius: 14px; padding: 10px 12px; font: inherit; font-size: 15px; line-height: 1.35; max-height: 110px; background: #fff; color: var(--uc-text); }
#uc-chat-input:focus { outline: none; border-color: var(--uc-primary); box-shadow: 0 0 0 3px rgba(27,79,138,.15); }
#uc-chat-send { width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--uc-primary); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
#uc-chat-send:hover { background: var(--uc-primary-dark); }
#uc-chat-send:disabled { opacity: .5; cursor: default; }
.uc-privacy { font-size: 11px; color: var(--uc-muted); text-align: center; padding: 0 14px 8px; background: var(--uc-bg); }

/* Mobile: full-screen sheet */
@media (max-width: 640px) {
  #uc-chat-root { right: 12px; bottom: 12px; }
  #uc-chat-launcher { height: 52px; }
  .uc-launcher-label { display: none; }
  #uc-chat-launcher { width: 52px; padding: 0; justify-content: center; }
  #uc-chat-panel { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; }
  #uc-chat-root.uc-open #uc-chat-launcher { display: none; }
  .uc-head { padding-top: calc(12px + env(safe-area-inset-top)); }
  .uc-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .uc-head-call span { display: inline; }
}
@media (min-width: 641px) { .uc-head-call span { display: inline; } }
@media (prefers-reduced-motion: reduce) { #uc-chat-root * { animation: none !important; transition: none !important; } }
