/* =========================================================
   CYBA Widgets (Security Cam)
   - Marquee topic chips
   - Single chat widget with input & autosize up to ~65vh
   - Hidden scrollbars in messages
   ========================================================= */

.cyba-widget-grid {
  width: 100%;
  min-height: 180px; /* keeps layout stable while JS loads */
}

/* ---------- Marquee layout ---------- */
.cyba-marquee {
  overflow: hidden;
  width: 100%;
  background: #fafafa;
  padding: 16px 0;
  box-shadow: inset 0 -1px 4px rgba(0, 0, 0, 0.07);
  margin-bottom: 8px;
}

.cyba-marquee-inner {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  will-change: transform;
}

.cyba-marquee:hover .cyba-marquee-inner {
  animation-play-state: paused;
}

/* Direction */
@keyframes cyba-scroll-l {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@keyframes cyba-scroll-r {
  from { transform: translateX(-50%); }
  to   { transform: translateX(0); }
}

.cyba-scroll-l { animation: cyba-scroll-l 60s linear infinite; }
.cyba-scroll-r { animation: cyba-scroll-r 60s linear infinite; }

/* ---------- Topic chip ---------- */
.cyba-topic-btn {
  position: relative;
  height: 42px;
  border: none;
  border-radius: 21px;
  background: #333;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
}

.cyba-topic-btn svg {
  width: 24px;
  height: 24px;
  fill: #fff;
  flex: 0 0 auto;
}

.cyba-topic-label {
  display: inline;
}

.cyba-topic-x {
  font-size: 22px;
  line-height: 1;
  display: none;
}

.cyba-topic-btn--open svg,
.cyba-topic-btn--open .cyba-topic-label {
  display: none;
}
.cyba-topic-btn--open .cyba-topic-x {
  display: inline-block;
}

/* ---------- Chat widget ---------- */
.cyba-chat-widget {
  position: fixed;
  bottom: 160px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;

  width: 520px;
  max-width: 92vw;

  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  overflow: hidden;

  display: none;
  flex-direction: column;

  /* JS will autosize height; these are safety bounds */
  min-height: 320px;
  max-height: 65vh;

  animation: cyba-slideUp 0.18s ease-out;
}

.cyba-chat-widget--open {
  display: flex;
}

@keyframes cyba-slideUp {
  from { transform: translate(-50%, 8%); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}

/* Header must be black */
.cyba-chat-widget__header {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 10px 12px;
  background: #000;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.cyba-chat-widget__title {
  padding-right: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cyba-chat-widget__close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

/* Messages area (scrollbar hidden) */
.cyba-chat-widget__messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f5f5f5;
  border-top: 1px solid #ddd;

  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  font-family: system-ui, sans-serif;

  /* hide scrollbar */
  scrollbar-width: none;      /* Firefox */
  -ms-overflow-style: none;   /* IE/Edge legacy */
}
.cyba-chat-widget__messages::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.cyba-msg { margin-bottom: 10px; }
.cyba-msg__role { font-weight: 700; margin-bottom: 4px; }

.cyba-msg__bubble {
  background: #fff;
  border: 1px solid #e4e4e4;
  border-radius: 12px;
  padding: 10px 12px;
}

.cyba-msg--user .cyba-msg__bubble {
  background: #e9f0ff;
  border-color: #d2ddff;
}

/* Composer */
.cyba-chat-widget__composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #ddd;
}

.cyba-chat-widget__input {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 999px;
  padding: 10px 12px;
  outline: none;
}

.cyba-chat-widget__input:focus {
  border-color: #000;
}

.cyba-chat-widget__send {
  border: none;
  background: #000;
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}

.cyba-chat-widget__send:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
