/* Chat Overlay — Taschenuhr öffnet */
.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chat-overlay.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.chat-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 26, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
}

.chat-panel-container {
  position: relative;
  width: 420px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: 80vh;
  background: var(--bg-elevated);
  border: 1px solid rgba(110, 145, 180, 0.15);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}

.chat-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: 8px;
  border-radius: 4px;
  transition: color 0.2s;
  line-height: 1;
}
.chat-close:hover { color: var(--text-headline); }

/* Chat panel styles for overlay context — 1:1 from denkraum.css */

#chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(110, 145, 180, 0.1);
  flex-shrink: 0;
}

#chat-header > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

#chat-header-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-headline);
}

#chat-cleanup {
  background: none;
  border: 1px solid rgba(110, 145, 180, 0.18);
  color: rgba(110, 145, 180, 0.5);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 5px;
}
#chat-cleanup.visible { opacity: 1; pointer-events: auto; }
#chat-cleanup:hover {
  color: rgba(160, 185, 215, 0.85);
  border-color: rgba(110, 145, 180, 0.35);
  background: rgba(110, 145, 180, 0.08);
}
#chat-cleanup svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }

#chat-messages {
  flex: 1;
  max-height: 320px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-thumb { background: rgba(110,145,180,0.25); border-radius: 2px; }

.msg {
  max-width: 88%;
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  animation: fadeUp 0.35s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user {
  align-self: flex-end;
  background: rgba(110, 145, 180, 0.18);
  color: rgba(200, 220, 240, 0.95);
  border: 1px solid rgba(110, 145, 180, 0.2);
}

.msg.bot {
  align-self: flex-start;
  background: rgba(20, 30, 42, 0.78);
  color: rgba(175, 198, 222, 0.95);
  border: 1px solid rgba(110, 145, 180, 0.14);
}

.msg.typing {
  align-self: flex-start;
  background: rgba(20, 30, 42, 0.75);
  border: 1px solid rgba(110, 145, 180, 0.12);
  padding: 13px 18px;
}

.typing-dots { display: flex; gap: 5px; align-items: center; }
.typing-dots span {
  width: 6px; height: 6px;
  background: rgba(110, 145, 180, 0.6);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}

.msg-cta {
  display: inline-block;
  margin-top: 10px;
  padding: 7px 16px;
  background: rgba(160, 85, 95, 0.2);
  border: 1px solid rgba(160, 85, 95, 0.35);
  border-radius: 10px;
  color: rgba(220, 140, 150, 0.95);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s;
  text-decoration: none;
}
.msg-cta:hover {
  background: rgba(160, 85, 95, 0.35);
  border-color: rgba(220, 140, 150, 0.5);
}

#chat-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid rgba(110, 145, 180, 0.1);
  flex-shrink: 0;
}

#contact-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.45;
  transition: opacity 0.25s;
}
#contact-btn:hover { opacity: 0.85; }
#contact-btn svg { width: 20px; height: 20px; stroke: rgba(220, 140, 150, 0.9); fill: none; stroke-width: 1.5; }

#chat-input {
  flex: 1;
  background: rgba(16, 24, 34, 0.5);
  border: 1px solid rgba(110, 145, 180, 0.15);
  border-radius: 10px;
  padding: 10px 14px;
  outline: none;
  color: rgba(200, 220, 240, 0.95);
  font-size: 14px;
  font-family: inherit;
}
#chat-input::placeholder { color: rgba(110, 145, 180, 0.42); }

#chat-send {
  background: rgba(110, 145, 180, 0.18);
  border: 1px solid rgba(110, 145, 180, 0.25);
  border-radius: 10px;
  color: rgba(160, 185, 215, 0.9);
  cursor: pointer;
  padding: 8px 14px;
  font-size: 16px;
  transition: background 0.2s;
  line-height: 1;
}
#chat-send:hover { background: rgba(110, 145, 180, 0.35); }
