/* ═══════════════════════════════════════════════════════
   LOG|CONS · LENA Widget — Unified Design
   Ersetzt lena-widget.css + lena-smart.css
   ═══════════════════════════════════════════════════════ */

/* ── Toggle Button ──────────────────────────────────── */
.lena-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  font-family: Inter, system-ui, -apple-system, sans-serif;
}
.lena-toggle {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(145deg, #0f172a 0%, #1e3a8a 55%, #1e40af 100%);
  border: 2px solid rgba(56,189,248,.55);
  box-shadow: 0 6px 28px rgba(14,165,233,.32), 0 0 0 6px rgba(56,189,248,.07);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .22s ease, box-shadow .22s ease;
  padding: 0;
  overflow: visible;
}
.lena-toggle:hover {
  transform: scale(1.07) translateY(-2px);
  box-shadow: 0 12px 36px rgba(14,165,233,.46), 0 0 0 8px rgba(56,189,248,.1);
}
.lena-toggle .lena-face { width: 50px; height: 50px; }
.lena-badge {
  position: absolute;
  bottom: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #fff;
  font-size: .6rem;
  font-weight: 900;
  letter-spacing: .14em;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(14,165,233,.4);
}
.lena-pulse {
  position: absolute;
  top: -3px; right: -3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #22c55e;
  border: 2.5px solid #fff;
  animation: lena-online 2.8s ease-in-out infinite;
}
@keyframes lena-online {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  50%      { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

/* ── SVG Face Animations ─────────────────────────────── */
.lena-face .lena-eye {
  animation: lena-blink 5s ease-in-out infinite;
}
@keyframes lena-blink {
  0%,90%,100% { ry: 7; opacity: 1; }
  94%          { ry: 0.4; opacity: .8; }
}
.lena-face .lena-antenna-dot {
  animation: lena-glow 2.2s ease-in-out infinite alternate;
}
@keyframes lena-glow {
  from { opacity: .5; r: 2.8; }
  to   { opacity: 1;  r: 3.8; }
}

/* ── Panel ───────────────────────────────────────────── */
.lena-panel {
  position: absolute;
  bottom: 82px;
  right: 0;
  width: 460px;
  max-height: 580px;
  background: #0d1526;
  border: 1px solid rgba(56,189,248,.2);
  border-radius: 22px;
  display: none;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(56,189,248,.06), inset 0 1px 0 rgba(255,255,255,.04);
  overflow: hidden;
}
.lena-panel.lena-open {
  display: flex;
  animation: lena-in .24s cubic-bezier(.22,1,.36,1);
}
@keyframes lena-in {
  from { opacity:0; transform: translateY(14px) scale(.97); }
  to   { opacity:1; transform: none; }
}

/* ── Panel Header ────────────────────────────────────── */
.lena-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 13px;
  background: linear-gradient(135deg, #0f172a 0%, #1a3a6e 100%);
  border-bottom: 1px solid rgba(56,189,248,.12);
  flex-shrink: 0;
}
.lena-panel-identity { display: flex; align-items: center; gap: 10px; }
.lena-avatar-sm .lena-face { width: 38px; height: 38px; }
.lena-panel-identity strong { display: block; color: #e2e8f0; font-size: 1rem; line-height: 1.15; }
.lena-status { display: flex; align-items: center; gap: 5px; font-size: .71rem; color: #64748b; margin-top: 2px; }
.lena-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; flex-shrink: 0; animation: lena-online 2.8s infinite; }

/* Voice button in header */
.lena-voice-btn {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(56,189,248,.2);
  color: #7dd3fc;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  transition: background .15s, border-color .15s, transform .12s;
  flex-shrink: 0;
}
.lena-voice-btn:hover { background: rgba(56,189,248,.15); border-color: rgba(56,189,248,.45); transform: scale(1.08); }
.lena-voice-btn.is-speaking { background: rgba(56,189,248,.2); border-color: #38bdf8; color: #38bdf8; animation: lena-speak-pulse .8s ease-in-out infinite alternate; }
.lena-voice-btn.is-muted { color: #475569; border-color: rgba(255,255,255,.1); }
@keyframes lena-speak-pulse { from { box-shadow: 0 0 0 0 rgba(56,189,248,.4); } to { box-shadow: 0 0 0 6px rgba(56,189,248,0); } }

/* Header right actions */
.lena-head-actions { display: flex; align-items: center; gap: 7px; }
.lena-close {
  background: rgba(255,255,255,.06);
  border: none;
  color: #94a3b8;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .85rem;
  transition: background .15s, color .15s;
  display: flex; align-items: center; justify-content: center;
}
.lena-close:hover { background: rgba(255,255,255,.14); color: #e2e8f0; }

/* ── Voice status bar ────────────────────────────────── */
.lena-voice-status {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(56,189,248,.07);
  border-bottom: 1px solid rgba(56,189,248,.1);
  font-size: .76rem;
  color: #7dd3fc;
  font-weight: 600;
  flex-shrink: 0;
}
.lena-voice-status.active { display: flex; }
.lena-voice-wave {
  display: flex; gap: 2px; align-items: center; height: 14px;
}
.lena-voice-wave span {
  width: 3px; border-radius: 2px; background: #38bdf8;
  animation: lena-wave .6s ease-in-out infinite;
}
.lena-voice-wave span:nth-child(2) { animation-delay: .1s; height: 8px; }
.lena-voice-wave span:nth-child(3) { animation-delay: .2s; height: 12px; }
.lena-voice-wave span:nth-child(4) { animation-delay: .1s; height: 8px; }
.lena-voice-wave span:nth-child(5) { animation-delay: .0s; height: 5px; }
@keyframes lena-wave {
  0%,100% { transform: scaleY(.4); opacity: .6; }
  50%      { transform: scaleY(1); opacity: 1; }
}

/* ── Messages ────────────────────────────────────────── */
.lena-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  scroll-behavior: smooth;
}
.lena-messages::-webkit-scrollbar { width: 3px; }
.lena-messages::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; }

.lena-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.lena-msg-ai   { justify-content: flex-start; }
.lena-msg-user { justify-content: flex-end; }
.lena-msg-avatar .lena-face { width: 28px; height: 28px; flex-shrink: 0; }
.lena-msg-bubble {
  max-width: 83%;
  padding: 11px 15px;
  border-radius: 18px;
  font-size: .91rem;
  line-height: 1.66;
  word-break: break-word;
}
.lena-msg-ai .lena-msg-bubble {
  background: #1a2540;
  color: #cbd5e1;
  border-bottom-left-radius: 5px;
  border: 1px solid rgba(56,189,248,.12);
}
.lena-msg-user .lena-msg-bubble {
  background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 4px 14px rgba(14,165,233,.25);
}
.lena-msg-ai .lena-msg-bubble a { color: #60a5fa; }

/* Speak button on last AI message */
.lena-msg-speak {
  background: none;
  border: none;
  cursor: pointer;
  color: #475569;
  font-size: .85rem;
  padding: 2px 4px;
  border-radius: 6px;
  transition: color .15s;
  align-self: center;
  flex-shrink: 0;
}
.lena-msg-speak:hover { color: #38bdf8; }

/* Typing dots */
.lena-dots { display: flex; gap: 4px; align-items: center; height: 18px; }
.lena-dots span { width: 7px; height: 7px; border-radius: 50%; background: #38bdf8; animation: lena-bounce .9s ease-in-out infinite; }
.lena-dots span:nth-child(2) { animation-delay: .15s; }
.lena-dots span:nth-child(3) { animation-delay: .30s; }
@keyframes lena-bounce { 0%,80%,100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-6px); opacity: 1; } }

/* ── Context chip (page info) ────────────────────────── */
.lena-context-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(255,255,255,.025);
  border-bottom: 1px solid rgba(56,189,248,.07);
  font-size: .72rem;
  color: #475569;
  flex-shrink: 0;
  overflow: hidden;
}
.lena-context-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Quick Chips ─────────────────────────────────────── */
.lena-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 6px;
  background: rgba(255,255,255,.015);
  border-top: 1px solid rgba(56,189,248,.07);
  flex-shrink: 0;
}
.lena-chip {
  background: rgba(30,41,64,.9);
  color: #93c5fd;
  border: 1px solid rgba(56,189,248,.18);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: .79rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: inherit;
}
.lena-chip:hover { background: rgba(30,58,138,.7); border-color: #3b82f6; color: #bfdbfe; }

/* ── Input Row ───────────────────────────────────────── */
.lena-input-row {
  display: flex;
  gap: 7px;
  padding: 11px 12px;
  background: #080f1e;
  border-top: 1px solid rgba(56,189,248,.08);
  flex-shrink: 0;
  align-items: center;
}
#lena-input {
  flex: 1;
  background: #1a2540;
  border: 1px solid rgba(56,189,248,.18);
  border-radius: 14px;
  color: #e2e8f0;
  font-size: .89rem;
  padding: 9px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
}
#lena-input:focus { border-color: rgba(56,189,248,.5); box-shadow: 0 0 0 3px rgba(56,189,248,.08); }
#lena-input::placeholder { color: #334155; }
.lena-send-btn {
  background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
  border: none;
  border-radius: 12px;
  width: 40px; height: 40px;
  cursor: pointer;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .18s, transform .12s;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(14,165,233,.25);
}
.lena-send-btn:hover  { opacity: .88; transform: scale(1.04); }
.lena-send-btn:active { transform: scale(.95); }
.lena-send-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 767px) {
  .lena-widget { bottom: 16px; right: 14px; }
  .lena-panel.lena-open {
    width: calc(100vw - 20px);
    max-width: 420px;
    right: 0;
    bottom: 86px;
    max-height: 76vh;
    border-radius: 18px;
  }
  .lena-toggle { width: 60px; height: 60px; }
  .lena-toggle .lena-face { width: 44px; height: 44px; }
  .lena-chip { font-size: .77rem; padding: 5px 11px; }
}

/* ── lena-smart Widget DEAKTIVIERT (in portal.js integriert) ── */
.lena-ai-root { display: none !important; }
