/* Shitbot (Shitoshi) chat widget styles.
 * Everything is namespaced with the shitbot- prefix so nothing collides
 * with the site's own styles. No external dependencies. */

/* Brand tokens: match the site's dark design language. */
.shitbot-root {
  --shitbot-bg: #1a1a2e;
  --shitbot-panel-bg: #14141f;
  --shitbot-text: #f2f2f5;
  --shitbot-muted: #9a9ab0;
  --shitbot-gold: var(--orange, var(--gold, #f0b90b));
  --shitbot-bubble: #f5f5f7;
  --shitbot-radius: 16px;
  font-family: inherit;
  color: var(--shitbot-text);
}

/* ---------- Floating bubble: futuristic AI orb ----------
 * Mr. Shitoshi in a glowing dark-glass orb with a rotating energy ring
 * and a neon AI badge. Flagship visual, pure CSS, zero assets. */
.shitbot-bubble {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  line-height: 1;
  /* dark glass orb face with a warm core glow */
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 214, 120, 0.22) 0%, rgba(255, 214, 120, 0) 42%),
    radial-gradient(circle at 50% 50%, #2b2b45 0%, #1a1a2e 52%, #0b0b14 100%);
  box-shadow:
    0 0 22px rgba(240, 185, 11, 0.38),
    0 0 70px rgba(240, 185, 11, 0.14),
    0 10px 30px rgba(0, 0, 0, 0.65),
    inset 0 1px 3px rgba(255, 255, 255, 0.16),
    inset 0 -6px 12px rgba(0, 0, 0, 0.5);
  animation: shitbot-breathe 3.6s ease-in-out infinite;
  transition: transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Rotating energy ring: thin conic arc masked to a ring, like a HUD scanner. */
.shitbot-bubble::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    #ffd76e 0deg,
    #ff9a00 40deg,
    rgba(240, 185, 11, 0.06) 110deg,
    rgba(255, 106, 0, 0.55) 200deg,
    rgba(240, 185, 11, 0.06) 280deg,
    #ffd76e 340deg,
    #ffd76e 360deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  animation: shitbot-ring-spin 5s linear infinite;
  pointer-events: none;
}

/* Soft halo on the page behind the orb. */
.shitbot-bubble::after {
  content: '';
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 170, 40, 0.35) 0%, rgba(255, 170, 40, 0) 70%);
  filter: blur(10px);
  z-index: -1;
  pointer-events: none;
}

.shitbot-bubble-mascot {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 0 7px rgba(255, 190, 60, 0.55)) saturate(1.08);
}

/* Futuristic AI badge: dark metal chip, neon border + glow. */
.shitbot-bubble-ai {
  position: absolute;
  right: -4px;
  bottom: -2px;
  z-index: 2;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 1.6px;
  padding: 4px 7px 4px 8px;
  border-radius: 7px;
  line-height: 1;
  color: #ffd76e;
  background: linear-gradient(135deg, #101018 0%, #26263e 60%, #101018 100%);
  border: 1px solid rgba(255, 190, 60, 0.85);
  box-shadow:
    0 0 12px rgba(240, 185, 11, 0.65),
    0 2px 8px rgba(0, 0, 0, 0.6),
    inset 0 1px 1px rgba(255, 255, 255, 0.14);
  text-shadow: 0 0 8px rgba(255, 190, 60, 0.9);
  user-select: none;
  -webkit-user-select: none;
}

.shitbot-bubble:hover {
  transform: scale(1.07);
}
.shitbot-bubble:hover::before {
  animation-duration: 1.6s; /* energy ring spins up on hover */
}
.shitbot-bubble:active {
  transform: scale(0.95);
}
.shitbot-bubble:focus-visible {
  outline: 2px solid #ffd76e;
  outline-offset: 4px;
}

@keyframes shitbot-ring-spin {
  to { transform: rotate(360deg); }
}
@keyframes shitbot-breathe {
  0%, 100% {
    box-shadow:
      0 0 22px rgba(240, 185, 11, 0.38),
      0 0 70px rgba(240, 185, 11, 0.14),
      0 10px 30px rgba(0, 0, 0, 0.65),
      inset 0 1px 3px rgba(255, 255, 255, 0.16),
      inset 0 -6px 12px rgba(0, 0, 0, 0.5);
  }
  50% {
    box-shadow:
      0 0 30px rgba(240, 185, 11, 0.55),
      0 0 90px rgba(240, 185, 11, 0.22),
      0 10px 30px rgba(0, 0, 0, 0.65),
      inset 0 1px 3px rgba(255, 255, 255, 0.2),
      inset 0 -6px 12px rgba(0, 0, 0, 0.5);
  }
}

/* First-visit attention ping, once per session, then still. */
.shitbot-bubble.shitbot-pulse {
  animation: shitbot-breathe 3.6s ease-in-out infinite, shitbot-pulse 1.6s ease-out 2;
}
@keyframes shitbot-pulse {
  0%   { filter: drop-shadow(0 0 0 rgba(240, 185, 11, 0.55)); }
  70%  { filter: drop-shadow(0 0 18px rgba(240, 185, 11, 0)); }
  100% { filter: drop-shadow(0 0 0 rgba(240, 185, 11, 0)); }
}

/* Panel header avatar picks up a matching energy glow. */
.shitbot-avatar {
  box-shadow: 0 0 10px rgba(240, 185, 11, 0.35), 0 0 0 1px rgba(240, 185, 11, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  .shitbot-bubble { animation: none; transition: none; }
  .shitbot-bubble::before { animation: none; }
  .shitbot-bubble.shitbot-pulse { animation: none; }
  .shitbot-typing span { animation: none; }
}

/* ---------- Panel ---------- */
.shitbot-panel {
  position: fixed;
  right: 24px;
  bottom: 96px; /* clears the 60px bubble + margin */
  width: 380px;
  height: 520px;
  max-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  background: var(--shitbot-panel-bg);
  border-radius: var(--shitbot-radius);
  border: 1px solid rgba(240, 185, 11, 0.18);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  z-index: 99991;
  overflow: hidden;
}
.shitbot-panel[hidden] { display: none; }

/* ---------- Header ---------- */
.shitbot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--shitbot-bg);
  border-bottom: 1px solid rgba(240, 185, 11, 0.15);
  flex: 0 0 auto;
}
.shitbot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--shitbot-gold);
  color: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex: 0 0 auto;
  overflow: hidden;
}
.shitbot-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.shitbot-title {
  flex: 1 1 auto;
  min-width: 0;
}
.shitbot-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}
.shitbot-subtitle {
  font-size: 12px;
  color: var(--shitbot-muted);
  line-height: 1.3;
}
.shitbot-mode {
  display: block;
  font-size: 11px;
  color: var(--shitbot-muted);
  opacity: 0.75;
  margin-top: 2px;
}
.shitbot-close {
  background: transparent;
  border: none;
  color: var(--shitbot-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  flex: 0 0 auto;
}
.shitbot-close:hover { color: var(--shitbot-text); background: rgba(255,255,255,0.06); }
.shitbot-close:focus-visible { outline: 2px solid var(--shitbot-gold); }

/* ---------- Messages ---------- */
.shitbot-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.shitbot-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: break-word;
  word-break: break-word;
}
.shitbot-msg p { margin: 0 0 8px; }
.shitbot-msg p:last-child { margin-bottom: 0; }
.shitbot-msg-bot {
  align-self: flex-start;
  background: #23233a;
  color: var(--shitbot-text);
  border-bottom-left-radius: 4px;
}
.shitbot-msg-user {
  align-self: flex-end;
  background: var(--shitbot-gold);
  color: #1a1a2e;
  border-bottom-right-radius: 4px;
}
.shitbot-msg-error {
  align-self: center;
  max-width: 92%;
  background: transparent;
  color: var(--shitbot-muted);
  font-style: italic;
  font-size: 13px;
  text-align: center;
  padding: 4px 8px;
}

