.iut-chatbot {
  --cb-navy:        #0f2d6b;
  --cb-navy-mid:    #1a4494;
  --cb-navy-light:  #2258b8;
  --cb-crimson:     #b01e37;
  --cb-crimson-dk:  #8c1629;
  --cb-crimson-lt:  #d4294a;
  --cb-bg:          #f2f4f8;
  --cb-surface:     #ffffff;
  --cb-border:      #dde3f0;
  --cb-text:        #1a2540;
  --cb-text-muted:  #5c6882;
  --cb-chip-bg:     #ffffff;
  --cb-chip-border: #c8d3ea;
  --cb-chip-hover:  #eaf0ff;
  --cb-shadow-sm:   0 2px 8px rgba(15,45,107,.10);
  --cb-shadow-md:   0 8px 28px rgba(15,45,107,.15);
  --cb-shadow-lg:   0 24px 56px rgba(15,45,107,.22);
  --cb-radius-panel: 20px;
  --cb-radius-msg:   14px;
  --cb-radius-chip:  999px;
  --cb-launcher:    clamp(52px, 3.5vw, 62px);
  --cb-panel-w:     clamp(330px, 28vw, 400px);
  --cb-panel-h:     clamp(480px, 74vh, 700px);
  --cb-edge:        20px;
 
  position: fixed;
  right: var(--cb-edge);
  bottom: var(--cb-edge);
  top: auto;
  z-index: 2600;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  color: var(--cb-text);
}
 
.iut-chatbot * { box-sizing: border-box; }
 
/* ---------- launcher button ---------- */
.iut-chatbot__toggle {
  display: grid;
  place-items: center;
  width: var(--cb-launcher);
  height: var(--cb-launcher);
  border: 0;
  border-radius: 18px;
  background: transparent;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15,45,107,.28), 0 2px 6px rgba(15,45,107,.14);
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative;
}
 
.iut-chatbot__toggle:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 32px rgba(15,45,107,.32), 0 4px 10px rgba(15,45,107,.16);
}
 
.iut-chatbot__toggle:active { transform: scale(.96); }
 
.iut-chatbot__toggle-icon {
  display: block;
  width: var(--cb-launcher);
  height: var(--cb-launcher);
  object-fit: contain;
  border-radius: 16px;
}
 
/* online pulse badge on launcher */
.iut-chatbot__toggle::after {
  content: '';
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 11px;
  height: 11px;
  background: #22c55e;
  border: 2px solid #fff;
  border-radius: 50%;
  animation: cbPulse 2.4s ease infinite;
}
 
@keyframes cbPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
  60%       { box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}
 
/* ---------- panel ---------- */
.iut-chatbot__panel {
  position: fixed;
  top: clamp(100px, 14vh, 160px);
  right: var(--cb-edge);
  width: min(var(--cb-panel-w), calc(100vw - (var(--cb-edge) * 2)));
  height: min(
    var(--cb-panel-h),
    calc(100vh - clamp(100px, 14vh, 160px) - 28px)
  );
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--cb-radius-panel);
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  box-shadow: var(--cb-shadow-lg);
 
  /* panel entrance animation */
  transform-origin: bottom right;
  animation: none;
}
 
.iut-chatbot.is-open .iut-chatbot__panel {
  display: flex;
  animation: cbSlideIn .32s cubic-bezier(.22,.68,0,1.2) both;
}
 
@keyframes cbSlideIn {
  from { opacity: 0; transform: scale(.88) translateY(16px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}
 
/* ---------- header ---------- */
.iut-chatbot__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--cb-navy) 0%, var(--cb-navy-light) 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
 
/* decorative arc in header */
.iut-chatbot__header::before {
  content: '';
  position: absolute;
  top: -28px;
  right: -28px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  pointer-events: none;
}
 
.iut-chatbot__header::after {
  content: '';
  position: absolute;
  bottom: -40px;
  right: 30px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
  pointer-events: none;
}
 
.iut-chatbot__header-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}
 
/* avatar circle in header */
.iut-chatbot__avatar {
  width: 42px;
  height: 42px;
  border-radius: 0;
  background: transparent;
  border: 0;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: visible;
  padding: 0;
}

.iut-chatbot__avatar-image {
  width: 42px;
  height: 42px;
  object-fit: contain;
  object-position: center;
  display: block;
}
 
.iut-chatbot__header-text { display: flex; flex-direction: column; }
 
.iut-chatbot__title,
.iut-chatbot__status { margin: 0; }
 
.iut-chatbot__title {
  font-size: .94rem;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.2;
}
 
