/* Study Migrate Global – website chatbot (SMG Assistant)
   Colours follow the site: teal #129696, dark teal #0B5E5E, gold #FFD700. */

#smgBot, #smgBot * { box-sizing: border-box; }
#smgBot {
  --c-teal: #129696; --c-dark: #0B5E5E; --c-gold: #FFD700; --c-soft: #f4fafa; --c-line: #e3f0f0;
  font-family: 'Inter', system-ui, sans-serif; font-size: 14px; line-height: 1.45; color: #1f2937;
}
#smgBot button { font-family: inherit; cursor: pointer; }

.smgb-launch {
  position: fixed; right: 24px; bottom: 24px; z-index: 55;
  display: flex; flex-direction: column; align-items: center;
}
body:has(.whatsapp-float) .smgb-launch { bottom: 118px; }
.smgb-launcher {
  width: 68px; height: 68px; padding: 0; border-radius: 50%;
  border: 3px solid #facc15; cursor: pointer; color: #fff;
  background: #fff;
  display: flex; align-items: center; justify-content: center; position: relative;
  box-shadow: 0 10px 25px rgba(13, 148, 136, .5), inset 0 0 15px rgba(255, 255, 255, .2);
  animation: smgbFloat 4s ease-in-out infinite;
  transition: transform .4s cubic-bezier(.175, .885, .32, 1.275), box-shadow .4s ease, border-color .4s ease;
}
.smgb-launcher:hover {
  transform: scale(1.1) translateY(-5px);
  border-color: #fde047;
  box-shadow: 0 15px 35px rgba(13, 148, 136, .7), inset 0 0 20px rgba(250, 204, 21, .3);
}
.smgb-launcher:focus-visible { outline: 3px solid var(--c-gold); outline-offset: 4px; }
.smgb-launcher::before, .smgb-launcher::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid #facc15; pointer-events: none; z-index: -1;
  animation: smgbPulse 2s cubic-bezier(.455, .03, .515, .955) infinite;
}
.smgb-launcher::after { animation-delay: 1s; }
.smgb-launcher .smgb-ai {
  width: 40px; height: 40px; display: block; object-fit: contain;
  animation: smgbCap 2s ease-in-out infinite alternate;
}
.smgb-launcher:hover .smgb-ai { transform: scale(1.06); animation: none; }
.smgb-ai-tip {
  position: absolute; bottom: calc(100% + 22px); right: 0;
  transform: translateY(6px);
  display: inline-flex; align-items: center; gap: 6px;
  background: #0B5E5E; color: #fff; white-space: nowrap;
  padding: 4px 10px 4px 4px; border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: .1px; border: 1.5px solid #facc15; opacity: 0; pointer-events: none;
  box-shadow: 0 8px 18px rgba(11, 94, 94, .28);
  transition: opacity .25s ease, transform .25s ease;
}
.smgb-ai-badge {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  background: #FFD700; color: #0B5E5E;
  display: inline-flex; align-items: center; justify-content: center;
}
.smgb-ai-badge svg { width: 12px; height: 12px; display: block; }
.smgb-ai-tip::after {
  content: ""; position: absolute; bottom: -5px; right: 28px;
  width: 8px; height: 8px; background: #0B5E5E;
  border-right: 1.5px solid #facc15; border-bottom: 1.5px solid #facc15;
  transform: rotate(45deg);
}
.smgb-launch:hover .smgb-ai-tip { opacity: 1; transform: translateY(0); }
@keyframes smgbFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes smgbPulse {
  0% { transform: scale(.9); opacity: .8; }
  100% { transform: scale(1.55); opacity: 0; }
}
@keyframes smgbCap {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}
.smgb-badge {
  position: absolute; top: -4px; right: -4px; z-index: 2; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
  display: none; align-items: center; justify-content: center; border: 2px solid #fff;
}
.smgb-badge.on { display: flex; }
.smgb-nudge {
  position: fixed; right: 96px; bottom: 34px; z-index: 55; max-width: 230px;
  background: #fff; color: #0B5E5E; font-weight: 600; font-size: 13px;
  padding: 10px 28px 10px 14px; border-radius: 14px 14px 4px 14px;
  box-shadow: 0 10px 30px rgba(11, 94, 94, .22); border: 1px solid var(--c-line);
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .3s, transform .3s;
}
body:has(.whatsapp-float) .smgb-nudge { bottom: 118px; }
.smgb-nudge.on { opacity: 1; transform: none; pointer-events: auto; }
.smgb-nudge button.x { position: absolute; top: 4px; right: 6px; border: 0; background: none; color: #94a3b8; font-size: 16px; line-height: 1; }
.smgb-nudge button.go { border: 0; background: none; padding: 0; text-align: left; color: inherit; font: inherit; }

.smgb-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 56;
  width: 390px; max-width: calc(100vw - 24px); height: min(640px, calc(100dvh - 48px));
  background: #fff; border-radius: 20px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(11, 94, 94, .32), 0 0 0 1px rgba(11, 94, 94, .08);
  transform-origin: bottom right; opacity: 0; transform: translateY(16px) scale(.96); visibility: hidden;
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
}
.smgb-panel.open { opacity: 1; transform: none; visibility: visible; }

