/* ============================================================
   Ava – KI-Assistentin für Ave Businesshygiene
   Design: Plantrixx · Gold #be9359 auf Graphit
   ============================================================ */

:root {
  --ava-gold: #be9359;
  --ava-gold-light: #d4b078;
  --ava-dark: #17150f;
  --ava-surface: #211e16;
  --ava-surface-2: #2b2719;
  --ava-text: #f3efe7;
  --ava-muted: #a89e8a;
  --ava-radius: 18px;
  --ava-font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

#ava-root, #ava-root * { box-sizing: border-box; margin: 0; padding: 0; }
#ava-root { font-family: var(--ava-font); position: fixed; z-index: 999990; bottom: 0; right: 0; }

/* ---------- Schwebender Button ---------- */
.ava-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(135deg, #d4b078 0%, #be9359 55%, #9a744a 100%);
  color: #17150f;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(190, 147, 89, 0.45), 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  z-index: 999991;
}
.ava-launcher:hover { transform: scale(1.08) translateY(-2px); box-shadow: 0 10px 32px rgba(190, 147, 89, 0.55), 0 4px 10px rgba(0, 0, 0, 0.3); }
.ava-launcher:active { transform: scale(0.96); }
.ava-launcher svg { width: 28px; height: 28px; }

.ava-launcher::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(190, 147, 89, 0.5);
  animation: ava-pulse 2.8s ease-out infinite;
  pointer-events: none;
}
@keyframes ava-pulse {
  0%   { transform: scale(0.9); opacity: 0.9; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

.ava-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #65bc7b;
  border: 2px solid #fff;
}

/* ---------- Panel ---------- */
.ava-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 384px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 130px);
  max-height: calc(100dvh - 130px);
  background: var(--ava-dark);
  border-radius: var(--ava-radius);
  border: 1px solid rgba(190, 147, 89, 0.25);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45), 0 4px 16px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.22, 1.2, 0.36, 1);
}
.ava-panel.ava-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* Kopf */
.ava-header {
  position: relative;
  padding: 18px 20px 16px;
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(190, 147, 89, 0.28) 0%, rgba(190, 147, 89, 0) 55%),
    var(--ava-surface);
  border-bottom: 1px solid rgba(190, 147, 89, 0.22);
  display: flex;
  align-items: center;
  gap: 12px;
}
.ava-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4b078, #9a744a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #17150f;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.ava-head-txt { flex: 1; min-width: 0; }
.ava-title {
  color: var(--ava-text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.ava-subtitle {
  color: var(--ava-gold);
  font-size: 11.5px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ava-status { display: inline-flex; align-items: center; gap: 5px; margin-top: 3px; color: var(--ava-muted); font-size: 11px; }
.ava-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #65bc7b; }

.ava-close {
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ava-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.ava-close:hover { background: rgba(190, 147, 89, 0.2); color: var(--ava-text); transform: rotate(90deg); }

/* Verlauf */
.ava-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(190, 147, 89, 0.35) transparent;
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(190, 147, 89, 0.05) 0%, transparent 70%),
    var(--ava-dark);
}
.ava-body::-webkit-scrollbar { width: 5px; }
.ava-body::-webkit-scrollbar-thumb { background: rgba(190, 147, 89, 0.35); border-radius: 4px; }

.ava-msg {
  max-width: 84%;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.55;
  border-radius: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: ava-msg-in 0.32s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}
@keyframes ava-msg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ava-msg--bot {
  align-self: flex-start;
  background: var(--ava-surface-2);
  color: var(--ava-text);
  border: 1px solid rgba(190, 147, 89, 0.16);
  border-bottom-left-radius: 6px;
}
.ava-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, #cfa96e, #b0854c);
  color: #17150f;
  font-weight: 500;
  border-bottom-right-radius: 6px;
}

/* Tipp-Indikator */
.ava-typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 14px 16px;
  background: var(--ava-surface-2);
  border: 1px solid rgba(190, 147, 89, 0.16);
  border-radius: 16px;
  border-bottom-left-radius: 6px;
}
.ava-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ava-gold);
  animation: ava-bounce 1.2s infinite ease-in-out;
}
.ava-typing i:nth-child(2) { animation-delay: 0.15s; }
.ava-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ava-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* Schnellauswahl */
.ava-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 6px; animation: ava-msg-in 0.4s ease both; }
.ava-chip {
  border: 1px solid rgba(190, 147, 89, 0.45);
  background: transparent;
  color: var(--ava-gold-light);
  font-size: 12.5px;
  font-family: var(--ava-font);
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.ava-chip:hover { background: rgba(190, 147, 89, 0.16); color: var(--ava-text); transform: translateY(-1px); }

/* Eingabe */
.ava-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  background: var(--ava-surface);
  border-top: 1px solid rgba(190, 147, 89, 0.18);
}
.ava-input {
  flex: 1;
  resize: none;
  border: 1px solid rgba(190, 147, 89, 0.25);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ava-text);
  font-family: var(--ava-font);
  font-size: 14px;
  line-height: 1.4;
  padding: 11px 14px;
  border-radius: 14px;
  max-height: 110px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.ava-input::placeholder { color: var(--ava-muted); }
.ava-input:focus { border-color: var(--ava-gold); box-shadow: 0 0 0 3px rgba(190, 147, 89, 0.18); }

.ava-send {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4b078, #9a744a);
  color: #17150f;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}
.ava-send:hover { transform: scale(1.08); }
.ava-send:disabled { opacity: 0.45; cursor: default; transform: none; }
.ava-send svg { width: 18px; height: 18px; }

.ava-foot {
  padding: 7px 14px 10px;
  background: var(--ava-surface);
  font-size: 10.5px;
  color: var(--ava-muted);
  text-align: center;
  line-height: 1.4;
}
.ava-foot a { color: var(--ava-gold); text-decoration: none; }
.ava-foot a:hover { text-decoration: underline; }

/* ---------- Mobil ---------- */
@media (max-width: 480px) {
  .ava-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }
  .ava-launcher { bottom: 18px; right: 18px; }
  #ava-root.ava-is-open .ava-launcher { display: none; }
}

/* ---------- Reduzierte Bewegung ---------- */
@media (prefers-reduced-motion: reduce) {
  #ava-root *, #ava-root *::after { animation: none !important; transition: none !important; }
}
