/* GlanzWerk Branchen-Chat — aligned to site tokens */
.gw-chat-root {
  --gw-ink: #12151a;
  --gw-muted: #5c6570;
  --gw-line: #e7eaef;
  --gw-soft: #f5f7f9;
  --gw-accent: #0b7f9b;
  --gw-accent-h: #096b84;
  --gw-dark: #0c1219;
  --gw-shadow: 0 14px 36px rgba(12, 18, 25, 0.22);
  --gw-radius: 16px;
  --font: Manrope, "Segoe UI", system-ui, sans-serif;
  --display: "Bricolage Grotesque", Manrope, system-ui, sans-serif;
  font-family: var(--font);
  color: var(--gw-ink);
  z-index: 99990;
  -webkit-font-smoothing: antialiased;
}

/* Launcher + animated mascot */
.gw-chat-launcher {
  position: fixed;
  right: 14px;
  bottom: 18px;
  z-index: 99980 !important; /* above sticky UI; below typical cookie modals if needed */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.gw-chat-launcher > * {
  pointer-events: auto;
}

/* High-visibility open control — not only mascot */
.gw-chat-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  border: 0;
  cursor: pointer;
  padding: 10px 16px 10px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0b7f9b 0%, #096b84 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(11, 127, 155, 0.4);
  font-family: var(--font);
  text-align: left;
  max-width: 200px;
}
.gw-chat-label-text {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.gw-chat-label-sub {
  font-weight: 500;
  font-size: 12px;
  opacity: 0.92;
  line-height: 1.2;
}
.gw-chat-label:hover,
.gw-chat-label:focus-visible {
  filter: brightness(1.06);
  outline: none;
}
.gw-chat-launcher.is-open .gw-chat-label {
  display: none;
}

.gw-chat-fab {
  position: relative;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(11, 127, 155, 0.28), 0 0 0 3px rgba(11, 127, 155, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden; /* keep mascot inside the circle */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: gwMascotFloat 3.2s ease-in-out infinite;
}
.gw-chat-fab--mascot {
  overflow: hidden;
}
.gw-chat-mascot-img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  object-position: center center;
  display: block;
  flex-shrink: 0;
  background: transparent;
  border-radius: 0;
  filter: none;
  transform-origin: 50% 50%;
  animation: gwMascotPulse 3.2s ease-in-out infinite;
  pointer-events: none;
  user-select: none;
}
.gw-chat-fab-dot {
  position: absolute;
  right: 10px;
  top: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
  animation: gwPulse 2s ease-out infinite;
}
.gw-chat-fab:hover,
.gw-chat-fab:focus-visible {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 18px 40px rgba(11, 127, 155, 0.35), 0 0 0 4px rgba(11, 127, 155, 0.16);
  outline: none;
  animation-play-state: paused;
}
.gw-chat-fab:hover .gw-chat-mascot-img {
  animation-play-state: paused;
  transform: scale(1.04);
}
.gw-chat-launcher.is-open .gw-chat-fab {
  animation: none;
  transform: scale(0.92);
  box-shadow: 0 8px 20px rgba(12, 18, 25, 0.22), 0 0 0 3px rgba(11, 127, 155, 0.2);
}
.gw-chat-launcher.is-open .gw-chat-mascot-img {
  animation: none;
}
.gw-chat-fab--pop .gw-chat-mascot-img {
  animation: gwMascotPop 0.4s ease;
}
.gw-chat-fab[data-pose="think"] .gw-chat-mascot-img {
  animation: gwMascotThink 1.4s ease-in-out infinite;
}

@keyframes gwMascotFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}
@keyframes gwMascotSway {
  0%,
  100% {
    transform: rotate(-1.5deg);
  }
  50% {
    transform: rotate(2deg);
  }
}
@keyframes gwMascotPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}
@keyframes gwMascotPop {
  0% {
    transform: scale(0.9) rotate(-4deg);
  }
  50% {
    transform: scale(1.08) rotate(3deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}
@keyframes gwMascotThink {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  50% {
    transform: translateY(-3px) rotate(-2deg);
  }
}
@keyframes gwPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gw-chat-fab,
  .gw-chat-mascot-img,
  .gw-chat-fab-dot {
    animation: none !important;
  }
}

/* Panel */
.gw-chat-panel {
  position: fixed;
  right: 18px;
  bottom: 110px;
  z-index: 99985 !important;
  width: min(392px, calc(100vw - 28px));
  height: min(540px, calc(100vh - 130px));
  background: #fff;
  border-radius: var(--gw-radius);
  box-shadow: var(--gw-shadow);
  border: 1px solid var(--gw-line);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: gwChatIn 0.18s ease;
}
.gw-chat-panel.is-open {
  display: flex;
}

@keyframes gwChatIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 720px) {
  .gw-chat-launcher {
    right: 8px;
    bottom: 70px;
  }
  .gw-chat-fab {
    width: 78px;
    height: 78px;
  }
  .gw-chat-mascot-img {
    width: 74px;
    height: 74px;
  }
  .gw-chat-panel {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: 160px;
    height: min(70vh, 520px);
  }
}

.gw-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 13px;
  background: linear-gradient(135deg, var(--gw-dark) 0%, #0e3d4a 48%, var(--gw-accent) 100%);
  color: #fff;
}
.gw-chat-head img,
.gw-chat-head-mascot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  object-position: center;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}
.gw-chat-head-text {
  min-width: 0;
}
.gw-chat-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.gw-chat-head p {
  margin: 3px 0 0;
  font-size: 11.5px;
  opacity: 0.88;
  letter-spacing: 0.01em;
}
.gw-chat-close {
  margin-left: auto;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.gw-chat-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.gw-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 10px;
  background: var(--gw-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gw-chat-bubble {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.48;
  color: var(--gw-ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.gw-chat-bubble.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--gw-line);
  border-bottom-left-radius: 5px;
  box-shadow: 0 1px 2px rgba(12, 18, 25, 0.04);
}
.gw-chat-bubble.user {
  align-self: flex-end;
  background: var(--gw-accent);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.gw-chat-bubble.sys {
  align-self: center;
  background: transparent;
  color: var(--gw-muted);
  font-size: 12px;
  max-width: 100%;
  text-align: center;
  padding: 4px 8px;
}

.gw-chat-typing {
  align-self: flex-start;
  font-size: 12px;
  color: var(--gw-muted);
  padding: 2px 6px;
}

.gw-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--gw-line);
  background: #fff;
}
.gw-chat-form input[type="text"] {
  flex: 1;
  border: 1px solid var(--gw-line);
  border-radius: 999px;
  padding: 11px 15px;
  font: inherit;
  font-size: 14px;
  outline: none;
  background: var(--gw-soft);
  color: var(--gw-ink);
}
.gw-chat-form input[type="text"]:focus {
  border-color: var(--gw-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(11, 127, 155, 0.14);
}
.gw-chat-form button[type="submit"] {
  border: 0;
  border-radius: 999px;
  background: var(--gw-accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 0 18px;
  cursor: pointer;
  letter-spacing: 0.01em;
}
.gw-chat-form button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.gw-chat-form button[type="submit"]:not(:disabled):hover {
  background: var(--gw-accent-h);
}

.gw-chat-foot {
  font-size: 10px;
  color: var(--gw-muted);
  text-align: center;
  padding: 0 12px 10px;
  background: #fff;
  line-height: 1.4;
}
.gw-chat-foot a {
  color: var(--gw-accent);
  text-decoration: none;
  font-weight: 600;
}
.gw-chat-foot a:hover {
  text-decoration: underline;
}