.iut-chatbot__status {
  font-size: .72rem;
  color: rgba(255,255,255,.72);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}
 
/* green dot in status line */
.iut-chatbot__status::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74,222,128,.7);
  flex-shrink: 0;
}
 
/* minimize button */
.iut-chatbot__icon-btn {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 50%;
  background: rgba(255,255,255,.10);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background .18s;
  display: grid;
  place-items: center;
}
 
.iut-chatbot__icon-btn:hover { background: rgba(255,255,255,.22); }
 
/* ---------- messages area ---------- */
.iut-chatbot__messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 16px 14px 10px;
  background: var(--cb-bg);
  /* subtle dot pattern */
  background-image: radial-gradient(circle, #c8d3ea 1px, transparent 1px);
  background-size: 22px 22px;
  background-color: #f2f4f8;
  scroll-behavior: smooth;
}

.iut-chatbot__thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
 
/* custom scrollbar */
.iut-chatbot__messages::-webkit-scrollbar { width: 4px; }
.iut-chatbot__messages::-webkit-scrollbar-track { background: transparent; }
.iut-chatbot__messages::-webkit-scrollbar-thumb {
  background: #c5cfe3;
  border-radius: 4px;
}
.iut-chatbot__messages::-webkit-scrollbar-thumb:hover { background: #a0afc8; }
 
/* ---------- individual messages ---------- */
.iut-chatbot__message {
  max-width: 92%;
  padding: 10px 13px;
  border-radius: var(--cb-radius-msg);
  font-size: .625rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  animation: cbMsgIn .22s ease both;
}
 
@keyframes cbMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
 
/* bot message */
.iut-chatbot__message--bot {
  align-self: flex-start;
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  color: var(--cb-text);
  border-bottom-left-radius: 4px;
  box-shadow: var(--cb-shadow-sm);
  position: relative;
}
 
.iut-chatbot__message--bot,
.iut-chatbot__message--bot * { color: var(--cb-text) !important; }
 
.iut-chatbot__message--bot p { margin: 0 0 6px; }
.iut-chatbot__message--bot p:last-child,
.iut-chatbot__message--bot ul:last-child { margin-bottom: 0; }
 
.iut-chatbot__message--bot ul {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.iut-chatbot__message--bot li { margin-bottom: 3px; }

.iut-chatbot__message--bot p:last-child {
  margin-bottom: 0;
}
 
.iut-chatbot__message--bot strong {
  font-weight: 700;
  color: var(--cb-navy) !important;
}

.iut-chatbot__message--bot a.iut-chatbot__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--cb-chip-border);
  background: #f7f9ff;
  color: var(--cb-navy) !important;
  text-decoration: none;
  font-weight: 700;
  box-shadow: var(--cb-shadow-sm);
}

.iut-chatbot__message--bot a.iut-chatbot__link:hover {
  background: var(--cb-chip-hover);
}

.iut-chatbot__inline-image {
  display: inline-block;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0 0.35rem 0 0;
  vertical-align: -0.18rem;
  object-fit: contain;
}
 
/* user message */
.iut-chatbot__message--user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--cb-crimson) 0%, var(--cb-crimson-lt) 100%);
  color: #fff !important;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(176,30,55,.28);
}
 
.iut-chatbot__message--user,
.iut-chatbot__message--user * { color: #fff !important; }
 
/* ---------- choices / chips area ---------- */
.iut-chatbot__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  padding: 4px 0 0;
  background: transparent;
  border: 0;
  max-height: none;
  overflow: visible;
}

.iut-chatbot.stage-main_menu .iut-chatbot__choices,
.iut-chatbot.stage-admission_discipline .iut-chatbot__choices,
.iut-chatbot.stage-admission_program .iut-chatbot__choices,
.iut-chatbot.stage-scholarship_scheme .iut-chatbot__choices,
.iut-chatbot.stage-scholarship_detail .iut-chatbot__choices,
.iut-chatbot.stage-info .iut-chatbot__choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}

.iut-chatbot.stage-main_menu .iut-chatbot__choice,
.iut-chatbot.stage-admission_discipline .iut-chatbot__choice,
.iut-chatbot.stage-admission_program .iut-chatbot__choice,
.iut-chatbot.stage-scholarship_scheme .iut-chatbot__choice,
.iut-chatbot.stage-scholarship_detail .iut-chatbot__choice,
.iut-chatbot.stage-info .iut-chatbot__choice {
  width: 100%;
  white-space: normal;
  text-align: left;
}

.iut-chatbot.stage-admission_program .iut-chatbot__choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}

