/* Tim-Bot Widget – Styling, CI-konform (Orange #E04E20, Anthrazit #252525, Creme #EBEAE6) */

/* CI-Farben global, damit auch Banner und Kontakt-CTA (außerhalb von .timbot)
   echte Farbwerte bekommen – vorher waren diese Variablen nur im .timbot-Scope
   definiert, wodurch das Banner transparent und damit praktisch unsichtbar war. */
:root {
  --tb-orange: #A93612;
  --tb-orange-dark: #A93612;
  --tb-ink: #252525;
  --tb-cream: #EBEAE6;
}

.timbot,
.timbot * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.timbot {
  --tb-orange: #A93612;
  --tb-orange-dark: #A93612;
  --tb-ink: #252525;
  --tb-cream: #EBEAE6;
  --tb-panel-bg: #FFFFFF;
  --tb-radius: 14px;
  font-family: "Raleway", system-ui, -apple-system, "Segoe UI", sans-serif;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9990;
  font-size: 14px;
  line-height: 1.5;
  color: var(--tb-ink);
}

/* ---- Top-Banner (prominenter Einstieg, „ganz oben“) ---- */
.timbot-banner {
  background: linear-gradient(90deg, var(--tb-orange) 0%, var(--tb-orange-dark) 100%);
  color: #fff;
  border-bottom: 3px solid var(--tb-ink);
  box-shadow: 0 4px 18px rgba(37, 37, 37, 0.22);
  position: relative;
  z-index: 40;
  font-size: 14px;
}
.timbot-banner-inner {
  max-width: 1240px;
  margin-inline: auto;
  padding: 13px clamp(20px, 5vw, 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  text-align: left;
}
.timbot-banner-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  background: #fff;
  color: var(--tb-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(37, 37, 37, 0.28);
}
.timbot-banner-avatar svg {
  width: 25px;
  height: 25px;
}
.timbot-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 660px;
  line-height: 1.35;
  flex: 1 1 auto;
  min-width: 0;
}
.timbot-banner-kicker {
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #FFEDE8;
}
.timbot-banner-text strong {
  color: #fff;
  font-weight: 800;
  font-size: 1.1em;
}
.timbot-banner-btn {
  background: var(--tb-ink);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 13px 28px;
  font-weight: 800;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(37, 37, 37, 0.3);
  animation: timbotBannerPulse 2.8s ease-in-out infinite;
}
.timbot-banner-btn:hover {
  background: #000;
  transform: translateY(-1px);
}
@keyframes timbotBannerPulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(37, 37, 37, 0.3); }
  50% { box-shadow: 0 8px 28px rgba(255, 255, 255, 0.55); }
}
@media (max-width: 700px) {
  .timbot-banner-inner {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-block: 11px;
    text-align: center;
  }
  .timbot-banner-avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
  .timbot-banner-avatar svg {
    width: 20px;
    height: 20px;
  }
  .timbot-banner-text {
    align-items: center;
  }
  .timbot-banner-btn {
    width: 100%;
    max-width: 340px;
    padding: 11px 24px;
  }
}

@media (min-width: 701px) and (max-width: 1020px) {
  .timbot-banner-avatar {
    display: none;
  }
  .timbot-banner-inner {
    gap: 12px;
    text-align: left;
  }
  .timbot-banner-text {
    flex: 1 1 280px;
  }
  .timbot-banner-btn {
    padding: 12px 22px;
    font-size: 13.5px;
  }
}

/* ---- Kontakt-CTA im Abschnitt „Projekt besprechen“ ---- */
.timbot-cta {
  margin-top: clamp(34px, 5vw, 54px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  flex-wrap: wrap;
  background: var(--tb-ink);
  color: var(--tb-cream);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 26px 30px;
  box-shadow: 0 16px 40px rgba(37, 37, 37, 0.28);
}
.timbot-cta-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 640px;
}
.timbot-cta-kicker {
  font-family: "Poppins", system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #FFD4C8;
}
.timbot-cta-text strong {
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
}
.timbot-cta-text p {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.82);
}
.timbot-cta-btn {
  background: var(--tb-orange);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 14px 30px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.15s ease;
}
.timbot-cta-btn:hover {
  background: var(--tb-orange-dark);
  transform: translateY(-1px);
}
@media (max-width: 600px) {
  .timbot-cta {
    flex-direction: column;
    align-items: stretch;
    padding: 22px 20px;
  }
  .timbot-cta-btn {
    width: 100%;
  }
}

/* ---- FAB ---- */
.timbot-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--tb-orange-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 37, 37, 0.28);
  transition: transform 0.15s ease, background 0.15s ease;
}
.timbot-fab {
  border: 0;
  padding: 0;
}
.timbot-fab:hover {
  background: var(--tb-orange-dark);
  transform: scale(1.06);
}
.timbot-fab-active {
  transform: rotate(12deg);
}
.timbot-fab svg {
  width: 26px;
  height: 26px;
}

