/* ============================================
   NUURA — NuuraInsight Dashboard
   Dark Glassmorphism · Premium Intelligence UI
   ============================================ */

/* ─── Page Wrapper ─── */
.insight-page {
  background: var(--bg-primary);
}

/* ─── Pulse Dot (header badge) ─── */
.insight-pulse-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent-green);
  border-radius: 50%;
  margin-right: var(--space-2);
  animation: insightPulse 2s ease-in-out infinite;
}

@keyframes insightPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ─── Metrics Grid ─── */
.insight-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.insight-metric-card {
  position: relative;
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.insight-metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.insight-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Accent colors for top border */
.insight-accent-cyan::before { background: linear-gradient(90deg, var(--accent-cyan), rgba(0, 212, 255, 0.3)); }
.insight-accent-violet::before { background: linear-gradient(90deg, var(--accent-violet), rgba(124, 58, 237, 0.3)); }
.insight-accent-green::before { background: linear-gradient(90deg, var(--accent-green), rgba(16, 185, 129, 0.3)); }
.insight-accent-amber::before { background: linear-gradient(90deg, var(--accent-amber), rgba(251, 191, 36, 0.3)); }
.insight-accent-rose::before { background: linear-gradient(90deg, var(--accent-rose), rgba(255, 75, 75, 0.3)); }

.insight-metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.insight-metric-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 18px;
}

.insight-metric-icon.cyan { background: rgba(0, 212, 255, 0.1); color: var(--accent-cyan); }
.insight-metric-icon.violet { background: rgba(124, 58, 237, 0.1); color: var(--accent-violet); }
.insight-metric-icon.green { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.insight-metric-icon.amber { background: rgba(251, 191, 36, 0.1); color: var(--accent-amber); }
.insight-metric-icon.rose { background: rgba(255, 75, 75, 0.1); color: var(--accent-rose); }

.insight-metric-icon .material-symbols-outlined { font-size: 18px; }

.insight-metric-value {
  font-family: var(--font-heading);
  font-size: var(--font-2xl);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-1);
}

.insight-metric-label {
  font-size: var(--font-xs);
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.insight-metric-trend-wrapper {
  display: flex;
  align-items: center;
}

.insight-metric-trend {
  font-size: var(--font-xs);
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.insight-metric-trend .trend-icon { font-size: 14px; }
.insight-metric-trend.trend-up { color: var(--accent-green); }
.insight-metric-trend.trend-down { color: var(--accent-rose); }

/* ─── Chat Interface ─── */
.insight-chat {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-6);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.insight-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.insight-chat-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.insight-chat-avatar {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-brand);
  border-radius: var(--radius-md);
  color: var(--text-inverse);
}

.insight-chat-avatar .material-symbols-outlined { font-size: 22px; }

.insight-chat-header h3 {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.insight-chat-status {
  font-size: var(--font-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.insight-status-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: insightPulse 2s ease-in-out infinite;
}

/* Messages Area */
.insight-chat-messages {
  flex: 1;
  min-height: 320px;
  max-height: 480px;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.insight-message {
  display: flex;
  max-width: 85%;
  animation: messageSlide 0.3s ease both;
}

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

.insight-message--user {
  align-self: flex-end;
  justify-content: flex-end;
}

.insight-message--agent {
  align-self: flex-start;
}

.insight-message-bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--font-sm);
  line-height: 1.6;
  word-wrap: break-word;
}

.insight-message--user .insight-message-bubble {
  background: var(--gradient-brand);
  color: var(--text-inverse);
  border-bottom-right-radius: var(--radius-sm);
}

.insight-message--agent .insight-message-bubble {
  background: var(--bg-surface-container);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: var(--radius-sm);
}

.insight-message-bubble strong {
  font-weight: 700;
  color: inherit;
}

/* Typing Indicator */
.insight-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-3) var(--space-5) !important;
}

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

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Quick Chips */
.insight-quick-chips {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  overflow-x: auto;
  border-top: 1px solid var(--border-subtle);
  scrollbar-width: none;
}

.insight-quick-chips::-webkit-scrollbar { display: none; }

.insight-chip {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-4);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: var(--font-xs);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.insight-chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.1);
}

.insight-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Chat Input */
.insight-chat-input {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.insight-chat-input input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-sm);
  outline: none;
  transition: all var(--transition-fast);
}

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

.insight-chat-input input:focus {
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-glow-cyan);
}

.insight-send-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-brand);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-inverse);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.insight-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: var(--shadow-glow-cyan);
}

.insight-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.insight-send-btn .material-symbols-outlined { font-size: 18px; }

/* ─── Alerts Section ─── */
.insight-alerts {
  margin-bottom: var(--space-8);
}

.insight-alerts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.insight-alerts-header h2 {
  font-size: var(--font-lg);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.insight-section-icon {
  color: var(--accent-amber);
  font-size: 20px;
}

.insight-alert-count {
  padding: var(--space-1) var(--space-3);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--text-secondary);
}

.insight-alerts-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.insight-alert-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  transition: all var(--transition-fast);
}

.insight-alert-item:hover {
  border-color: var(--border-active);
}

.insight-alert-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(251, 191, 36, 0.1);
  border-radius: var(--radius-md);
  color: var(--accent-amber);
  flex-shrink: 0;
}

.insight-alert-icon .material-symbols-outlined { font-size: 18px; }

.insight-alert-content {
  flex: 1;
  min-width: 0;
}

.insight-alert-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.insight-alert-severity {
  font-size: var(--font-sm);
}

.insight-alert-desc {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* No Alerts State */
.insight-no-alerts {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  color: var(--text-secondary);
  font-size: var(--font-sm);
}

.insight-no-alerts-icon {
  color: var(--accent-green);
  font-size: 24px;
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .insight-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .insight-metrics-grid {
    grid-template-columns: 1fr;
  }

  .insight-message {
    max-width: 95%;
  }

  .insight-chat-messages {
    min-height: 250px;
    max-height: 360px;
  }
}
