/* ============================================================================
   chat.css — Verkaufs-Chat „Ira" für withira.com
   Hell/premium, konsistent mit den CSS-Tokens aus theme-bright.css / styles.css.
   Selbst-enthalten, keine externen CDNs.
   ============================================================================ */

/* Lokale Fallbacks, falls chat.css ohne theme-bright.css geladen wird. */
.wic-root {
  --wic-bg: var(--wi-bg-2, #ffffff);
  --wic-text: var(--wi-text, #142133);
  --wic-dim: var(--wi-text-dim, #5a6878);
  --wic-line: var(--wi-line, rgba(22, 46, 86, 0.13));
  --wic-cyan: var(--wi-ai-cyan, #1487c4);
  --wic-cyan-soft: var(--wi-ai-cyan-soft, rgba(36, 150, 210, 0.16));
  --wic-gold: var(--wi-gold, #bd8e3f);
  --wic-gold-hi: var(--wi-gold-hi, #9c7430);
  --wic-serif: var(--serif, Georgia, "Times New Roman", serif);
  --wic-sans: var(--sans, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);

  font-family: var(--wic-sans);
  color: var(--wic-text);
}

/* ---------- Launcher (unten rechts) ---------- */
.wic-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px 11px 14px;
  border: 1px solid color-mix(in srgb, var(--wic-cyan) 35%, var(--wic-line));
  border-radius: 999px;
  background: var(--wic-bg);
  color: var(--wic-text);
  font: 600 14px/1 var(--wic-sans);
  cursor: pointer;
  box-shadow: 0 12px 30px -12px rgba(28, 60, 110, 0.4);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.wic-launcher:hover {
  transform: translateY(-2px);
  border-color: var(--wic-cyan);
  box-shadow: 0 18px 38px -14px rgba(36, 150, 210, 0.5);
}
.wic-launcher:focus-visible {
  outline: 2px solid var(--wic-cyan);
  outline-offset: 2px;
}
.wic-launcher.is-hidden {
  display: none;
}
.wic-launcher__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--wic-cyan);
  box-shadow: 0 0 0 0 var(--wic-cyan-soft);
  animation: wic-pulse 2s infinite;
  flex: none;
}
@keyframes wic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(36, 150, 210, 0.45); }
  70% { box-shadow: 0 0 0 9px rgba(36, 150, 210, 0); }
  100% { box-shadow: 0 0 0 0 rgba(36, 150, 210, 0); }
}

/* ---------- Panel ---------- */
.wic-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483001;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--wic-bg);
  border: 1px solid var(--wic-line);
  border-radius: 20px;
  box-shadow: 0 28px 70px -28px rgba(28, 60, 110, 0.55);
  animation: wic-rise 0.18s ease both;
}
.wic-panel.is-open {
  display: flex;
}
@keyframes wic-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Kopf ---------- */
.wic-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 14px 13px;
  border-bottom: 1px solid var(--wic-line);
  background: linear-gradient(135deg, #eef6ff, #f7fbff);
}
.wic-head__avatar {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex: none;
  background: var(--wic-grad-gold, linear-gradient(135deg, #d9b977, #bd8e3f 50%, #9c7430));
  display: grid;
  place-items: center;
  color: #fff;
  font: 700 16px/1 var(--wic-serif);
}
.wic-head__avatar::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #2bbf6a;
  border: 2px solid #fff;
}
.wic-head__meta {
  flex: 1;
  min-width: 0;
}
.wic-head__name {
  font: 700 14px/1.2 var(--wic-sans);
  color: var(--wic-text);
}
.wic-head__role {
  font-size: 11.5px;
  color: var(--wic-dim);
  margin-top: 2px;
}
.wic-head__close {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--wic-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--wic-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.wic-head__close:hover {
  color: var(--wic-text);
  border-color: var(--wic-cyan);
}

/* ---------- Nachrichtenbereich ---------- */
.wic-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: var(--wi-bg-1, #f4f9ff);
}
.wic-msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.wic-msg a {
  color: var(--wic-cyan);
  text-decoration: underline;
}
.wic-msg--ira {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--wic-line);
  color: var(--wic-text);
  border-bottom-left-radius: 5px;
}
.wic-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--wic-cyan-soft), color-mix(in srgb, var(--wic-gold) 12%, var(--wic-cyan-soft)));
  border: 1px solid color-mix(in srgb, var(--wic-cyan) 28%, var(--wic-line));
  color: var(--wic-text);
  border-bottom-right-radius: 5px;
}

