/* ── AIStackHub Conversational Chat Styles ── */
/* Used by: research.html, editorial pages (floating widget), industry hub pages */

/* ── Chat Panel (Research Hub + Industry Hubs) ── */
.ash-chat-panel {
  background: linear-gradient(135deg, #0f1a2e 0%, #1a2744 100%);
  border-radius: 16px;
  padding: 32px 36px;
  margin-bottom: 40px;
  border: 1px solid rgba(37, 99, 235, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}
.ash-chat-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #2563eb, #7c3aed, #2563eb);
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.ash-chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.ash-chat-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ash-chat-panel-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.ash-chat-panel-label {
  font-size: 1rem; font-weight: 700;
  color: #e8eef8;
  letter-spacing: -0.2px;
}
.ash-chat-panel-sublabel {
  font-size: 0.75rem; color: #7a9ccf;
  margin-top: 1px;
}
.ash-chat-toggle-btn {
  font-size: 0.75rem;
  color: #7a9ccf;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 5px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}
.ash-chat-toggle-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #c8d8f0;
}

/* Messages area */
.ash-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 64px;
  margin-bottom: 16px;
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(37,99,235,0.3) transparent;
}
.ash-chat-messages:empty { display: none; }

.ash-chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.ash-chat-msg.user { flex-direction: row-reverse; }
.ash-chat-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  margin-top: 2px;
}
.ash-chat-msg.assistant .ash-chat-msg-avatar {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
}
.ash-chat-msg.user .ash-chat-msg-avatar {
  background: rgba(255,255,255,0.12);
  color: #c8d8f0;
}
.ash-chat-msg-content {
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #c8d8f0;
  max-width: 85%;
  border: 1px solid rgba(255,255,255,0.07);
}
.ash-chat-msg.user .ash-chat-msg-content {
  background: rgba(37, 99, 235, 0.18);
  color: #ddeaff;
  border-color: rgba(37,99,235,0.25);
}
.ash-chat-msg-content p { margin: 0 0 8px; }
.ash-chat-msg-content p:last-child { margin-bottom: 0; }
.ash-chat-msg-content ul, .ash-chat-msg-content ol { margin: 6px 0; padding-left: 18px; }
.ash-chat-msg-content li { margin-bottom: 4px; }
.ash-chat-msg-content strong { color: #e8eef8; }
.ash-chat-msg-content a { color: #60a5fa; text-decoration: underline; }

/* Data tier badge */
.ash-data-tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 6px;
  font-weight: 500;
}
.ash-data-tier-badge.tier-1 { background: rgba(107,114,128,0.2); color: #9ca3af; border: 1px solid rgba(107,114,128,0.25); }
.ash-data-tier-badge.tier-2 { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.2); }
.ash-data-tier-badge.tier-3 { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.2); }
.ash-data-tier-badge.tier-4 { background: rgba(37,99,235,0.15); color: #60a5fa; border: 1px solid rgba(37,99,235,0.3); }

/* Input area */
.ash-chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.ash-chat-input {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: #e8eef8;
  font-family: inherit;
  resize: none;
  min-height: 46px;
  max-height: 120px;
  transition: border-color 0.2s;
  outline: none;
  line-height: 1.5;
}
.ash-chat-input:focus { border-color: rgba(37,99,235,0.6); }
.ash-chat-input::placeholder { color: #4a6a9a; }

.ash-chat-send-btn {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none; border-radius: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  color: #fff;
}
.ash-chat-send-btn:hover { background: linear-gradient(135deg, #3b82f6, #2563eb); transform: translateY(-1px); }
.ash-chat-send-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.ash-chat-send-btn svg { width: 18px; height: 18px; }

.ash-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.ash-chat-suggestion {
  background: rgba(37,99,235,0.12);
  border: 1px solid rgba(37,99,235,0.25);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.78rem;
  color: #93c5fd;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.ash-chat-suggestion:hover { background: rgba(37,99,235,0.22); color: #bfdbfe; }

.ash-chat-typing {
  display: flex; align-items: center; gap: 6px;
  color: #7a9ccf; font-size: 0.8rem;
  padding: 6px 0;
}
.ash-chat-typing-dots { display: flex; gap: 3px; }
.ash-chat-typing-dots span {
  width: 5px; height: 5px;
  background: #4a7ac8;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.ash-chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ash-chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* Static content toggle */
.ash-static-toggle-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 10px 16px;
  background: #f0f4ff;
  border-radius: 10px;
  border: 1px solid #dbeafe;
  font-size: 0.82rem;
}
.ash-static-toggle-bar span { color: #4a5578; }
.ash-static-toggle-bar button {
  background: none; border: none;
  color: #2563eb; cursor: pointer;
  font-size: 0.82rem; font-weight: 600;
  text-decoration: underline;
  padding: 0;
}
.ash-static-toggle-bar button:hover { color: #1d4ed8; }

/* ── Floating Widget (Editorial Pages) ── */
.ash-floating-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.ash-widget-trigger {
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  color: #fff;
  border: none;
  border-radius: 28px;
  padding: 12px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(37,99,235,0.4);
  transition: all 0.2s;
  white-space: nowrap;
}
.ash-widget-trigger:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(37,99,235,0.5); }
.ash-widget-trigger svg { width: 16px; height: 16px; }
.ash-widget-trigger-pulse {
  width: 8px; height: 8px;
  background: #34d399;
  border-radius: 50%;
  animation: pulse-ring 2s infinite;
}
@keyframes pulse-ring { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.ash-widget-panel {
  background: #0f1a2e;
  border: 1px solid rgba(37,99,235,0.3);
  border-radius: 16px;
  width: 380px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  overflow: hidden;
  display: none;
}
.ash-widget-panel.open { display: flex; flex-direction: column; }

.ash-widget-header {
  background: linear-gradient(135deg, #1a2744, #1e3a5f);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.ash-widget-header-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.88rem; font-weight: 700; color: #e8eef8;
}
.ash-widget-header-title svg { width: 16px; height: 16px; color: #60a5fa; }
.ash-widget-close {
  background: none; border: none; cursor: pointer;
  color: #7a9ccf; font-size: 1.2rem; line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s;
}
.ash-widget-close:hover { color: #e8eef8; }

.ash-widget-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
}
.ash-widget-messages { display: flex; flex-direction: column; gap: 10px; }
.ash-widget-messages .ash-chat-msg-content { font-size: 0.84rem; padding: 8px 12px; }

.ash-widget-input-row {
  display: flex; gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.2);
}
.ash-widget-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.84rem;
  color: #e8eef8;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.ash-widget-input:focus { border-color: rgba(37,99,235,0.5); }
.ash-widget-input::placeholder { color: #4a6a9a; }
.ash-widget-send {
  width: 38px; height: 38px;
  background: #2563eb;
  border: none; border-radius: 8px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.ash-widget-send:hover { background: #3b82f6; }
.ash-widget-send:disabled { opacity: 0.4; cursor: not-allowed; }
.ash-widget-send svg { width: 16px; height: 16px; color: #fff; }

.ash-widget-hint {
  font-size: 0.72rem;
  color: #4a6a9a;
  padding: 0 4px;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .ash-chat-panel { padding: 20px; }
  .ash-floating-widget { bottom: 16px; right: 16px; }
  .ash-widget-panel { width: calc(100vw - 32px); }
}