/* ---- Panel ---- */
.timbot-panel {
  position: fixed;
  right: 20px;
  bottom: 76px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: min(560px, calc(100dvh - 100px));
  background: var(--tb-panel-bg);
  border-radius: var(--tb-radius);
  box-shadow: 0 16px 48px rgba(37, 37, 37, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.timbot-panel[hidden] {
  display: none;
}

/* ---- Kopf ---- */
.timbot-head {
  background: var(--tb-ink);
  color: var(--tb-cream);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.timbot-head-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background: var(--tb-orange-dark);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.timbot-head-text {
  flex: 1;
  min-width: 0;
}
.timbot-head-name {
  font-weight: 700;
  color: #fff;
}
.timbot-head-sub {
  font-size: 11px;
  opacity: 0.75;
}
.timbot-close {
  background: none;
  border: 0;
  color: var(--tb-cream);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.timbot-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ---- Nachrichten ---- */
.timbot-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--tb-cream);
}
.timbot-msg {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 13.5px;
}
.timbot-msg-bot {
  background: #fff;
  border: 1px solid #ddd8cc;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.timbot-msg-user {
  background: var(--tb-orange);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.timbot-msg-hint {
  font-size: 12px;
  opacity: 0.8;
  background: none;
  border: 1px dashed #c9c2b0;
  border-radius: 8px;
}
.timbot-msg-hint a {
  color: var(--tb-orange-dark);
  text-decoration: underline;
}
.timbot-typing {
  color: #8a8578;
  font-style: italic;
}
.timbot-typing::after {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--tb-orange);
  animation: timbotBlink 1s infinite;
}
@keyframes timbotBlink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

/* ---- Badges ---- */
.timbot-badge {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  margin-top: 2px;
}
.timbot-badge-a {
  background: #e2f0e0;
  color: #2e6b2e;
  border: 1px solid #bcdcb8;
}
.timbot-badge-b {
  background: #fdf3dc;
  color: #8a6d1a;
  border: 1px solid #ecd9a0;
}
.timbot-badge-c {
  background: #f5e3e1;
  color: #8f3a2e;
  border: 1px solid #e5bcb4;
}

/* ---- Kontaktübergabe nach guter Passung ---- */
.timbot-contact {
  align-self: stretch;
  background: #fff;
  border: 1px solid #ddd8cc;
  border-left: 3px solid var(--tb-orange);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
}
.timbot-contact strong {
  display: block;
  font-size: 14px;
}
.timbot-contact p {
  margin-top: 3px;
  color: #5f5a50;
  font-size: 12px;
}
.timbot-contact-label {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #7a746a;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.timbot-contact-name,
.timbot-contact-email,
.timbot-contact-phone {
  display: block;
  width: 100%;
  margin-top: 3px;
  border: 1px solid #cfc8b6;
  border-radius: 7px;
  padding: 8px 9px;
  font: inherit;
  font-size: 12.5px;
  color: var(--tb-ink);
  background: var(--tb-cream);
}
.timbot-contact-name:focus,
.timbot-contact-email:focus,
.timbot-contact-phone:focus {
  outline: 2px solid var(--tb-orange);
  outline-offset: 0;
  background: #fff;
}
.timbot-contact-send {
  display: block;
  width: 100%;
  margin-top: 11px;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--tb-orange-dark);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.timbot-contact-send:hover:not(:disabled) { background: var(--tb-orange-dark); }
.timbot-contact-send:disabled { opacity: .5; cursor: not-allowed; }

/* Hinweis in der Eingabezeile, wenn der Chat mit der Einordnung endet */
.timbot-wait {
  width: 100%;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #6d675c;
}
.timbot-contact small {
  display: block;
  margin-top: 8px;
  color: #777166;
  font-size: 10.5px;
  line-height: 1.35;
}
.timbot-contact small a { color: var(--tb-orange-dark); }
.timbot-contact-consent {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 9px;
  color: #5f5a50;
  font-size: 11px;
  line-height: 1.35;
  cursor: pointer;
}
.timbot-contact-consent input { margin-top: 2px; accent-color: var(--tb-orange); }
@media (max-width: 600px) {
  .timbot-contact-send { font-size: 13.5px; }
}

/* ---- CAPTCHA-Feld ---- */
.timbot-captcha {
  background: var(--tb-cream);
  border-top: 1px solid #ddd8cc;
  padding: 10px 14px;
}
.timbot-captcha[hidden] {
  display: none;
}
.timbot-captcha-inner {
  display: flex;
  justify-content: center;
}

/* ---- Eingabe ---- */
.timbot-foot {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid #eee;
}
.timbot-input {
  flex: 1;
  border: 1px solid #cfc8b6;
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  font-size: 13.5px;
  resize: none;
  min-height: 38px;
  max-height: 140px;
  background: var(--tb-cream);
  color: var(--tb-ink);
}
.timbot-input:focus {
  outline: 2px solid var(--tb-orange);
  outline-offset: 1px;
  background: #fff;
}
.timbot-send {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 0;
  border-radius: 10px;
  background: var(--tb-orange-dark);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.timbot-send:hover:not(:disabled) {
  background: var(--tb-orange-dark);
}
.timbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Abschluss nach Kontaktübergabe ---- */
.timbot-done {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
  color: #4a463f;
  line-height: 1.4;
}
.timbot-done strong {
  color: var(--tb-orange-dark);
  font-size: 13px;
}
.timbot-done a {
  color: var(--tb-orange-dark);
  font-weight: 600;
}

/* ---- Fehler ---- */
.timbot-error {
  background: #f5e3e1;
  color: #8f3a2e;
  border-top: 1px solid #e5bcb4;
  padding: 8px 14px;
  font-size: 12.5px;
}
.timbot-error[hidden] {
  display: none;
}

/* ---- Mobil ---- */
@media (max-width: 600px) {
  .timbot {
    right: 10px;
    bottom: 10px;
  }
  .timbot-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    top: 10px;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
  }
  .timbot-fab {
    width: 52px;
    height: 52px;
  }
}

/* ---- Barrierefreiheit: Fokus sichtbar ---- */
.timbot :focus-visible {
  outline: 2px solid var(--tb-orange);
  outline-offset: 2px;
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  .timbot-fab {
    transition: none;
  }
  .timbot-typing::after {
    animation: none;
  }
  .timbot-banner-btn {
    animation: none;
    transition: none;
  }
}
