/* Live-Chat für your-presence.de
   Nimmt die Farbwelt der Seite auf: tiefes Schwarzgrün als Träger,
   warmes Papierweiß als Fläche. Ein einziger Akzent, sonst nichts. */

.ypchat {
  --yp-ink:     #11110f;
  --yp-ink-2:   #1d1d1a;
  --yp-paper:   #f7f5f0;
  --yp-line:    rgba(247, 245, 240, .14);
  --yp-muted:   rgba(247, 245, 240, .55);
  --yp-accent:  #c9a227;   /* Messing – Statuspunkt und Hinweise */
  --yp-error:   #e08a7a;
  --yp-radius:  16px;

  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9000;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
}

.ypchat *,
.ypchat *::before,
.ypchat *::after { box-sizing: border-box; }

.ypchat__sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.ypchat :focus-visible {
  outline: 2px solid var(--yp-accent);
  outline-offset: 2px;
}

/* ---------- Auslöser ---------- */
.ypchat__launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-left: auto;
  padding: .8rem 1.4rem;
  font: inherit;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--yp-paper);
  background: var(--yp-ink);
  border: 1px solid var(--yp-line);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(17, 17, 15, .28);
  transition: transform .18s ease, box-shadow .18s ease;
}

.ypchat__launcher:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(17, 17, 15, .34);
}

.ypchat__badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--yp-ink);
  background: var(--yp-accent);
  border-radius: 999px;
}

.ypchat[data-state="open"] .ypchat__launcher { display: none; }

/* ---------- Fenster ---------- */
.ypchat__panel {
  width: min(370px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--yp-paper);
  background: var(--yp-ink);
  border: 1px solid var(--yp-line);
  border-radius: var(--yp-radius);
  box-shadow: 0 24px 60px rgba(17, 17, 15, .4);
  animation: ypchat-in .22s ease-out;
}

@keyframes ypchat-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.ypchat__head {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--yp-line);
}

.ypchat__title { font-weight: 600; letter-spacing: -.01em; }

.ypchat__status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-left: auto;
  font-size: 12px;
  color: var(--yp-muted);
}

.ypchat__status i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--yp-muted);
}

.ypchat__status[data-online="true"] i { background: var(--yp-accent); }

.ypchat__close {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  padding: 0;
  color: var(--yp-paper);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  opacity: .7;
}
.ypchat__close:hover { opacity: 1; background: rgba(247, 245, 240, .08); }

/* ---------- Verlauf ---------- */
.ypchat__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow: hidden;
}

.ypchat__greeting {
  margin: 0 0 .8rem;
  font-size: 14px;
  color: var(--yp-muted);
}

.ypchat__log {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0 2px 0 0;
  list-style: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(247, 245, 240, .2) transparent;
}

.ypchat__log::-webkit-scrollbar { width: 6px; }
.ypchat__log::-webkit-scrollbar-thumb {
  background: rgba(247, 245, 240, .18);
  border-radius: 3px;
}

.ypchat__msg {
  max-width: 85%;
  margin-bottom: .6rem;
  padding: .55rem .8rem;
  border-radius: 14px;
  animation: ypchat-msg .2s ease-out;
}

@keyframes ypchat-msg {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.ypchat__msg p { margin: 0; overflow-wrap: anywhere; }

.ypchat__msg--visitor {
  margin-left: auto;
  color: var(--yp-ink);
  background: var(--yp-paper);
  border-bottom-right-radius: 4px;
}

.ypchat__msg--agent {
  background: var(--yp-ink-2);
  border: 1px solid var(--yp-line);
  border-bottom-left-radius: 4px;
}

.ypchat__time {
  display: block;
  margin-top: .2rem;
  font-size: 11px;
  opacity: .5;
}

.ypchat__msg--visitor .ypchat__time { text-align: right; }

.ypchat__typing { margin: 0; font-size: 12px; color: var(--yp-muted); }

/* ---------- Eingabe ---------- */
.ypchat__form {
  padding: .8rem 1rem 1rem;
  border-top: 1px solid var(--yp-line);
}

.ypchat__intro {
  display: grid;
  gap: .5rem;
  margin-bottom: .7rem;
}

.ypchat__field label {
  display: block;
  margin-bottom: .2rem;
  font-size: 12px;
  color: var(--yp-muted);
}

.ypchat__intro input,
.ypchat__compose textarea {
  width: 100%;
  padding: .5rem .7rem;
  font: inherit;
  color: var(--yp-paper);
  background: var(--yp-ink-2);
  border: 1px solid var(--yp-line);
  border-radius: 10px;
}

.ypchat__intro input::placeholder,
.ypchat__compose textarea::placeholder { color: rgba(247, 245, 240, .38); }

.ypchat__compose {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
}

.ypchat__compose textarea {
  resize: none;
  max-height: 120px;
  overflow-y: auto;
}

.ypchat__send {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  padding: 0;
  color: var(--yp-ink);
  background: var(--yp-paper);
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.ypchat__send:hover { background: #fff; }
.ypchat__send:disabled { opacity: .5; cursor: default; }

/* Honigtopf: für Menschen unsichtbar, für Skripte sichtbar */
.ypchat__hp {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

.ypchat__note {
  margin: .5rem 0 0;
  font-size: 12px;
  color: var(--yp-muted);
  min-height: 1.2em;
}
.ypchat__note.is-error { color: var(--yp-error); }

.ypchat__foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .55rem 1rem;
  font-size: 11px;
  color: var(--yp-muted);
  border-top: 1px solid var(--yp-line);
}
.ypchat__foot a { color: inherit; }

/* ---------- Klein ---------- */
@media (max-width: 480px) {
  .ypchat { right: 12px; bottom: 12px; left: 12px; }
  .ypchat__launcher { float: right; }
  .ypchat__panel {
    width: 100%;
    height: min(78vh, calc(100vh - 90px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ypchat__panel,
  .ypchat__msg { animation: none; }
  .ypchat__launcher { transition: none; }
  .ypchat__launcher:hover { transform: none; }
}
