/* ========================================
   AI Fragrance Global 2.0 — AI Modules CSS
   Extends admin.css with AI-specific components
   ======================================== */

/* AI Agent Status Cards */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.agent-card {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 20px;
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.agent-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-primary);
  opacity: 0;
  transition: opacity 0.3s;
}
.agent-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.agent-card:hover::before { opacity: 1; }
.agent-card.active::before { opacity: 1; }

.agent-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.agent-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}
.agent-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
}
.agent-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.agent-stats {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}
.agent-stat {
  flex: 1;
}
.agent-stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.agent-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
}
.status-pill.active {
  background: rgba(0,212,170,0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(0,212,170,0.3);
}
.status-pill.active::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  animation: pulse 2s infinite;
}
.status-pill.pending {
  background: rgba(212,175,55,0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(212,175,55,0.3);
}
.status-pill.configured {
  background: rgba(0,128,255,0.15);
  color: var(--accent-secondary);
  border: 1px solid rgba(0,128,255,0.3);
}
.status-pill.error {
  background: rgba(239,68,68,0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239,68,68,0.3);
}

/* AI Report Block */
.ai-report {
  background: linear-gradient(135deg, rgba(0,212,170,0.06), rgba(0,128,255,0.04));
  border: 1px solid rgba(0,212,170,0.2);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 28px;
}
.ai-report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.ai-report-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-report-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.ai-report-section {
  margin-bottom: 16px;
}
.ai-report-section:last-child { margin-bottom: 0; }
.ai-report-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.ai-report-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 0.85rem;
}
.ai-report-item .value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--accent-primary);
}
.ai-suggestion {
  background: rgba(255,107,53,0.08);
  border: 1px solid rgba(255,107,53,0.2);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.ai-suggestion strong { color: var(--accent-warm); }

/* Timeline */
.timeline {
  position: relative;
  padding-left: 24px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-primary), var(--accent-secondary), transparent);
}
.timeline-item {
  position: relative;
  padding-bottom: 20px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg-base);
  border: 2px solid var(--accent-primary);
}
.timeline-item.warning::before { border-color: var(--accent-warm); }
.timeline-item.info::before { border-color: var(--accent-secondary); }
.timeline-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 2px;
}
.timeline-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.timeline-text strong { color: var(--text-primary); }

/* Content Generator */
.content-generator {
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 28px;
}
.input-group {
  margin-bottom: 16px;
}
.input-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.input-field {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.2s;
}
.input-field:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0,212,170,0.1);
}
textarea.input-field {
  min-height: 80px;
  resize: vertical;
}
select.input-field {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b6b7d' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Tag Input */
.tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  min-height: 42px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(0,212,170,0.1);
  border: 1px solid rgba(0,212,170,0.3);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--accent-primary);
}
.tag .remove {
  cursor: pointer;
  opacity: 0.6;
  font-size: 0.9rem;
}
.tag .remove:hover { opacity: 1; }
.tag-input {
  flex: 1;
  min-width: 100px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.8rem;
  outline: none;
}

/* Generated Content Preview */
.content-preview {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}
.content-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.content-preview-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
}
.content-meta {
  display: flex;
  gap: 12px;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.content-body {
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-secondary);
  max-height: 300px;
  overflow-y: auto;
}
.content-body h2 { color: var(--text-primary); font-size: 1rem; margin: 12px 0 6px; }
.content-body h3 { color: var(--accent-primary); font-size: 0.9rem; margin: 10px 0 4px; }
.content-body p { margin-bottom: 8px; }
.content-body ul, .content-body ol { margin-left: 20px; margin-bottom: 8px; }
.content-body li { margin-bottom: 4px; }

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #00b890);
  color: #0a0a0f;
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(0,212,170,0.3); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover { border-color: var(--accent-secondary); color: var(--text-primary); }
.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-warm {
  background: linear-gradient(135deg, var(--accent-warm), #e55a2b);
  color: #fff;
}
.btn-sm { padding: 5px 12px; font-size: 0.75rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Two Column Layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* Knowledge Base Editor */
.kb-section {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.kb-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.kb-section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kb-item {
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kb-item .q { color: var(--text-secondary); }
.kb-item .a { color: var(--text-muted); font-size: 0.8rem; }

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* Heatmap Grid */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 12px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.heatmap-cell:hover { transform: scale(1.2); z-index: 1; }
.heatmap-cell.l1 { background: rgba(0,212,170,0.15); }
.heatmap-cell.l2 { background: rgba(0,212,170,0.3); }
.heatmap-cell.l3 { background: rgba(0,212,170,0.5); color: var(--text-primary); }
.heatmap-cell.l4 { background: rgba(0,212,170,0.7); color: #0a0a0f; font-weight: 600; }
.heatmap-cell.l5 { background: var(--accent-primary); color: #0a0a0f; font-weight: 700; }

/* Attribution Flow */
.attribution-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.8rem;
}
.attribution-node {
  padding: 6px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-secondary);
}
.attribution-node.highlight {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.attribution-arrow { color: var(--text-muted); }

/* Chat Interface */
.chat-container {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  height: 400px;
  display: flex;
  flex-direction: column;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.chat-msg {
  margin-bottom: 12px;
  max-width: 75%;
}
.chat-msg.user {
  margin-left: auto;
}
.chat-msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
}
.chat-msg.bot .chat-msg-bubble {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.chat-msg.user .chat-msg-bubble {
  background: linear-gradient(135deg, var(--accent-primary), #00b890);
  color: #0a0a0f;
}
.chat-msg-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
}
.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
}
.chat-input {
  flex: 1;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
}
.chat-input:focus { border-color: var(--accent-primary); }

/* Lead Card */
.lead-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
}
.lead-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0a0a0f;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.lead-info { flex: 1; }
.lead-name { font-weight: 600; font-size: 0.9rem; }
.lead-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.lead-tags { display: flex; gap: 4px; margin-top: 6px; }
.lead-tag {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-muted);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-primary); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-primary);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 2rem; margin-bottom: 8px; }

/* Code Block */
.code-block {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--accent-primary);
  overflow-x: auto;
  line-height: 1.6;
}