/* Tipp-Indikator */
.wic-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--wic-line);
  border-radius: 15px;
  border-bottom-left-radius: 5px;
}
.wic-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wic-dim);
  opacity: 0.5;
  animation: wic-blink 1.3s infinite both;
}
.wic-typing span:nth-child(2) { animation-delay: 0.2s; }
.wic-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes wic-blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 0.9; transform: translateY(-3px); }
}

/* ---------- Produkt- & Link-Karten ---------- */
.wic-cards {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.wic-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 11px 12px;
  background: #fff;
  border: 1px solid var(--wic-line);
  border-radius: 14px;
  box-shadow: 0 10px 26px -20px rgba(28, 60, 110, 0.4);
}
.wic-card__icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 19px;
  background: var(--wi-bg-1, #f4f9ff);
}
.wic-card__body {
  flex: 1;
  min-width: 0;
}
.wic-card__title {
  font: 700 13.5px/1.25 var(--wic-sans);
  color: var(--wic-text);
}
.wic-card__price {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--wic-gold-hi);
  margin-left: 6px;
}
.wic-card__desc {
  font-size: 12px;
  line-height: 1.4;
  color: var(--wic-dim);
  margin-top: 3px;
}
.wic-card__btn {
  flex: none;
  align-self: center;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--wic-cyan) 40%, var(--wic-line));
  background: var(--wic-cyan-soft);
  color: var(--wic-cyan);
  font: 600 12.5px/1 var(--wic-sans);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.wic-card__btn:hover {
  background: color-mix(in srgb, var(--wic-cyan) 22%, #fff);
  border-color: var(--wic-cyan);
}
.wic-card--link .wic-card__icon {
  font-size: 16px;
  color: var(--wic-cyan);
}

/* ---------- Eingabe ---------- */
.wic-foot {
  border-top: 1px solid var(--wic-line);
  background: var(--wic-bg);
  padding: 10px 12px 6px;
}
.wic-inputrow {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.wic-input {
  flex: 1;
  resize: none;
  max-height: 110px;
  min-height: 22px;
  padding: 9px 11px;
  border: 1px solid var(--wic-line);
  border-radius: 12px;
  background: var(--wi-bg-1, #f4f9ff);
  color: var(--wic-text);
  font: 400 14px/1.4 var(--wic-sans);
  outline: none;
}
.wic-input:focus {
  border-color: var(--wic-cyan);
  background: #fff;
}
.wic-input::placeholder { color: var(--wic-dim); }

.wic-mic,
.wic-send {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  border: 1px solid var(--wic-line);
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--wic-dim);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.wic-mic:hover,
.wic-send:hover {
  border-color: var(--wic-cyan);
  color: var(--wic-cyan);
}
.wic-mic svg,
.wic-send svg { width: 19px; height: 19px; display: block; }

.wic-send {
  background: var(--wic-cyan);
  color: #fff;
  border-color: var(--wic-cyan);
}
.wic-send:hover {
  background: color-mix(in srgb, var(--wic-cyan) 85%, #000);
  color: #fff;
}
.wic-send[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mikrofon-Zustand: hört zu */
.wic-mic.is-listening {
  color: #fff;
  background: #e0413f;
  border-color: #e0413f;
  animation: wic-mic-pulse 1.4s infinite;
}
@keyframes wic-mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(224, 65, 63, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(224, 65, 63, 0); }
  100% { box-shadow: 0 0 0 0 rgba(224, 65, 63, 0); }
}
.wic-mic.is-hidden { display: none; }

.wic-note {
  margin: 7px 2px 2px;
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--wic-dim);
  text-align: center;
}

/* ---------- Mobil: Vollbild-Sheet ---------- */
@media (max-width: 560px) {
  .wic-panel {
    right: 0;
    left: 0;
    bottom: 0;
    top: 0;
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  .wic-launcher {
    right: 14px;
    bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wic-launcher__dot,
  .wic-mic.is-listening,
  .wic-typing span,
  .wic-panel { animation: none; }
}