.iut-chatbot.stage-admission_program .iut-chatbot__choice {
  width: 100%;
  white-space: normal;
  text-align: left;
  padding: 8px 12px;
  font-size: .625rem;
}

.iut-chatbot__choices::-webkit-scrollbar { width: 3px; }
.iut-chatbot__choices::-webkit-scrollbar-track { background: transparent; }
.iut-chatbot__choices::-webkit-scrollbar-thumb { background: #c5cfe3; border-radius: 3px; }
 
.iut-chatbot__choice {
  border: 1.5px solid var(--cb-chip-border);
  border-radius: var(--cb-radius-chip);
  background: var(--cb-chip-bg);
  color: var(--cb-navy);
  padding: 7px 14px;
  font-size: .625rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.3;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s, transform .15s, box-shadow .18s;
  box-shadow: 0 1px 4px rgba(15,45,107,.07);
}
 
.iut-chatbot__choice:hover:not(:disabled) {
  background: var(--cb-chip-hover);
  border-color: var(--cb-navy-mid);
  color: var(--cb-navy);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15,45,107,.12);
}
 
.iut-chatbot__choice:active:not(:disabled) {
  transform: scale(.96);
}
 
.iut-chatbot__choice:disabled {
  cursor: not-allowed;
  opacity: .48;
}
 
/* ---------- navigation controls ---------- */
.iut-chatbot__controls {
  display: flex;
  gap: 8px;
  width: 100%;
  padding: 4px 0 0;
  background: transparent;
  border-top: 0;
}

.iut-chatbot__control {
  height: 34px;
  padding: 0 14px;
  border: 1.5px solid var(--cb-chip-border);
  border-radius: var(--cb-radius-chip);
  background: transparent;
  color: var(--cb-text-muted);
  font-size: .625rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .18s, color .18s, background .18s, transform .15s;
}

.iut-chatbot__control:hover:not(:disabled) {
  transform: translateY(-1px);
}

.iut-chatbot__control--back:hover:not(:disabled) {
  border-color: var(--cb-navy-mid);
  color: var(--cb-navy);
  background: rgba(26,68,148,.05);
}

.iut-chatbot__control--reset:hover:not(:disabled) {
  border-color: var(--cb-crimson);
  color: var(--cb-crimson);
  background: rgba(176,30,55,.05);
}

.iut-chatbot__control:disabled {
  cursor: not-allowed;
  opacity: .45;
}
 
/* ---------- inline card (for answer data tables) ---------- */
.iut-chatbot__message--bot table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: inherit;
}

.iut-chatbot__message--bot table td,
.iut-chatbot__message--bot table th {
  padding: 5px 8px;
  border: 1px solid #dde3f0;
  color: var(--cb-text) !important;
  font-size: inherit;
}
 
.iut-chatbot__message--bot table th {
  background: #eef2fb;
  font-weight: 700;
}
/* =========================================================
   MOBILE  — full-screen takeover
   ========================================================= */
@media (max-width: 640px) {
  .iut-chatbot {
    right: 14px;
    bottom: 100px;
    --cb-launcher: 50px;
  }
 
  .iut-chatbot__toggle {
    width: 50px;
    height: 50px;
    border-radius: 14px;
  }
 
  .iut-chatbot__toggle-icon {
    width: 50px;
    height: 50px;
  }
 
  .iut-chatbot.is-open {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    width: 100vw;
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    z-index: 4000;
  }
 
  .iut-chatbot__panel {
    position: fixed;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100svh !important;
    height: 100dvh !important;
    max-height: none !important;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    z-index: 4001;
    animation: cbSlideUp .3s cubic-bezier(.22,.68,0,1.12) both;
  }
 
  @keyframes cbSlideUp {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: translateY(0); }
  }
 
  .iut-chatbot__toggle[aria-expanded="true"] { display: none !important; }
 
  .iut-chatbot__header { padding: 14px 16px; min-height: 64px; }
 
  .iut-chatbot__messages { padding: 16px 12px 10px; }

  .iut-chatbot__choices { gap: 7px; }

  .iut-chatbot__choice { padding: 8px 12px; font-size: .625rem; }

  .iut-chatbot.stage-main_menu .iut-chatbot__choices,
  .iut-chatbot.stage-admission_discipline .iut-chatbot__choices,
  .iut-chatbot.stage-admission_program .iut-chatbot__choices,
  .iut-chatbot.stage-scholarship_scheme .iut-chatbot__choices,
  .iut-chatbot.stage-scholarship_detail .iut-chatbot__choices,
  .iut-chatbot.stage-info .iut-chatbot__choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .iut-chatbot__control {
    flex: 1;
  }
}