/* ==========================================================================
   Cookie-Banner + Chat-Widget — Styles für widgets.js
   Übernommen aus dem Funnel-Kit. Nutzt die Brand-CSS-Variablen der Seite.
   ========================================================================== */
/* ========================================================================
   COOKIE-BANNER – separat, slide-up beim Erstbesuch
   ======================================================================== */
.cb {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 460px;
  z-index: 80;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px rgba(15,17,21,0.18), 0 8px 16px rgba(15,17,21,0.06);
  padding: 18px 20px 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
  transform: translateY(calc(100% + 32px));
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
  pointer-events: none;
}
.cb.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
@media (max-width: 540px) {
  .cb { left: 12px; right: 12px; padding: 16px 16px 14px; }
}
.cb__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.cb__ico {
  width: 22px; height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  flex-shrink: 0;
}
.cb__title { font-size: 14px; font-weight: 700; color: var(--ink); }
.cb__text { margin: 0 0 12px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.cb__text a { color: var(--brand); text-decoration: underline; }
.cb__text strong { color: var(--ink-2); }
.cb__row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cb__btn {
  flex: 1;
  min-width: 130px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t);
}
.cb__btn:hover { border-color: var(--ink-2); color: var(--ink); }
.cb__btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.cb__btn--primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }

/* ========================================================================
   TALENT ASSISTANT (Chat + FAQs + Cookie-Settings im Widget)
   ======================================================================== */
.aiw {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom));
  right: 16px;
  z-index: 70;
}
/* Wenn Cookie-Banner sichtbar ist, das Widget etwas höher schieben */
body.has-cookie-banner .aiw {
  bottom: calc(220px + env(safe-area-inset-bottom));
  transition: bottom 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (max-width: 540px) {
  body.has-cookie-banner .aiw {
    bottom: calc(280px + env(safe-area-inset-bottom));
  }
}

/* Floating Trigger - Kreiselement */
.aiw__btn {
  position: relative;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 32px -6px rgba(174, 15, 10, 0.55), 0 4px 8px rgba(15,17,21,0.12);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
  isolation: isolate;
  overflow: visible;
}
.aiw__btn:hover {
  transform: scale(1.06);
  box-shadow: 0 18px 40px -6px rgba(174, 15, 10, 0.7), 0 6px 12px rgba(15,17,21,0.15);
}
.aiw__btn:active { transform: scale(0.96); }
.aiw__btn svg { width: 26px; height: 26px; }

/* Pulse-Ring Animation */
.aiw__btn::before,
.aiw__btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--brand);
  z-index: -1;
  animation: aiw-pulse 2.6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.aiw__btn::after { animation-delay: 1.3s; }
@keyframes aiw-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  80%, 100% { transform: scale(1.7); opacity: 0; }
}
.aiw.is-open .aiw__btn::before,
.aiw.is-open .aiw__btn::after { animation: none; opacity: 0; }

