/* ==========================================================================
   Студирај БГ — chat assistant styles (uses the site's design tokens)
   ========================================================================== */
:root {
  --cb-ink: var(--ink, #0A1633);
  --cb-navy: var(--navy, #19409A);
  --cb-cyan: var(--cyan, #00C2EE);
  --cb-soft: var(--cyan-soft, #E3F8FE);
  --cb-line: var(--line, #E3E9F3);
  --cb-text: var(--text, #1E2A44);
  --cb-muted: var(--muted, #5B6782);
  --cb-font: var(--font-body, "Onest", system-ui, sans-serif);
  --cb-grad: var(--grad, linear-gradient(135deg, #19409A 0%, #2A6FDB 55%, #00C2EE 100%));
}

/* launcher */
.cb-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 10000;
  width: 62px; height: 62px; border-radius: 50%; border: 0;
  background: var(--cb-grad); color: #fff; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 12px 30px rgba(25, 64, 154, .4);
  transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .25s;
}
.cb-launcher::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(0, 194, 238, .45);
  animation: cb-pulse 2.4s ease-out infinite;
}
.cb-open .cb-launcher::before { display: none; }
.cb-launcher:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 16px 36px rgba(25, 64, 154, .5); }
.cb-launcher svg { grid-area: 1 / 1; transition: transform .25s, opacity .2s; }
.cb-launcher .cb-ico-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.cb-open .cb-launcher .cb-ico-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.cb-open .cb-launcher .cb-ico-close { opacity: 1; transform: none; }
.cb-badge {
  position: absolute; top: -2px; right: -2px; width: 22px; height: 22px;
  border-radius: 50%; background: #FFCC00; color: var(--cb-ink);
  font: 700 12px/22px var(--cb-font); text-align: center;
  box-shadow: 0 0 0 3px #fff;
}
.cb-launcher:focus-visible, .cb-window button:focus-visible, .cb-input:focus-visible {
  outline: 3px solid rgba(0, 194, 238, .6); outline-offset: 2px;
}

/* keep the site's back-to-top button above the launcher */
.back-to-top { bottom: 100px !important; right: 29px !important; }

/* window */
.cb-window {
  position: fixed; right: 24px; bottom: 100px; z-index: 10000;
  width: 390px; height: 600px; max-height: calc(100vh - 124px);
  background: #fff; border-radius: 24px; overflow: hidden;
  display: flex; flex-direction: column;
  border: 1px solid var(--cb-line);
  box-shadow: 0 24px 60px rgba(10, 22, 51, .24);
  font-family: var(--cb-font); color: var(--cb-text);
  opacity: 0; transform: translateY(16px) scale(.97); transform-origin: bottom right;
  pointer-events: none; visibility: hidden;
  transition: opacity .22s, transform .22s cubic-bezier(.2,.7,.2,1), visibility 0s linear .22s;
}
.cb-window.open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity .22s, transform .22s cubic-bezier(.2,.7,.2,1), visibility 0s; }

.cb-header {
  position: relative;
  background:
    radial-gradient(260px 120px at 100% 0%, rgba(0, 194, 238, .35), transparent 70%),
    linear-gradient(135deg, #0A1633 0%, #19409A 100%);
  color: #fff; padding: 16px 14px 16px 16px;
  display: flex; align-items: center; gap: 12px;
}
.cb-avatar {
  width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18);
  display: grid; place-items: center; overflow: hidden;
}
.cb-avatar img { width: 82%; height: 82%; object-fit: contain; }
.cb-avatar.small { width: 28px; height: 28px; border-radius: 9px; background: var(--cb-ink); border: 0; }
.cb-title { flex: 1; line-height: 1.25; min-width: 0; }
.cb-title strong { display: block; font-size: 15.5px; font-weight: 700; color: #fff; }
.cb-title span { font-size: 12px; color: rgba(255, 255, 255, .75); }
.cb-title span::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px;
  border-radius: 50%; background: #4ADE80; vertical-align: 1px;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, .25);
}
.cb-icon-btn {
  background: transparent; border: 0; color: #fff; cursor: pointer;
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  transition: background .15s;
}
.cb-icon-btn:hover { background: rgba(255, 255, 255, .14); }

.cb-messages {
  flex: 1; overflow-y: auto; padding: 18px 14px 12px;
  display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth;
  background: linear-gradient(180deg, #F5F8FC 0%, #fff 140px);
}

.cb-row { display: flex; gap: 8px; align-items: flex-end; animation: cb-in .25s ease-out; }
.cb-row.user { justify-content: flex-end; }
.cb-row.bot .cb-avatar.small { visibility: hidden; }
.cb-row.bot.last-in-group .cb-avatar.small { visibility: visible; }

.cb-bubble {
  max-width: 82%; padding: 10px 14px; font-size: 14.5px; line-height: 1.5;
  border-radius: 18px; word-wrap: break-word;
}
.cb-row.bot .cb-bubble { background: #fff; border: 1px solid var(--cb-line); border-bottom-left-radius: 6px; box-shadow: 0 1px 2px rgba(10, 22, 51, .04); }
.cb-row.user .cb-bubble { background: var(--cb-navy); color: #fff; border-bottom-right-radius: 6px; }
.cb-bubble ul { margin: 6px 0 2px; padding-left: 18px; }
.cb-bubble li { margin: 3px 0; font-size: 14px !important; line-height: 1.45; color: inherit; }
.cb-bubble li::marker { color: var(--cb-cyan); }
.cb-bubble strong { color: var(--cb-ink); }
.cb-row.user .cb-bubble strong { color: #fff; }
.cb-bubble a { color: var(--cb-navy); text-decoration: underline; text-underline-offset: 2px; }
.cb-bubble a.cb-more {
  display: inline-flex; align-items: center; margin-top: 10px;
  font-size: 13px; font-weight: 600; text-decoration: none;
  color: var(--cb-navy); background: var(--cb-soft);
  padding: 6px 12px; border-radius: 999px;
}
.cb-bubble a.cb-more:hover { background: var(--cb-navy); color: #fff; }
.cb-time { font-size: 11px; color: var(--cb-muted); margin: -4px 0 2px; }
.cb-time.user { text-align: right; }
.cb-time.bot { margin-left: 36px; }

/* chips */
.cb-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-left: 36px; animation: cb-in .25s ease-out; }
.cb-chips.stack { flex-direction: column; align-items: flex-start; }
.cb-chip {
  font: 500 13.5px/1.3 var(--cb-font); color: var(--cb-navy);
  background: var(--cb-soft); border: 1px solid transparent;
  padding: 8px 14px; border-radius: 999px; cursor: pointer; text-align: left;
  transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.cb-chip:hover { background: #fff; border-color: var(--cb-navy); }
.cb-chip.ghost { background: transparent; border-color: #CBD5E1; color: var(--cb-muted); }
.cb-chip.ghost:hover { border-color: var(--cb-navy); color: var(--cb-navy); }
.cb-chip.picked { background: var(--cb-navy); color: #fff; }
.cb-chips.used { opacity: .45; pointer-events: none; }
.cb-chips.used .cb-chip.picked { opacity: 1; }

/* the two main categories get large tiles */
.cb-chips.big { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-right: 4px; }
.cb-chips.big .cb-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 14px; border-radius: 16px; font-weight: 600; font-size: 14px;
  background: #fff; border: 1px solid var(--cb-line); color: var(--cb-ink);
  box-shadow: 0 1px 2px rgba(10, 22, 51, .05);
}
.cb-chips.big .cb-chip:hover { border-color: var(--cb-cyan); transform: translateY(-2px); box-shadow: 0 8px 18px rgba(10, 22, 51, .08); }
.cb-chips.big .cb-chip.picked { background: var(--cb-ink); color: #fff; border-color: var(--cb-ink); }
.cb-chip-icon {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  font-size: 18px; background: var(--cb-soft);
}

.cb-label { font-size: 12px; color: var(--cb-muted); margin: 2px 0 -4px 36px; }

.cb-typing { display: flex; gap: 4px; padding: 14px 16px; }
.cb-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9AA5B4; animation: cb-bounce 1.2s infinite; }
.cb-typing i:nth-child(2) { animation-delay: .15s; }
.cb-typing i:nth-child(3) { animation-delay: .3s; }

.cb-inputbar { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--cb-line); background: #fff; }
.cb-input {
  flex: 1; min-width: 0; border: 1px solid var(--cb-line); border-radius: 999px; padding: 11px 16px;
  font: 14.5px var(--cb-font); color: var(--cb-text); outline: none; background: #F5F8FC;
  transition: border-color .15s, background .15s;
}
.cb-input:focus { border-color: var(--cb-cyan); background: #fff; box-shadow: 0 0 0 3px rgba(0, 194, 238, .18); }
.cb-input:focus-visible { outline: none; }
.cb-send {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; flex-shrink: 0;
  background: var(--cb-cyan); color: var(--cb-ink); display: grid; place-items: center;
  transition: background .15s, opacity .15s;
}
.cb-send:hover:not(:disabled) { background: var(--cb-navy); color: #fff; }
.cb-send:disabled { opacity: .4; cursor: default; }

@keyframes cb-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes cb-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes cb-pulse { 0% { transform: scale(.92); opacity: .9; } 100% { transform: scale(1.25); opacity: 0; } }

@media (max-width: 480px) {
  .cb-launcher { right: 16px; bottom: 16px; width: 56px; height: 56px; }
  .back-to-top { bottom: 84px !important; right: 18px !important; }
  .cb-window { right: 0; bottom: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; }
  .cb-open .cb-launcher { display: none; }
  .cb-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .cb-row, .cb-chips, .cb-window, .cb-typing i, .cb-launcher::before { animation: none !important; transition: none !important; }
}
