/**
 * chatbot-widget/chatbot.css
 *
 * Styles for the Techshot chatbot widget.
 * All rules are scoped under .ts-chatbot-* to avoid conflicts with the
 * main site stylesheet.
 */

/* ── Launcher button ─────────────────────────────────────────────── */

.ts-chatbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #F22727;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(242, 39, 39, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.ts-chatbot-launcher:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(242, 39, 39, 0.45);
}

.ts-chatbot-launcher:focus-visible {
  outline: 2px solid #F22727;
  outline-offset: 3px;
}

.ts-chatbot-launcher svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
  transition: transform 0.25s ease;
}

.ts-chatbot-launcher[aria-expanded="true"] svg {
  transform: rotate(90deg) scale(0.85);
}

/* Hide launcher when panel is open (mobile) */
@media (max-width: 479px) {
  .ts-chatbot-launcher[aria-expanded="true"] {
    opacity: 0;
    pointer-events: none;
  }
}

/* ── Backdrop overlay (mobile only) ──────────────────────────────── */

.ts-chatbot-backdrop {
  display: none;
}

@media (max-width: 479px) {
  .ts-chatbot-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .ts-chatbot-backdrop.ts-chatbot-backdrop--visible {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ── Chat panel ──────────────────────────────────────────────────── */

.ts-chatbot-panel {
  position: fixed;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.92);
  font-family: "Zalando Sans Expanded Variable", "Zalando Sans Expanded",
    "Zalando Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  letter-spacing: -0.01em;
  overflow: hidden;

  /* Closed state */
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.97);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.ts-chatbot-panel--open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Desktop: fixed card near launcher */
@media (min-width: 480px) {
  .ts-chatbot-panel {
    bottom: 92px;
    right: 24px;
    width: 380px;
    height: 520px;
    max-height: calc(100vh - 120px);
    border-radius: 18px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  }
}

/* Mobile: full-width drawer from bottom */
@media (max-width: 479px) {
  .ts-chatbot-panel {
    bottom: 0;
    left: 0;
    right: 0;
    height: 85vh;
    max-height: 85vh;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.6);
    transform: translateY(100%);
  }

  .ts-chatbot-panel--open {
    transform: translateY(0);
  }
}

/* ── Panel header ────────────────────────────────────────────────── */

.ts-chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  flex-shrink: 0;
}

.ts-chatbot-header-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ts-chatbot-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.ts-chatbot-close:hover {
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.92);
}

.ts-chatbot-close:focus-visible {
  outline: 2px solid #F22727;
  outline-offset: 2px;
}

.ts-chatbot-close svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ── Panel body (message area) ───────────────────────────────────── */

.ts-chatbot-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Placeholder text when no messages */
.ts-chatbot-body > .ts-chatbot-placeholder {
  text-align: center;
  color: rgba(255, 255, 255, 0.38);
  font-size: 13px;
  line-height: 1.6;
  margin: auto;
}

/* ── Messages ────────────────────────────────────────────────────── */

.ts-chatbot-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 85%;
}

.ts-chatbot-msg--user {
  align-self: flex-end;
  align-items: flex-end;
}

.ts-chatbot-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

/* Assistant bubble */
.ts-chatbot-msg:not(.ts-chatbot-msg--user):not(.ts-chatbot-msg--error) .ts-chatbot-msg-bubble {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  border-bottom-left-radius: 4px;
}

/* User bubble */
.ts-chatbot-msg--user .ts-chatbot-msg-bubble {
  background: #F22727;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Error bubble */
.ts-chatbot-msg--error .ts-chatbot-msg-bubble {
  background: rgba(242, 39, 39, 0.12);
  color: rgba(255, 120, 120, 0.95);
  border: 1px solid rgba(242, 39, 39, 0.2);
  border-bottom-left-radius: 4px;
}

/* Retry button */
.ts-chatbot-retry {
  margin-top: 6px;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.ts-chatbot-retry:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
}

.ts-chatbot-retry:focus-visible {
  outline: 2px solid #F22727;
  outline-offset: 2px;
}

/* ── Thinking indicator ──────────────────────────────────────────── */

.ts-chatbot-thinking .ts-chatbot-msg-bubble {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.ts-chatbot-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  animation: ts-chatbot-bounce 1.2s infinite ease-in-out;
}

.ts-chatbot-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.ts-chatbot-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ts-chatbot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ── Panel footer (input area) ───────────────────────────────────── */

.ts-chatbot-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.ts-chatbot-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 6px 6px 6px 14px;
  transition: border-color 0.15s ease;
}

.ts-chatbot-input-row:focus-within {
  border-color: rgba(242, 39, 39, 0.5);
}

.ts-chatbot-input {
  flex: 1 1 auto;
  border: none;
  outline: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  padding: 4px 0;
  font-family: inherit;
}

.ts-chatbot-input::placeholder {
  color: rgba(255, 255, 255, 0.30);
}

.ts-chatbot-send {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #F22727;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.ts-chatbot-send:disabled {
  opacity: 0.35;
  cursor: default;
}

.ts-chatbot-send:not(:disabled):hover {
  transform: scale(1.08);
}

.ts-chatbot-send:focus-visible {
  outline: 2px solid #F22727;
  outline-offset: 2px;
}

.ts-chatbot-send svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Turnstile container — invisible, zero-size */
.ts-chatbot-turnstile {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ── Consent banner (inside panel) ───────────────────────────────── */

.ts-chatbot-consent {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  text-align: center;
  gap: 20px;
}

.ts-chatbot-consent-text {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
}

.ts-chatbot-consent-link {
  color: #F22727;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ts-chatbot-consent-link:hover {
  color: #ff5252;
}

.ts-chatbot-consent-buttons {
  display: flex;
  gap: 10px;
}

.ts-chatbot-consent-accept,
.ts-chatbot-consent-dismiss {
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
  border: none;
  font-family: inherit;
}

.ts-chatbot-consent-accept {
  background: #F22727;
  color: #fff;
}

.ts-chatbot-consent-accept:hover {
  background: #d91e1e;
  transform: scale(1.03);
}

.ts-chatbot-consent-accept:focus-visible {
  outline: 2px solid #F22727;
  outline-offset: 2px;
}

.ts-chatbot-consent-dismiss {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ts-chatbot-consent-dismiss:hover {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.92);
}

.ts-chatbot-consent-dismiss:focus-visible {
  outline: 2px solid #F22727;
  outline-offset: 2px;
}

/* ── Reduced motion ──────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .ts-chatbot-launcher,
  .ts-chatbot-panel,
  .ts-chatbot-backdrop,
  .ts-chatbot-launcher svg,
  .ts-chatbot-dot {
    transition: none;
    animation: none;
  }
}

/* ── Screen-reader-only utility ──────────────────────────────────── */

.ts-chatbot-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
