/* Techno QA Chat – chat.css */
#tqc-chat-widget * { box-sizing: border-box; margin: 0; padding: 0; }

#tqc-chat-widget {
  --tqc-primary: #1a6eb5;
  --tqc-primary-light: #e8f1fb;
  --tqc-primary-dark: #0f4a80;
  --tqc-bg: #ffffff;
  --tqc-surface: #f6f8fb;
  --tqc-border: #dde3ec;
  --tqc-text: #1a1f2e;
  --tqc-muted: #6b7280;
  --tqc-radius: 14px;
  --tqc-shadow: 0 2px 12px rgba(26,110,181,0.10);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  #tqc-chat-widget {
    --tqc-bg: #181e2a;
    --tqc-surface: #242c3a;
    --tqc-border: #2e3a4e;
    --tqc-text: #e8edf5;
    --tqc-muted: #8fa3be;
    --tqc-primary-light: #1a2d44;
    --tqc-shadow: 0 2px 16px rgba(0,0,0,0.4);
  }
}

.tqc-container {
  background: var(--tqc-bg);
  border: 1px solid var(--tqc-border);
  border-radius: var(--tqc-radius);
  box-shadow: var(--tqc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 820px;
  margin: 0 auto;
}

/* Header */
.tqc-header {
  background: var(--tqc-primary);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tqc-header-icon {
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.18);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tqc-header-icon svg { width: 20px; height: 20px; fill: #fff; }
.tqc-header-text { flex: 1; }
.tqc-header-title {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tqc-header-subtitle {
  color: rgba(255,255,255,0.72);
  font-size: 12px;
  margin-top: 1px;
}
.tqc-lang-picker {
  display: flex;
  gap: 4px;
}
.tqc-lang-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  transition: all .15s;
}
.tqc-lang-btn:hover,
.tqc-lang-btn.active {
  background: rgba(255,255,255,0.9);
  color: var(--tqc-primary);
}

/* Suggestion bar */
.tqc-suggestions {
  background: var(--tqc-surface);
  border-bottom: 1px solid var(--tqc-border);
  padding: 8px 14px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tqc-suggestion-chip {
  background: var(--tqc-bg);
  border: 1px solid var(--tqc-border);
  border-radius: 20px;
  color: var(--tqc-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px 12px;
  transition: all .15s;
  white-space: nowrap;
}
.tqc-suggestion-chip:hover {
  border-color: var(--tqc-primary);
  color: var(--tqc-primary);
  background: var(--tqc-primary-light);
}

/* Messages */
.tqc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.tqc-messages::-webkit-scrollbar { width: 5px; }
.tqc-messages::-webkit-scrollbar-thumb { background: var(--tqc-border); border-radius: 3px; }

/* Message bubbles */
.tqc-msg { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; }
.tqc-msg.user { flex-direction: row-reverse; }

.tqc-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.tqc-msg.assistant .tqc-avatar {
  background: var(--tqc-primary);
  color: #fff;
}
.tqc-msg.user .tqc-avatar {
  background: var(--tqc-surface);
  border: 1px solid var(--tqc-border);
  color: var(--tqc-muted);
}

.tqc-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--tqc-text);
}
.tqc-msg.assistant .tqc-bubble {
  background: var(--tqc-surface);
  border: 1px solid var(--tqc-border);
  border-top-left-radius: 3px;
}
.tqc-msg.user .tqc-bubble {
  background: var(--tqc-primary);
  color: #fff;
  border-top-right-radius: 3px;
}

/* Markdown-like formatting inside bubbles */
.tqc-bubble p { margin: 0 0 8px; }
.tqc-bubble p:last-child { margin-bottom: 0; }
.tqc-bubble code {
  background: rgba(0,0,0,0.07);
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 12.5px;
  padding: 1px 5px;
}
.tqc-msg.user .tqc-bubble code { background: rgba(255,255,255,0.2); }
.tqc-bubble pre {
  background: rgba(0,0,0,0.06);
  border-radius: 7px;
  font-size: 12.5px;
  margin: 8px 0;
  overflow-x: auto;
  padding: 10px 12px;
}
.tqc-bubble ul, .tqc-bubble ol {
  margin: 6px 0 6px 18px;
}
.tqc-bubble li { margin-bottom: 3px; }
.tqc-bubble strong { font-weight: 600; }

/* Meta / timestamp */
.tqc-meta {
  font-size: 10.5px;
  color: var(--tqc-muted);
  margin-top: 4px;
  padding: 0 4px;
}
.tqc-msg.user .tqc-meta { text-align: right; }

/* Typing indicator */
.tqc-typing .tqc-bubble {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tqc-dot {
  width: 7px; height: 7px;
  background: var(--tqc-muted);
  border-radius: 50%;
  animation: tqc-bounce 1.2s infinite ease-in-out;
}
.tqc-dot:nth-child(2) { animation-delay: .2s; }
.tqc-dot:nth-child(3) { animation-delay: .4s; }
@keyframes tqc-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .5; }
  40%           { transform: translateY(-6px); opacity: 1; }
}

/* Status banner */
.tqc-status {
  background: var(--tqc-surface);
  border-top: 1px solid var(--tqc-border);
  color: var(--tqc-muted);
  font-size: 12px;
  padding: 6px 16px;
  text-align: center;
}
.tqc-status.error { color: #c0392b; background: #fff0ee; border-color: #f5c6c0; }

/* Input area */
.tqc-input-area {
  background: var(--tqc-bg);
  border-top: 1px solid var(--tqc-border);
  padding: 12px 14px;
}
.tqc-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.tqc-textarea {
  background: var(--tqc-surface);
  border: 1px solid var(--tqc-border);
  border-radius: 10px;
  color: var(--tqc-text);
  flex: 1;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  min-height: 42px;
  max-height: 140px;
  outline: none;
  padding: 10px 14px;
  resize: none;
  transition: border-color .15s;
}
.tqc-textarea:focus { border-color: var(--tqc-primary); }
.tqc-textarea::placeholder { color: var(--tqc-muted); }

.tqc-send-btn {
  background: var(--tqc-primary);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  height: 42px;
  padding: 0 16px;
  transition: background .15s, transform .1s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.tqc-send-btn:hover:not(:disabled) { background: var(--tqc-primary-dark); }
.tqc-send-btn:active:not(:disabled) { transform: scale(0.97); }
.tqc-send-btn:disabled { opacity: .45; cursor: not-allowed; }
.tqc-send-btn svg { width: 16px; height: 16px; fill: #fff; }

.tqc-input-hint {
  color: var(--tqc-muted);
  font-size: 11px;
  margin-top: 6px;
  text-align: right;
}

/* Clear button */
.tqc-clear-btn {
  background: none;
  border: none;
  color: var(--tqc-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 0;
}
.tqc-clear-btn:hover { color: var(--tqc-primary); }

/* Responsive */
@media (max-width: 600px) {
  .tqc-bubble { max-width: 88%; }
  .tqc-lang-btn span { display: none; }
  .tqc-header { padding: 10px 12px; }
}