/* Online-Indikator (grün = bereit) / Notify (orange = ungelesen) */
.aiw__dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 12px; height: 12px;
  background: #16a34a;
  border: 2px solid #fff;
  border-radius: 50%;
  z-index: 1;
  transition: background 0.2s;
}
.aiw[data-needs-consent="true"] .aiw__dot {
  background: #f59e0b;
  width: 14px; height: 14px;
  top: 2px; right: 2px;
  animation: aiw-notify 2s ease-in-out infinite;
}
@keyframes aiw-notify {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
.aiw.is-open .aiw__dot { display: none; }

/* Close-Icon (im offenen Zustand) */
.aiw__btn .aiw__open { display: block; }
.aiw__btn .aiw__close { display: none; }
.aiw.is-open .aiw__btn .aiw__open { display: none; }
.aiw.is-open .aiw__btn .aiw__close { display: block; }

/* Tooltip wenn nicht offen */
.aiw__hint {
  position: absolute;
  right: calc(100% + 12px);
  bottom: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.aiw__hint::after {
  content: "";
  position: absolute;
  right: -4px;
  bottom: 14px;
  width: 8px; height: 8px;
  background: var(--ink);
  transform: rotate(45deg);
}
.aiw:not(.is-open):hover .aiw__hint { opacity: 1; transform: translateX(0); }
@media (max-width: 600px) { .aiw__hint { display: none; } }

/* Chat-Panel */
.aiw__panel {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px rgba(15,17,21,0.22), 0 8px 16px rgba(15,17,21,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.85) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}
.aiw.is-open .aiw__panel {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Panel Header */
.aiw__hdr {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.aiw__hdr-ava {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aiw__hdr-ava svg { width: 18px; height: 18px; color: #fff; }
.aiw__hdr-meta { flex: 1; min-width: 0; }
.aiw__hdr-name { font-size: 14px; font-weight: 700; line-height: 1.2; }
.aiw__hdr-status {
  font-size: 11px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.aiw__hdr-status::before {
  content: "";
  width: 7px; height: 7px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.25);
}
.aiw__hdr-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.aiw__hdr-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 0;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t);
}
.aiw__hdr-btn:hover { background: rgba(255,255,255,0.24); }
.aiw__hdr-btn svg { width: 16px; height: 16px; }

/* Cookie-Consent-View innerhalb des Panels */
.aiw__consent {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 22px 20px 20px;
  background: var(--paper-soft);
  overflow-y: auto;
}
.aiw__consent-ico {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 14px;
}
.aiw__consent-ico svg { width: 22px; height: 22px; }
.aiw__consent-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.aiw__consent-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 14px;
}
.aiw__consent-text a { color: var(--brand); text-decoration: underline; }
.aiw__consent-list {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: grid;
  gap: 8px;
}
.aiw__consent-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.45;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.aiw__consent-list svg {
  flex-shrink: 0;
  width: 16px; height: 16px;
  color: var(--brand);
  margin-top: 1px;
}
.aiw__consent-list strong { color: var(--ink); display: block; font-size: 12.5px; margin-bottom: 2px; }
.aiw__consent-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}
.aiw__consent-btn {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t);
}
.aiw__consent-btn:hover { border-color: var(--ink-2); color: var(--ink); }
.aiw__consent-btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px -6px var(--brand);
}
.aiw__consent-btn--primary:hover {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  color: #fff;
}

/* View-Switcher: zeige Chat ODER Consent */
.aiw__view { display: none; flex: 1; flex-direction: column; min-height: 0; }
.aiw__view.is-active { display: flex; }

/* Body */
.aiw__body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: var(--paper-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

/* Message-Bubbles */
.aiw__msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: aiw-msg-in 0.3s ease;
}
@keyframes aiw-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.aiw__msg--bot {
  background: #fff;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.aiw__msg--bot strong { color: var(--ink); }
.aiw__msg--user {
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.aiw__typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}
.aiw__typing span {
  width: 7px; height: 7px;
  background: var(--muted);
  border-radius: 50%;
  animation: aiw-typing 1.2s ease-in-out infinite;
}
.aiw__typing span:nth-child(2) { animation-delay: 0.2s; }
.aiw__typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiw-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* FAQ-Chips */
.aiw__faqs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}
.aiw__faq {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: border-color var(--t), color var(--t), background var(--t);
}
.aiw__faq:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
  background: var(--brand-soft);
}

/* Input-Area */
.aiw__form {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border-top: 1px solid var(--line);
}
.aiw__input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 10px 16px;
  font: inherit;
  font-size: 14px;
  background: var(--paper-soft);
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}
.aiw__input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.aiw__send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t), transform var(--t);
}
.aiw__send:hover { background: var(--brand-deep); }
.aiw__send:active { transform: scale(0.94); }
.aiw__send:disabled { opacity: 0.5; cursor: not-allowed; }
.aiw__send svg { width: 16px; height: 16px; }

/* Disclaimer-Footer */
.aiw__foot {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  padding: 6px 12px 8px;
  background: #fff;
  border-top: 1px solid var(--line-soft);
}
.aiw__foot a { color: var(--muted); text-decoration: underline; }
