/* Tobalt sprendimai expanding bubble explorer
 * Author: Tobalt — https://tobalt.lt
 * Deployed on root viesajam + 5 subdomain homepages only.
 */

.tsb-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #6865FF;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px -6px rgba(104, 101, 255, 0.5);
  z-index: 9000;
  transition: transform .25s ease, box-shadow .25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tsb-launcher:hover { transform: scale(1.08); box-shadow: 0 12px 32px -6px rgba(104, 101, 255, 0.6); }
.tsb-launcher__icon {
  width: 30px;
  height: 30px;
  display: block;
  transition: transform .35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tsb-launcher__icon .tsb-icon-center { transform-origin: 15px 15px; transition: r .3s ease, fill .3s ease; }
.tsb-launcher__icon .tsb-icon-sat {
  transform-origin: 15px 15px;
  transition: transform .4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tsb-launcher--open .tsb-launcher__icon { transform: rotate(45deg); }
.tsb-launcher--open .tsb-launcher__icon .tsb-icon-center { r: 3; fill: #FFA77E; }
.tsb-launcher--open .tsb-launcher__icon .tsb-icon-sat-1 { transform: translate(-3px, -3px); }
.tsb-launcher--open .tsb-launcher__icon .tsb-icon-sat-2 { transform: translate(3px, -3px); }
.tsb-launcher--open .tsb-launcher__icon .tsb-icon-sat-3 { transform: translate(3px, 3px); }
.tsb-launcher--open .tsb-launcher__icon .tsb-icon-sat-4 { transform: translate(-3px, 3px); }
/* Idle hover: gentle satellite drift */
.tsb-launcher:hover .tsb-icon-sat-1 { transform: translate(-1.5px, -1.5px); }
.tsb-launcher:hover .tsb-icon-sat-2 { transform: translate(1.5px, -1.5px); }
.tsb-launcher:hover .tsb-icon-sat-3 { transform: translate(1.5px, 1.5px); }
.tsb-launcher:hover .tsb-icon-sat-4 { transform: translate(-1.5px, 1.5px); }
.tsb-launcher__label {
  position: absolute;
  right: 76px;
  top: 50%;
  transform: translateY(-50%);
  background: #000229;
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.tsb-launcher:hover .tsb-launcher__label { opacity: 1; }
.tsb-launcher--open .tsb-launcher__label { opacity: 0; }

/* Pulse animation when bubble first appears */
@keyframes tsbPulse {
  0%, 100% { box-shadow: 0 8px 24px -6px rgba(104, 101, 255, 0.5), 0 0 0 0 rgba(104, 101, 255, 0.7); }
  50% { box-shadow: 0 8px 24px -6px rgba(104, 101, 255, 0.5), 0 0 0 18px rgba(104, 101, 255, 0); }
}
.tsb-launcher--pulse { animation: tsbPulse 2.2s ease-out 1s 2; }

/* Backdrop */
.tsb-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 2, 41, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 8999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.tsb-backdrop--visible { opacity: 1; pointer-events: auto; }

/* Cluster — desktop expanding fan */
.tsb-cluster {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9001;
}
.tsb-topic {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--tsb-color, #6865FF);
  color: #000229;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.4);
  border: 3px solid #fff;
  transition: transform .35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity .25s ease;
  opacity: 0;
  transform: scale(0) translate(0, 0);
}
.tsb-cluster--open .tsb-topic { opacity: 1; }
.tsb-topic:hover { transform: var(--tsb-pos) scale(1.08) !important; }
.tsb-topic__count {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.7;
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* Tool bubbles fanning from a topic */
.tsb-tool {
  position: absolute;
  padding: 10px 16px;
  border-radius: 999px;
  background: #fff;
  color: #000229;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  pointer-events: auto;
  text-decoration: none;
  border: 2px solid var(--tsb-color, #6865FF);
  opacity: 0;
  transform: scale(0);
  transition: transform .3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity .2s ease;
}
.tsb-topic--expanded ~ .tsb-tool[data-parent] { opacity: 0; transform: scale(0); }
.tsb-tool--visible { opacity: 1 !important; transform: var(--tsb-pos) scale(1) !important; }
.tsb-tool:hover { transform: var(--tsb-pos) scale(1.1) translateY(-2px) !important; }
.tsb-tool:hover .tsb-tool__tip { opacity: 1; transform: translate(-50%, -8px); pointer-events: auto; }
.tsb-tool__tip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, 0);
  background: #000229;
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  width: max-content;
  max-width: 280px;
  white-space: normal;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 9002;
}
.tsb-tool__tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-top-color: #000229;
}

/* Mobile: drawer instead of cluster */
@media (max-width: 767px) {
  .tsb-launcher { width: 56px; height: 56px; bottom: 16px; right: 16px; }
  .tsb-launcher__label { display: none; }
  .tsb-cluster { display: none; }
  .tsb-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 9001;
    transform: translateY(100%);
    transition: transform .35s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 24px 20px 32px;
  }
  .tsb-drawer--visible { transform: translateY(0); }
  .tsb-drawer__heading { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #5F6168; margin-bottom: 20px; }
  .tsb-drawer__topic { margin-bottom: 22px; }
  .tsb-drawer__topic-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
  .tsb-drawer__topic-dot { width: 14px; height: 14px; border-radius: 50%; }
  .tsb-drawer__topic-name { font-size: 16px; font-weight: 700; color: #000229; }
  .tsb-drawer__tools { display: flex; flex-direction: column; gap: 8px; }
  .tsb-drawer__tool { padding: 12px 16px; border-radius: 14px; background: #F6F7FB; border-left: 4px solid var(--tsb-color, #6865FF); color: #000229; text-decoration: none; display: block; }
  .tsb-drawer__tool-name { font-size: 14px; font-weight: 700; color: #000229; margin-bottom: 4px; }
  .tsb-drawer__tool-summary { font-size: 12px; line-height: 1.4; color: #5F6168; font-weight: 400; }
}

@media (min-width: 768px) {
  .tsb-drawer { display: none; }
}