.smgb-head {
  background: linear-gradient(135deg, var(--c-dark), var(--c-teal)); color: #fff;
  padding: 14px 14px 14px 16px; display: flex; align-items: center; gap: 12px; position: relative;
}
.smgb-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--c-gold); }
.smgb-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden; border: 2px solid var(--c-gold);
}
.smgb-avatar .smgb-ai { width: 28px; height: 28px; display: block; object-fit: contain; }
.smgb-title { flex: 1; min-width: 0; }
.smgb-title strong { display: block; font-family: 'Poppins', sans-serif; font-size: 15px; font-weight: 600; letter-spacing: -.1px; }
.smgb-status { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smgb-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(74, 222, 128, .25); }
.smgb-dot.off { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251, 191, 36, .25); }
.smgb-hbtn {
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .12); color: #fff;
  height: 30px; min-width: 30px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s;
}
.smgb-hbtn:hover { background: rgba(255, 255, 255, .26); }
.smgb-hbtn:focus-visible { outline: 2px solid var(--c-gold); outline-offset: 2px; }
.smgb-hbtn svg { width: 15px; height: 15px; }

.smgb-log {
  flex: 1; overflow-y: auto; padding: 16px 14px 8px; background: var(--c-soft);
  display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; overscroll-behavior: contain;
}
.smgb-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; animation: smgbIn .25s ease both; }
.smgb-row.user { justify-content: flex-end; }
@keyframes smgbIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.smgb-mini { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 1.5px solid var(--c-gold); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.smgb-mini .smgb-ai { width: 16px; height: 16px; display: block; object-fit: contain; }
.smgb-stack { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 84%; }
.smgb-msg { padding: 9px 13px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-line; }
.smgb-row.bot .smgb-msg { background: #fff; border: 1px solid var(--c-line); border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(11, 94, 94, .05); }
.smgb-row.user .smgb-msg { background: var(--c-teal); color: #fff; border-bottom-right-radius: 4px; max-width: 84%; }
.smgb-msg b, .smgb-msg strong { color: var(--c-dark); font-weight: 700; }
.smgb-msg a { color: var(--c-teal); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.smgb-time { font-size: 10.5px; color: #94a3b8; margin: 0 4px; }
.smgb-row.user .smgb-time { text-align: right; }

.smgb-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.smgb-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-teal); opacity: .35; animation: smgbDot 1s infinite ease-in-out; }
.smgb-typing i:nth-child(2) { animation-delay: .15s; }
.smgb-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes smgbDot { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-4px); opacity: 1; } }

.smgb-cards { display: flex; flex-direction: column; gap: 8px; }
.smgb-card { background: #fff; border: 1px solid var(--c-line); border-radius: 14px; padding: 11px 12px; box-shadow: 0 1px 2px rgba(11, 94, 94, .05); }
.smgb-card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.smgb-card-h .fi { width: 30px; height: 30px; border-radius: 50%; background-size: cover; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); flex-shrink: 0; }
.smgb-card-h strong { color: var(--c-dark); font-family: 'Poppins', sans-serif; font-size: 14px; line-height: 1.2; }
.smgb-card-h small { display: block; color: var(--c-teal); font-weight: 600; font-size: 11.5px; }
.smgb-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; margin: 0; }
.smgb-kv dt { color: #6b7280; }
.smgb-kv dd { margin: 0; font-weight: 600; color: #1f2937; }
.smgb-list { margin: 4px 0 0; padding: 0; list-style: none; font-size: 12.5px; }
.smgb-list li { padding-left: 16px; position: relative; margin: 2px 0; }
.smgb-list li::before { content: "✓"; position: absolute; left: 0; color: var(--c-teal); font-weight: 700; }
.smgb-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.smgb-btn {
  border: 0; border-radius: 999px; padding: 7px 13px; font-size: 12.5px; font-weight: 700; text-decoration: none !important;
  display: inline-flex; align-items: center; gap: 6px; background: var(--c-teal); color: #fff !important; transition: background .15s, transform .15s;
}
.smgb-btn:hover { background: var(--c-dark); transform: translateY(-1px); }
.smgb-btn.alt { background: rgba(18, 150, 150, .1); color: var(--c-teal) !important; }
.smgb-btn.alt:hover { background: var(--c-teal); color: #fff !important; }
.smgb-btn.wa { background: #0B5E5E; box-shadow: inset 0 0 0 2px var(--c-gold); }
.smgb-btn:focus-visible { outline: 2px solid var(--c-dark); outline-offset: 2px; }

.smgb-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 2px 34px; animation: smgbIn .25s ease both; }
.smgb-chip {
  border: 1.5px solid var(--c-teal); background: #fff; color: var(--c-teal); border-radius: 999px;
  padding: 6px 12px; font-size: 12.5px; font-weight: 600; transition: all .15s;
}
.smgb-chip:hover { background: var(--c-teal); color: #fff; }
.smgb-chip:focus-visible { outline: 2px solid var(--c-dark); outline-offset: 2px; }

.smgb-form { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--c-line); align-items: center; }
.smgb-input {
  flex: 1; min-width: 0; border: 1.5px solid #e5e7eb; background: #f9fafb; border-radius: 999px;
  padding: 10px 14px; font: inherit; color: #111827; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.smgb-input:focus { border-color: var(--c-teal); background: #fff; box-shadow: 0 0 0 3px rgba(18, 150, 150, .15); }
.smgb-send {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--c-teal); color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; transition: background .15s, transform .15s;
}
.smgb-send:hover { background: var(--c-dark); transform: scale(1.06); }
.smgb-send:disabled { background: #cbd5e1; cursor: default; transform: none; }
.smgb-send:focus-visible { outline: 2px solid var(--c-gold); outline-offset: 2px; }
.smgb-send svg { width: 18px; height: 18px; }
.smgb-foot { text-align: center; font-size: 10.5px; color: #94a3b8; padding: 0 12px 8px; background: #fff; }
.smgb-foot a { color: #64748b; text-decoration: underline; }

.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 520px) {
  .smgb-panel { right: 0; bottom: 0; left: 0; width: 100%; max-width: 100%; height: 100dvh; border-radius: 0; }
  .smgb-launch { right: 16px; bottom: 16px; }
  body:has(.whatsapp-float) .smgb-launch { bottom: 108px; }
  .smgb-launcher { width: 60px; height: 60px; }
  .smgb-launcher .smgb-ai { width: 32px; height: 32px; }
  .smgb-ai-tip { display: none; }
  .smgb-nudge { right: 16px; left: 16px; bottom: 96px; max-width: none; }
  body:has(.whatsapp-float) .smgb-nudge { bottom: 164px; }
  .smgb-input { font-size: 16px; }
  body.smgb-lock { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .smgb-panel, .smgb-row, .smgb-quick, .smgb-nudge, .smgb-launcher, .smgb-launcher::before, .smgb-launcher::after, .smgb-launcher .smgb-ai { transition: none !important; animation: none !important; }
  .smgb-log { scroll-behavior: auto; }
}
