/* ==========================================================================
   TACHO FRANKFURT — AI WORKSHOP ASSISTANT WIDGET (CSS)
   ========================================================================== */

:root {
  --tacho-chat-primary: #0066cc;
  --tacho-chat-primary-hover: #0052a3;
  --tacho-chat-accent: #00d2ff;
  --tacho-chat-bg: #ffffff;
  --tacho-chat-surface: #f8fafc;
  --tacho-chat-text: #1e293b;
  --tacho-chat-text-muted: #64748b;
  --tacho-chat-border: #e2e8f0;
  --tacho-chat-user-bg: #0066cc;
  --tacho-chat-user-text: #ffffff;
  --tacho-chat-bot-bg: #f1f5f9;
  --tacho-chat-bot-text: #0f172a;
  --tacho-chat-shadow: 0 12px 36px -4px rgba(0, 0, 0, 0.16), 0 4px 16px -2px rgba(0, 0, 0, 0.08);
  --tacho-chat-radius: 16px;
}

[data-theme="dark"], body.dark-mode {
  --tacho-chat-bg: #0f172a;
  --tacho-chat-surface: #1e293b;
  --tacho-chat-text: #f8fafc;
  --tacho-chat-text-muted: #94a3b8;
  --tacho-chat-border: #334155;
  --tacho-chat-user-bg: #2563eb;
  --tacho-chat-user-text: #ffffff;
  --tacho-chat-bot-bg: #1e293b;
  --tacho-chat-bot-text: #f1f5f9;
  --tacho-chat-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

/* Floating Launcher Button */
.tacho-ai-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99990;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--tacho-chat-primary), #004d99);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  padding: 12px 20px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 102, 204, 0.35);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.tacho-ai-launcher:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 28px rgba(0, 102, 204, 0.45);
}

.tacho-ai-launcher-icon {
  position: relative;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tacho-ai-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--tacho-chat-accent);
  opacity: 0.4;
  animation: tachoPulse 2s infinite ease-out;
}

@keyframes tachoPulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  70% { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}

.tacho-ai-launcher-text {
  white-space: nowrap;
}

/* Chat Container Window */
.tacho-ai-window {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 110px);
  background: var(--tacho-chat-bg);
  border: 1px solid var(--tacho-chat-border);
  border-radius: var(--tacho-chat-radius);
  box-shadow: var(--tacho-chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99995;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  font-family: inherit;
}

.tacho-ai-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.tacho-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--tacho-chat-surface);
  border-bottom: 1px solid var(--tacho-chat-border);
}

.tacho-ai-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tacho-ai-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--tacho-chat-primary), #004d99);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.25);
}

.tacho-ai-title-wrap h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--tacho-chat-text);
  line-height: 1.2;
}

.tacho-ai-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--tacho-chat-text-muted);
  margin-top: 3px;
}

.tacho-ai-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.tacho-ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tacho-ai-btn-icon {
  background: transparent;
  border: none;
  color: var(--tacho-chat-text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
}

.tacho-ai-btn-icon:hover {
  background: var(--tacho-chat-bot-bg);
  color: var(--tacho-chat-text);
}

/* Chat Body / Messages */
.tacho-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.tacho-ai-message {
  display: flex;
  gap: 10px;
  max-width: 86%;
  animation: messageIn 0.25s ease-out;
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.tacho-ai-message.bot {
  align-self: flex-start;
}

.tacho-ai-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.tacho-ai-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.tacho-ai-message.bot .tacho-ai-bubble {
  background: var(--tacho-chat-bot-bg);
  color: var(--tacho-chat-bot-text);
  border-bottom-left-radius: 4px;
}

.tacho-ai-message.user .tacho-ai-bubble {
  background: var(--tacho-chat-user-bg);
  color: var(--tacho-chat-user-text);
  border-bottom-right-radius: 4px;
}

.tacho-ai-bubble p {
  margin: 0 0 8px 0;
}
.tacho-ai-bubble p:last-child {
  margin-bottom: 0;
}

.tacho-ai-bubble ul {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.tacho-ai-bubble li {
  margin-bottom: 4px;
}

.tacho-ai-bubble a {
  color: var(--tacho-chat-primary);
  text-decoration: underline;
  font-weight: 500;
}
.tacho-ai-message.user .tacho-ai-bubble a {
  color: #ffffff;
}

/* Quick Chips */
.tacho-ai-chips-wrap {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tacho-ai-chips-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tacho-chat-text-muted);
  font-weight: 600;
}

.tacho-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tacho-ai-chip {
  background: var(--tacho-chat-bg);
  border: 1px solid var(--tacho-chat-border);
  color: var(--tacho-chat-text);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tacho-ai-chip:hover {
  background: var(--tacho-chat-primary);
  color: #ffffff;
  border-color: var(--tacho-chat-primary);
  transform: translateY(-1px);
}

/* Typing Indicator */
.tacho-ai-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--tacho-chat-bot-bg);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.tacho-ai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tacho-chat-text-muted);
  animation: tachoDotBlink 1.4s infinite ease-in-out both;
}

.tacho-ai-dot:nth-child(1) { animation-delay: -0.32s; }
.tacho-ai-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes tachoDotBlink {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.tacho-ai-input-area {
  padding: 14px 16px;
  background: var(--tacho-chat-surface);
  border-top: 1px solid var(--tacho-chat-border);
}

.tacho-ai-input-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--tacho-chat-bg);
  border: 1px solid var(--tacho-chat-border);
  border-radius: 24px;
  padding: 4px 6px 4px 14px;
  transition: border-color 0.2s ease;
}

.tacho-ai-input-box:focus-within {
  border-color: var(--tacho-chat-primary);
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.15);
}

.tacho-ai-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--tacho-chat-text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  padding: 8px 0;
}

.tacho-ai-input::placeholder {
  color: var(--tacho-chat-text-muted);
}

.tacho-ai-btn-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--tacho-chat-primary);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  font-size: 14px;
}

.tacho-ai-btn-send:hover {
  background: var(--tacho-chat-primary-hover);
  transform: scale(1.05);
}

.tacho-ai-btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.tacho-ai-footer-note {
  font-size: 11px;
  color: var(--tacho-chat-text-muted);
  text-align: center;
  margin-top: 6px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .tacho-ai-launcher {
    bottom: 84px; /* Clearance for floating action buttons */
    right: 16px;
    padding: 10px 16px;
    font-size: 13px;
  }
  .tacho-ai-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}
