/* =========================================================
   Rund ums Grün – Chat-Assistent
   ========================================================= */
.rug-chat { position: fixed; right: 20px; bottom: 20px; z-index: 90; font-family: var(--font-body); }

/* Starter-Button */
.rug-launch {
  width: 64px; height: 64px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--forest); color: var(--lime);
  display: grid; place-items: center; box-shadow: 0 14px 30px -10px rgba(31,58,43,.6);
  transition: transform .2s, background .2s; position: relative;
}
.rug-launch:hover { transform: scale(1.06); background: var(--forest-2); }
.rug-launch svg { width: 28px; height: 28px; }
.rug-launch::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--gold); opacity: .6; animation: rugPulse 2.6s ease-out infinite;
}
@keyframes rugPulse { from { transform: scale(.9); opacity: .7; } to { transform: scale(1.25); opacity: 0; } }
.rug-launch-close { display: none; }
.rug-chat.open .rug-launch-open { display: none; }
.rug-chat.open .rug-launch-close { display: grid; }
.rug-chat.open .rug-launch::after { display: none; }

/* Hinweis-Bubble */
.rug-teaser {
  position: absolute; right: 0; bottom: 78px; width: 250px;
  background: var(--white); color: var(--ink); font-size: .92rem; line-height: 1.45;
  padding: 14px 34px 14px 16px; border-radius: 18px 18px 4px 18px;
  box-shadow: 0 16px 36px -14px rgba(31,58,43,.45); cursor: pointer;
  animation: rugIn .4s ease;
}
.rug-teaser b { color: var(--forest); }
.rug-teaser-x { position: absolute; top: 6px; right: 6px; background: none; border: 0; padding: 4px; cursor: pointer; color: var(--stone); }
.rug-teaser-x svg { width: 14px; height: 14px; display: block; }

/* Panel */
.rug-panel {
  position: absolute; right: 0; bottom: 80px;
  width: 380px; height: min(620px, calc(100vh - 120px));
  background: var(--sand); border-radius: 24px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 60px -20px rgba(20,38,28,.55), 0 0 0 1px rgba(31,58,43,.08);
  animation: rugIn .3s ease;
}
.rug-panel[hidden], .rug-teaser[hidden], .rug-file[hidden] { display: none; }
@keyframes rugIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.rug-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 14px 16px; background: var(--forest); color: #fff; }
.rug-avatar { width: 40px; height: 40px; border-radius: 50%; background: #fff; object-fit: contain; padding: 4px; }
.rug-title { flex: 1; display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.rug-title b { font-family: "Oswald", sans-serif; font-weight: 600; font-size: 1.1rem; color: var(--lime); letter-spacing: .01em; }
.rug-title small { font-size: .74rem; color: #c9d5c4; display: flex; align-items: center; gap: 6px; }
.rug-dot { width: 7px; height: 7px; border-radius: 50%; background: #8fd46b; flex: none; }
.rug-icon { width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.08); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.rug-icon:hover { background: rgba(255,255,255,.18); }
.rug-icon svg { width: 16px; height: 16px; }
.rug-demo { background: var(--lime); color: var(--forest); font-size: .72rem; font-weight: 600; text-align: center; padding: 4px 8px; letter-spacing: .02em; }

/* Nachrichten */
.rug-log { flex: 1; overflow-y: auto; padding: 18px 14px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.rug-msg { max-width: 85%; padding: 10px 14px; font-size: .93rem; line-height: 1.5; border-radius: 18px; animation: rugIn .25s ease; word-wrap: break-word; }
.rug-bot { align-self: flex-start; background: var(--white); color: var(--ink); border-bottom-left-radius: 4px; box-shadow: 0 2px 6px -3px rgba(31,58,43,.2); }
.rug-bot b { color: var(--forest); }
.rug-bot a { color: var(--gold-dark); font-weight: 600; }
.rug-user { align-self: flex-end; background: var(--forest); color: #fff; border-bottom-right-radius: 4px; }
.rug-photo { padding: 4px; }
.rug-photo img { max-width: 200px; border-radius: 14px; }
.rug-note { display: block; font-size: .8rem; color: var(--stone); font-style: italic; }
.rug-typing { display: flex; gap: 4px; padding: 14px 16px; }
.rug-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: rugDot 1s infinite ease-in-out; }
.rug-typing i:nth-child(2) { animation-delay: .15s; }
.rug-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes rugDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

.rug-sum { border-collapse: collapse; font-size: .86rem; width: 100%; }
.rug-sum th { text-align: left; color: var(--gold-dark); font-weight: 600; padding: 4px 10px 4px 0; vertical-align: top; white-space: nowrap; }
.rug-sum td { padding: 4px 0; }
.rug-sum tr + tr { border-top: 1px solid var(--sand-2); }

/* Antwort-Chips */
.rug-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 10px; }
.rug-chips:empty { display: none; }
.rug-chip {
  font: inherit; font-size: .84rem; font-weight: 500; cursor: pointer;
  padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--gold);
  background: var(--white); color: var(--forest); transition: background .15s, color .15s;
}
.rug-chip:hover, .rug-chip:focus-visible { background: var(--forest); border-color: var(--forest); color: #fff; }

/* Eingabe */
.rug-input { display: flex; align-items: center; gap: 6px; padding: 10px 10px 10px 12px; background: var(--white); border-top: 1px solid var(--sand-2); }
.rug-text { flex: 1; min-width: 0; font: inherit; font-size: .95rem; border: 0; background: var(--sand); padding: 11px 14px; border-radius: 999px; }
.rug-text:focus { outline: 2px solid var(--leaf); outline-offset: 0; }
.rug-send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--lime); color: var(--forest); display: grid; place-items: center; cursor: pointer; flex: none; }
.rug-send:hover { background: #e8dfba; }
.rug-send svg { width: 18px; height: 18px; }
.rug-file { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--forest); cursor: pointer; flex: none; background: var(--sand); }
.rug-file svg { width: 18px; height: 18px; }
.rug-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.rug-file:focus-within { outline: 2px solid var(--leaf); }
.rug-error { margin: 0; padding: 0 14px; font-size: .78rem; color: #a2391f; background: var(--white); }
.rug-error:empty { display: none; }
.rug-error:not(:empty) { padding-bottom: 8px; }

/* Smartphone: Vollbild */
@media (max-width: 520px) {
  .rug-chat { right: 14px; bottom: 14px; }
  .rug-launch { width: 58px; height: 58px; }
  .rug-panel { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; bottom: 0; }
  .rug-chat.open .rug-launch { display: none; }
  .rug-teaser { width: calc(100vw - 100px); }
  .rug-text { font-size: 16px; } /* verhindert Zoom auf iOS */
}
@media (prefers-reduced-motion: reduce) {
  .rug-launch::after, .rug-typing i { animation: none; }
  .rug-panel, .rug-msg, .rug-teaser { animation: none; }
}

.rug-hinweis { background: #fbf6e6 !important; border: 1.5px solid var(--gold); }