/* Typing indicator */
.shitbot-typing {
  align-self: flex-start;
  background: #23233a;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: flex;
  gap: 5px;
}
.shitbot-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--shitbot-muted);
  animation: shitbot-blink 1.2s infinite;
}
.shitbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.shitbot-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes shitbot-blink {
  0%, 60%, 100% { opacity: 0.25; }
  30% { opacity: 1; }
}

/* ---------- Quick replies ---------- */
.shitbot-chips {
  display: flex;
  gap: 8px;
  padding: 10px 12px 4px;
  overflow-x: auto;
  flex: 0 0 auto;
  -webkit-overflow-scrolling: touch;
}
.shitbot-chip {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid rgba(240, 185, 11, 0.5);
  color: var(--shitbot-gold);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.shitbot-chip:hover { background: rgba(240, 185, 11, 0.12); }
.shitbot-chip:focus-visible { outline: 2px solid var(--shitbot-gold); outline-offset: 2px; }
.shitbot-chip:disabled { opacity: 0.45; cursor: default; }

/* ---------- Input ---------- */
.shitbot-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px 14px;
  flex: 0 0 auto;
}
.shitbot-input {
  flex: 1 1 auto;
  min-width: 0;
  background: #0f0f1a;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: var(--shitbot-text);
  font-size: 14px;
  padding: 10px 15px;
  outline: none;
}
.shitbot-input:focus { border-color: var(--shitbot-gold); }
.shitbot-input::placeholder { color: var(--shitbot-muted); }
.shitbot-send {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--shitbot-gold);
  color: #1a1a2e;
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shitbot-send:hover { filter: brightness(1.08); }
.shitbot-send:active { transform: scale(0.94); }
.shitbot-send:focus-visible { outline: 2px solid var(--shitbot-text); outline-offset: 2px; }
.shitbot-send:disabled { opacity: 0.5; cursor: default; }

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .shitbot-panel {
    left: 5vw;
    right: 5vw;
    width: auto;
    height: 60vh;
    max-height: 480px;
    min-height: 300px;
    bottom: 84px; /* clears the bubble + margin */
  }
  .shitbot-bubble {
    right: 16px;
    bottom: 16px;
    width: 60px;
    height: 60px;
  }
  .shitbot-bubble-mascot {
    width: 38px;
    height: 38px;
  }
  .shitbot-bubble-ai {
    font-size: 10px;
    padding: 3px 6px 3px 7px;
    right: -3px;
    bottom: -3px;
  }
  .shitbot-avatar {
    width: 32px;
    height: 32px;
  }
}
