/* CleanBot — matches site blue steel, no rainbow chrome */
:root {
  --cb-z: 99980;
  --cb-bg: rgba(8, 14, 28, 0.94);
  --cb-border: rgba(59, 130, 246, 0.28);
  --cb-text: #e8f0ff;
  --cb-muted: rgba(148, 170, 210, 0.75);
  --cb-accent: #3b82f6;
  --cb-accent-soft: rgba(59, 130, 246, 0.14);
  --cb-user-bg: rgba(30, 64, 120, 0.35);
}

.cleanbot-launcher {
  position: fixed;
  z-index: var(--cb-z);
  right: max(16px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  cursor: pointer;
  background: transparent;
  border-radius: 14px;
  filter: drop-shadow(0 10px 28px rgba(0, 0, 0, 0.5));
  transition: transform 0.2s ease;
}

.cleanbot-launcher:hover {
  transform: translateY(-2px);
}

.cleanbot-launcher:focus-visible {
  outline: 2px solid var(--cb-accent);
  outline-offset: 3px;
}

.cleanbot-launcher-inner {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(22, 40, 78, 0.95) 0%, rgba(6, 12, 28, 0.98) 100%);
  border: 1px solid var(--cb-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.cleanbot-launcher-mark {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: "Space Grotesk", "DM Sans", system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: #93c5fd;
  line-height: 1;
}

.cleanbot-launcher-hint {
  position: absolute;
  right: calc(100% + 12px);
  bottom: 50%;
  transform: translateY(50%);
  white-space: nowrap;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--cb-muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.cleanbot-launcher:hover .cleanbot-launcher-hint,
.cleanbot-launcher:focus-visible .cleanbot-launcher-hint {
  opacity: 1;
}

@media (max-width: 520px) {
  .cleanbot-launcher-hint {
    display: none;
  }
}

.cleanbot-panel {
  position: fixed;
  z-index: calc(var(--cb-z) + 1);
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(400px, calc(100vw - 24px));
  max-height: min(600px, calc(100dvh - 100px));
  max-height: min(600px, calc(100vh - 100px));
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  background: var(--cb-bg);
  border: 1px solid var(--cb-border);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 20px 64px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translateY(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.28s ease, opacity 0.22s ease, visibility 0.22s;
}

.cleanbot-panel.is-open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cleanbot-head {
  position: relative;
  padding: 14px 44px 12px 16px;
  border-bottom: 1px solid rgba(59, 130, 246, 0.15);
  background: rgba(4, 10, 24, 0.65);
}

.cleanbot-brand {
  margin: 0;
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--cb-text);
}

.cleanbot-tagline {
  margin: 4px 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--cb-muted);
  max-width: 34ch;
}

.cleanbot-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.cleanbot-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.cleanbot-msgs {
  flex: 1;
  min-height: 180px;
  max-height: 400px;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cleanbot-msgs::-webkit-scrollbar {
  width: 5px;
}
.cleanbot-msgs::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.25);
  border-radius: 3px;
}

.cleanbot-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--cb-text);
}

.cleanbot-msg.user {
  align-self: flex-end;
  background: var(--cb-user-bg);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-bottom-right-radius: 4px;
}

.cleanbot-msg.bot {
  align-self: flex-start;
  background: var(--cb-accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-bottom-left-radius: 4px;
}

.cleanbot-msg.bot .cleanbot-code {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.82em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #dbeafe;
}

.cleanbot-msg.bot strong {
  color: #bfdbfe;
  font-weight: 600;
}

.cleanbot-msg.bot a {
  color: #7dd3fc;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cleanbot-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--cb-accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  font-size: 0.75rem;
  color: var(--cb-muted);
}

.cleanbot-typing-label {
  font-weight: 600;
  color: rgba(186, 210, 255, 0.85);
}

.cleanbot-typing-dots span {
  display: inline-block;
  animation: cleanbotDot 1.05s ease-in-out infinite;
  opacity: 0.35;
}
.cleanbot-typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}
.cleanbot-typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes cleanbotDot {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cleanbot-typing-dots span {
    animation: none;
    opacity: 0.8;
  }
}

.cleanbot-foot {
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(2, 6, 16, 0.5);
}

.cleanbot-note {
  font-size: 10px;
  line-height: 1.4;
  color: rgba(140, 160, 195, 0.55);
  margin: 0 0 8px;
}

.cleanbot-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.cleanbot-input {
  flex: 1;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  background: rgba(0, 0, 0, 0.35);
  color: var(--cb-text);
  font-family: inherit;
  font-size: 0.875rem;
  resize: none;
  max-height: 120px;
}

.cleanbot-input::placeholder {
  color: rgba(150, 170, 205, 0.45);
}

.cleanbot-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.cleanbot-send {
  flex-shrink: 0;
  width: 44px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: var(--cb-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.cleanbot-send:hover:not(:disabled) {
  filter: brightness(1.08);
}

.cleanbot-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cleanbot-send svg {
  width: 18px;
  height: 18px;
}

.cleanbot-error {
  font-size: 0.72rem;
  color: #fca5a5;
  margin-top: 6px;
  line-height: 1.4;
}

body.cleanbot-open {
}

@media (max-width: 480px) {
  .cleanbot-panel {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 88px);
    right: 8px;
    bottom: 8px;
  }
}
