/* ============================================================
   Rosemarie / Rosi 6 – Chat-Widget (Jean&Len)  ·  Stand 2026-10-06
   Eigenständiges Widget, kein @n8n/chat mehr. Alles unter .rosi
   ============================================================ */
.rosi, .rosi * { box-sizing: border-box; }
.rosi {
  --rosi-mokka: #967E66;
  --rosi-mokka-dk: #7b6a5a;
  --rosi-mokka-lt: #b39f88;
  --rosi-sand: #E6DCCE;
  --rosi-sand-lt: #f3ede4;
  --rosi-offwhite: #F0F0EE;
  --rosi-ink: #2a2117;
  --rosi-muted: #8a7a6a;
  --rosi-rose: #CD9B9D;
  --rosi-rose-lt: #f7e1df;
  --rosi-salbei: #B3C1B3;
  --rosi-honig: #EEB13A;
  --rosi-safran: #D76C1A;
  --rosi-danger: #C0392B;
  --rosi-white: #ffffff;
  --rosi-radius: 20px;
  --rosi-radius-sm: 14px;
  --rosi-shadow: 0 18px 50px rgba(42, 33, 23, .22), 0 2px 8px rgba(42, 33, 23, .08);
  --rosi-font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --rosi-z: 2147483001;
  --rosi-left: 20px;
  --rosi-bottom: 20px;
  font-family: var(--rosi-font);
  color: var(--rosi-ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.rosi button { font-family: inherit; }
.rosi [hidden] { display: none !important; }

/* ---------- Launcher ---------- */
.rosi-launcher {
  position: fixed; left: var(--rosi-left); bottom: var(--rosi-bottom); z-index: var(--rosi-z);
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--rosi-white);
  box-shadow: 0 6px 20px rgba(42,33,23,.18), 0 0 0 1px rgba(150,126,102,.12);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.rosi-launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(42,33,23,.22), 0 0 0 1px rgba(150,126,102,.18); }
.rosi-launcher:focus-visible { outline: 3px solid rgba(150,126,102,.45); outline-offset: 2px; }
.rosi-launcher__icon {
  width: 30px; height: 30px; background: var(--rosi-mokka);
  -webkit-mask: var(--rosi-icon) center / contain no-repeat; mask: var(--rosi-icon) center / contain no-repeat;
  transition: transform .25s ease, opacity .2s ease;
}
.rosi-launcher__close { position: absolute; width: 22px; height: 22px; opacity: 0; transform: scale(.6); transition: transform .25s ease, opacity .2s ease; }
.rosi-launcher__close svg { width: 22px; height: 22px; stroke: var(--rosi-mokka); }
.rosi.is-open .rosi-launcher__icon { opacity: 0; transform: scale(.5) rotate(20deg); }
.rosi.is-open .rosi-launcher__close { opacity: 1; transform: scale(1); }
.rosi-launcher__badge {
  position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--rosi-safran); color: #fff; font: 600 11px/20px var(--rosi-font);
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.rosi-launcher.has-pulse::before {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid rgba(150,126,102,.45); animation: rosi-pulse 1.8s ease-out 2;
}
@keyframes rosi-pulse { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }

/* ---------- Teaser ---------- */
.rosi-teaser {
  position: fixed; left: calc(var(--rosi-left) + 70px); bottom: calc(var(--rosi-bottom) + 6px); z-index: var(--rosi-z);
  max-width: 260px; background: var(--rosi-white); border-radius: 16px 16px 16px 6px;
  box-shadow: var(--rosi-shadow); padding: 12px 36px 12px 14px; cursor: pointer;
  animation: rosi-rise .35s ease; font-size: 13.5px;
}
.rosi-teaser b { color: var(--rosi-mokka-dk); font-weight: 600; }
.rosi-teaser__close {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: transparent; color: var(--rosi-muted); cursor: pointer; font-size: 16px; line-height: 24px;
}
.rosi-teaser__close:hover { background: var(--rosi-sand-lt); }
@keyframes rosi-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Panel ---------- */
.rosi-panel {
  margin: 0; padding: 0; top: auto; right: auto;
  position: fixed; left: var(--rosi-left); bottom: calc(var(--rosi-bottom) + 72px); z-index: var(--rosi-z);
  width: 400px; height: min(690px, calc(100vh - 120px)); max-height: calc(100vh - 110px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--rosi-offwhite); border-radius: var(--rosi-radius);
  box-shadow: var(--rosi-shadow);
  transform-origin: bottom left; opacity: 0; transform: translateY(14px) scale(.97); pointer-events: none;
  visibility: hidden; -webkit-tap-highlight-color: transparent;
  transition: opacity .22s ease, transform .26s cubic-bezier(.2,.8,.2,1), visibility 0s linear .26s;
}
.rosi.is-open .rosi-panel { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity .22s ease, transform .26s cubic-bezier(.2,.8,.2,1), visibility 0s linear 0s; }
/* Bedienelemente nicht markierbar (verhindert Text-Markierung bei langem Tippen auf iOS) */
.rosi-launcher, .rosi-teaser, .rosi-header, .rosi-chip, .rosi-buy, .rosi-hbtn, .rosi-ibtn, .rosi-send, .rosi-fb button, .rosi-typing { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

/* Header */
.rosi-header {
  /* Härtung: das Shop-Theme setzt auf header-Tags position:fixed/width:100vw – hier neutralisiert */
  position: relative; top: auto; left: auto; right: auto; bottom: auto; width: auto; max-width: none; height: auto; z-index: auto; transition: none; margin: 0;
  display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px 16px;
  background: linear-gradient(135deg, var(--rosi-mokka) 0%, var(--rosi-mokka-dk) 100%); color: #fff;
  flex: 0 0 auto;
}
.rosi-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.18); position: relative; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.rosi-avatar__icon { width: 24px; height: 24px; background: #fff; -webkit-mask: var(--rosi-icon) center / contain no-repeat; mask: var(--rosi-icon) center / contain no-repeat; }
.rosi-avatar__dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #7FB77E; border: 2px solid var(--rosi-mokka); }
.rosi-header__text { flex: 1 1 auto; min-width: 0; }
.rosi-header__name { font-weight: 600; font-size: 15px; line-height: 1.2; display: flex; align-items: center; gap: 8px; }
.rosi-badge { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; background: rgba(255,255,255,.18); padding: 2px 7px; border-radius: 999px; font-weight: 600; }
.rosi-header__status { font-size: 12px; opacity: .85; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rosi-header__status a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.rosi-header__actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.rosi-hbtn {
  border: 1px solid rgba(255,255,255,.55); background: transparent; color: #fff; border-radius: 999px;
  padding: 6px 11px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s ease;
}
.rosi-hbtn:hover { background: rgba(255,255,255,.14); }
.rosi-ibtn {
  width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .15s ease;
}
.rosi-ibtn:hover { background: rgba(255,255,255,.14); }
.rosi-ibtn svg { width: 18px; height: 18px; stroke: currentColor; }

/* Messages */
.rosi-messages {
  flex: 1 1 auto; overflow-y: auto; padding: 18px 14px 10px; scroll-behavior: smooth;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
@media (prefers-reduced-motion: reduce) { .rosi-messages { scroll-behavior: auto; } }
.rosi-day { text-align: center; font-size: 11px; color: var(--rosi-muted); margin: 4px 0 14px; }
.rosi-msg { display: flex; gap: 8px; margin: 0 0 12px; animation: rosi-rise .22s ease; }
.rosi-msg--user { justify-content: flex-end; }
.rosi-msg__avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--rosi-mokka); flex: 0 0 auto; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.rosi-msg__avatar i { display: block; width: 16px; height: 16px; background: #fff; -webkit-mask: var(--rosi-icon) center / contain no-repeat; mask: var(--rosi-icon) center / contain no-repeat; }
.rosi-msg__body { max-width: calc(100% - 36px); min-width: 0; }
.rosi-msg--user .rosi-msg__body { max-width: 86%; }
.rosi-bubble {
  background: var(--rosi-white); border-radius: 4px var(--rosi-radius-sm) var(--rosi-radius-sm) var(--rosi-radius-sm);
  padding: 10px 14px; box-shadow: 0 1px 2px rgba(42,33,23,.06); font-size: 14px; word-wrap: break-word; overflow-wrap: anywhere;
}
.rosi-msg--user .rosi-bubble { background: var(--rosi-sand); border-radius: var(--rosi-radius-sm) 4px var(--rosi-radius-sm) var(--rosi-radius-sm); }
.rosi-bubble p { margin: 0 0 8px; }
.rosi-bubble p:last-child { margin-bottom: 0; }
.rosi-bubble ul, .rosi-bubble ol { margin: 4px 0 8px; padding-left: 18px; }
.rosi-bubble li { margin: 2px 0; }
.rosi-bubble a { color: var(--rosi-mokka-dk); text-decoration: underline; text-underline-offset: 2px; }
.rosi-bubble.is-typing .rosi-caret::after { content: "▍"; color: var(--rosi-mokka); animation: rosi-blink 1s steps(2) infinite; margin-left: 1px; }
@keyframes rosi-blink { to { opacity: 0; } }
.rosi-meta { font-size: 11px; color: var(--rosi-muted); margin: 4px 0 0 4px; display: flex; gap: 8px; align-items: center; }
.rosi-msg--user .rosi-meta { justify-content: flex-end; margin-right: 4px; }

/* Typing indicator */
.rosi-typing { display: inline-flex; align-items: center; gap: 10px; }
.rosi-typing__dots { display: inline-flex; gap: 4px; }
.rosi-typing__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--rosi-mokka-lt); animation: rosi-bounce 1.2s infinite ease-in-out; }
.rosi-typing__dots i:nth-child(2) { animation-delay: .15s; }
.rosi-typing__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes rosi-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }
.rosi-typing__text { color: var(--rosi-muted); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .rosi-typing__dots i, .rosi-msg, .rosi-teaser, .rosi-launcher.has-pulse::before { animation: none; } }

/* Chips */
.rosi-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 2px; }
.rosi-chip {
  border: 1px solid rgba(150,126,102,.45); background: var(--rosi-white); color: var(--rosi-mokka-dk);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 500; cursor: pointer; line-height: 1.2;
  transition: background .15s ease, color .15s ease, transform .06s ease; text-align: left;
}
.rosi-chip:hover { background: var(--rosi-mokka); color: #fff; border-color: var(--rosi-mokka); }
.rosi-chip:active { transform: translateY(1px); }
.rosi-chip--ghost { border-style: dashed; background: transparent; }
.rosi-chips.is-done .rosi-chip { opacity: .45; pointer-events: none; }
.rosi-chip--tile { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 14px; font-weight: 600; background: var(--rosi-white); }
.rosi-chip--tile span.em { font-size: 16px; }
.rosi-chips--tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Product cards */
.rosi-products { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px 2px 8px; margin: 2px -2px 0; scrollbar-width: thin; }
.rosi-products::-webkit-scrollbar { height: 6px; }
.rosi-products::-webkit-scrollbar-thumb { background: rgba(150,126,102,.35); border-radius: 999px; }
.rosi-card {
  position: relative; margin: 0; width: auto;
  flex: 0 0 196px; scroll-snap-align: start; background: var(--rosi-white); border: 1px solid #ece7e1; border-radius: 16px;
  overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 6px 18px rgba(42,33,23,.06);
}
.rosi-products.is-single .rosi-card { flex-basis: 100%; }
.rosi-card__media { position: relative; height: 150px; background: #fafaf8; display: flex; align-items: center; justify-content: center; }
.rosi-card__media img { max-width: 86%; max-height: 86%; width: auto; height: auto; object-fit: contain; margin: 0; }
.rosi-card__media a { display: block; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.rosi-tag { position: absolute; left: 8px; top: 8px; font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 3px 7px; border-radius: 999px; }
.rosi-tag--sale { background: var(--rosi-rose-lt); color: #8d4b4e; }
.rosi-tag--out { background: #f1efec; color: var(--rosi-muted); }
.rosi-card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; }
.rosi-card__title { font-weight: 600; font-size: 13.5px; line-height: 1.3; color: var(--rosi-ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-decoration: none; }
.rosi-card__desc { font-size: 12px; color: var(--rosi-muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rosi-card__row { margin-top: auto; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding-top: 4px; min-width: 0; }
.rosi-products.is-single .rosi-card__row { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.rosi-products.is-single .rosi-buy { width: auto; }
.rosi-price { font-weight: 700; font-size: 14px; line-height: 1.2; white-space: nowrap; min-width: 0; }
.rosi-price s { font-weight: 400; color: var(--rosi-muted); font-size: 12px; margin-right: 5px; }
.rosi-buy {
  border: 0; border-radius: 999px; background: var(--rosi-mokka); color: #fff; padding: 8px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s ease, transform .06s ease; white-space: nowrap;
  /* Härtung gegen Theme-Regeln auf button: Breite, Schrift, Abstände explizit */
  width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; margin: 0; line-height: 1.2; text-transform: none; letter-spacing: normal; font-family: var(--rosi-font); box-shadow: none;
}
.rosi-buy span { overflow: hidden; text-overflow: ellipsis; }
.rosi-buy:hover { background: var(--rosi-mokka-dk); }
.rosi-buy:active { transform: translateY(1px); }
.rosi-buy.is-done { background: #6f9a6f; }
.rosi-buy svg { width: 14px; height: 14px; stroke: currentColor; }
.rosi-card__link { font-size: 12px; color: var(--rosi-mokka-dk); text-decoration: underline; text-underline-offset: 2px; }
.rosi-card__done { font-size: 12px; font-weight: 600; color: #4a7d4a; padding-top: 6px; }

/* Order lookup form */
.rosi-form { background: var(--rosi-white); border: 1px solid #ece7e1; border-radius: 16px; padding: 12px; margin-top: 8px; display: grid; gap: 8px; }
.rosi-form__title { font-weight: 600; font-size: 13px; }
.rosi-form label { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--rosi-muted); display: block; margin-bottom: 3px; }
.rosi-form input { width: 100%; border: 1px solid #ddd3c8; border-radius: 10px; padding: 9px 11px; font: 14px var(--rosi-font); color: var(--rosi-ink); background: #fff; }
.rosi-form input:focus { outline: none; border-color: var(--rosi-mokka); box-shadow: 0 0 0 3px rgba(150,126,102,.15); }
.rosi-form__err { font-size: 12px; color: var(--rosi-danger); min-height: 0; }
.rosi-form .rosi-buy { padding: 9px 14px; }
.rosi-form.is-done { opacity: .6; pointer-events: none; }

/* Feedback */
.rosi-fb { display: flex; align-items: center; gap: 6px; margin: 6px 0 0 2px; font-size: 12px; color: var(--rosi-muted); }
.rosi-fb button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid transparent; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--rosi-muted); transition: all .15s ease; }
.rosi-fb button:hover { background: var(--rosi-white); border-color: #e3dbd1; color: var(--rosi-mokka-dk); }
.rosi-fb button.is-on { background: var(--rosi-mokka); color: #fff; border-color: var(--rosi-mokka); }
.rosi-fb svg { width: 15px; height: 15px; stroke: currentColor; fill: none; }
.rosi-fb__comment { display: flex; gap: 6px; margin-top: 6px; width: 100%; }
.rosi-fb__comment input { flex: 1 1 auto; border: 1px solid #ddd3c8; border-radius: 999px; padding: 7px 12px; font: 13px var(--rosi-font); }
.rosi-fb__comment button.rosi-chip { padding: 6px 11px; }
.rosi-chip, .rosi-hbtn { width: auto; min-width: 0; margin: 0; text-transform: none; letter-spacing: normal; font-family: var(--rosi-font); box-shadow: none; }
.rosi-handoff { margin: 8px 0 0; }

/* Composer */
.rosi-composer { flex: 0 0 auto; background: var(--rosi-white); border-top: 1px solid #e9e2d9; padding: 10px 12px 8px; }
.rosi-composer__row { display: flex; align-items: flex-end; gap: 8px; }
.rosi-input {
  flex: 1 1 auto; resize: none; border: 1px solid #ddd3c8; border-radius: 18px; padding: 10px 14px; max-height: 120px; min-height: 42px;
  font: 14px/1.4 var(--rosi-font); color: var(--rosi-ink); background: var(--rosi-offwhite); outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.rosi-input:focus { border-color: var(--rosi-mokka); box-shadow: 0 0 0 3px rgba(150,126,102,.15); background: #fff; }
.rosi-send {
  width: 42px; height: 42px; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--rosi-mokka); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .15s ease, transform .06s ease;
}
.rosi-send:hover { background: var(--rosi-mokka-dk); }
.rosi-send:disabled { background: #cfc4b6; cursor: default; }
.rosi-send svg { width: 18px; height: 18px; fill: currentColor; }
.rosi-composer__hint { font-size: 11px; color: var(--rosi-muted); text-align: center; margin: 6px 0 0; }
.rosi-composer__hint a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* Error */
.rosi-bubble--error { border: 1px solid #f1d6d3; background: #fff7f6; }

/* Shop-Offcanvas (Warenkorb/Menü) oder Modal offen -> Widget tritt zurück, Zustand bleibt */
.rosi.is-yield .rosi-panel, .rosi.is-yield .rosi-launcher, .rosi.is-yield .rosi-teaser { visibility: hidden !important; opacity: 0 !important; pointer-events: none !important; }

/* Zendesk open -> hide */
html[data-zendesk-open="1"] .rosi-panel, html[data-zendesk-open="1"] .rosi-launcher, html[data-zendesk-open="1"] .rosi-teaser { display: none !important; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .rosi-panel {
    left: 0; right: 0; bottom: 0; width: 100%; height: 100%; max-height: 100dvh; border-radius: 0;
    transform-origin: bottom center; padding-bottom: env(safe-area-inset-bottom);
  }
  .rosi-header { padding-top: calc(12px + env(safe-area-inset-top)); }
  .rosi.is-open .rosi-launcher, .rosi.is-open .rosi-teaser { display: none; }
  .rosi-input { font-size: 16px; }
  .rosi-card { flex-basis: 180px; }
  .rosi-hbtn { padding: 6px 9px; }
}
@media (max-height: 560px) and (min-width: 641px) { .rosi-panel { height: calc(100vh - 100px); bottom: 10px; } }
