/* Chat-Widget mit Potenzialrechner */

.chat-btn {
  position: fixed;
  right: clamp(16px, 2.5vw, 28px);
  bottom: clamp(16px, 2.5vw, 28px);
  z-index: 70;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(213, 185, 140, 0.5);
  border-radius: 50%;
  background: var(--navy);
  color: var(--accent);
  cursor: pointer;
  box-shadow: var(--shadow-l);
  transition: transform var(--t-base) var(--ease), background var(--t-base) var(--ease);
}

.chat-btn:hover {
  transform: translateY(-3px);
  background: var(--navy-soft);
}

.chat-btn.is-open {
  transform: scale(0.94);
}

.chat-btn svg {
  width: 36px;
  height: 36px;
  fill: currentColor;
}

/* Teaser-Blasen */

.chat-teasers {
  position: fixed;
  right: clamp(22px, 3vw, 34px);
  bottom: clamp(100px, 12vw, 116px);
  z-index: 65;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: 272px;
}

.chat-teaser {
  position: relative;
  display: block;
  padding: 12px 16px;
  text-align: left;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  border-bottom-right-radius: 5px;
  box-shadow: var(--shadow-m);
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease),
    border-color var(--t-fast) var(--ease);
}

.chat-teaser.is-visible {
  opacity: 1;
  transform: none;
}

.chat-teaser:hover {
  border-color: var(--accent-on-light);
}

.chat-teaser--last::before,
.chat-teaser--last::after {
  content: "";
  position: absolute;
  right: 17px;
  bottom: -9px;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-top: 9px solid var(--line);
}

.chat-teaser--last::after {
  bottom: -7.5px;
  border-top-color: var(--surface-raised);
}

@media (max-width: 859px) {
  .chat-teasers {
    display: none;
  }
}

/* Panel */

.chat-panel {
  position: fixed;
  right: clamp(16px, 2.5vw, 28px);
  bottom: clamp(100px, 12vw, 118px);
  z-index: 70;
  display: flex;
  flex-direction: column;
  width: min(376px, calc(100vw - 32px));
  max-height: min(580px, calc(100vh - 170px));
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  border-bottom-right-radius: 6px;
  box-shadow: var(--shadow-l);
}

.chat-panel[hidden] {
  display: none;
}

.chat-panel::before,
.chat-panel::after {
  content: "";
  position: absolute;
  right: 23px;
  bottom: -10px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-top: 10px solid var(--line);
}

.chat-panel::after {
  bottom: -8.5px;
  border-top-color: var(--surface-raised);
}

.chat-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
}

.chat-panel__title {
  font-size: 0.94rem;
  font-weight: 600;
}

.chat-panel__note {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}

.chat-panel__close {
  flex: none;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-s);
  background: none;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.chat-panel__close:hover {
  background: var(--surface);
  color: var(--text);
}

.chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 17px;
  overflow-y: auto;
}

.bubble {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: var(--radius-l);
  font-size: 0.9rem;
  line-height: 1.5;
}

.bubble--bot {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.bubble--me {
  align-self: flex-end;
  background: var(--navy);
  color: var(--text-on-dark);
  border-bottom-right-radius: 4px;
}

.typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 13px 14px;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBlink 1.1s ease-in-out infinite;
}

.typing span:nth-child(2) { animation-delay: 0.18s; }
.typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingBlink {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 0.9; transform: translateY(-2px); }
}

/* Ergebniskarte */

.result {
  align-self: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  overflow: hidden;
  font-size: 0.86rem;
}

.result__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
}

.result__row:last-child {
  border-bottom: none;
}

.result__row span {
  color: var(--text-muted);
}

.result__row strong {
  font-weight: 600;
  text-align: right;
}

.result__row--total {
  background: rgba(128, 97, 40, 0.08);
  padding: 13px;
}

.result__row--total strong {
  color: var(--accent-on-light);
  font-size: 1.02rem;
}

/* Eingabebereich */

.chat-input {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 13px 17px 17px;
  border-top: 1px solid var(--line);
}

.chat-input:empty {
  display: none;
}

.chat-hint {
  width: 100%;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.chat-choice {
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-raised);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.chat-choice:hover {
  border-color: var(--accent-on-light);
  background: rgba(128, 97, 40, 0.06);
}

.chat-choice--quiet {
  color: var(--text-muted);
}

.chat-form {
  display: flex;
  gap: 8px;
  width: 100%;
}

.chat-form input,
.chat-form textarea {
  flex: 1;
  min-width: 0;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface-raised);
  font-size: 0.9rem;
}

.chat-form textarea {
  min-height: 66px;
  resize: vertical;
}

.chat-form input:focus,
.chat-form textarea:focus {
  outline: none;
  border-color: var(--accent-on-light);
}

.chat-form button {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  border: none;
  border-radius: var(--radius-m);
  background: var(--navy);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}

.chat-form button:hover {
  background: var(--navy-soft);
}

.chat-form button svg {
  width: 17px;
  height: 17px;
  fill: var(--accent);
}

.chat-error {
  width: 100%;
  font-size: 0.8rem;
  color: #A4442F;
}

.chat-status {
  font-size: 0.86rem;
  color: var(--text-muted);
}
