/* ═══════════════════════════════════════════════════════════════
   Ultragaz AI Platform — Design System v3.1
   ExtensionAI · ai.ultragaz24horas.com
   Week 1: Semantic tokens + Bootstrap hybrid layout
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  /* ── Brand palette ── */
  --ultra-blue: #0066cc;
  --ultra-green: #00a86b;
  --ultra-cyan: #00d4aa;
  --ultra-purple: #6c5ce7;
  --ultra-gold: #f5a623;

  /* ── Semantic tokens (overridden per-theme on .ai-app-shell) ── */
  --ai-bg-primary: #0a0e1a;
  --ai-bg-secondary: rgba(15, 23, 42, 0.85);
  --ai-bg-tertiary: rgba(30, 41, 59, 0.7);
  --ai-text-primary: #f1f5f9;
  --ai-text-secondary: #94a3b8;
  --ai-accent: #00d4aa;
  --ai-accent-hover: #00a86b;
  --ai-border: rgba(255, 255, 255, 0.08);
  --ai-success: #22c55e;
  --ai-error: #ef4444;
  --ai-warning: #f5a623;
  --ai-info: #0066cc;

  /* ── Typography ── */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* ── Glass & effects ── */
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(20px);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 40px rgba(0, 168, 107, 0.15);
  --shadow-glow-purple: 0 0 40px rgba(108, 92, 231, 0.2);

  /* ── Radius ── */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* ── Bootstrap-aligned breakpoints ── */
  --bp-xs: 0;
  --bp-sm: 576px;
  --bp-md: 768px;
  --bp-lg: 992px;
  --bp-xl: 1200px;
  --bp-xxl: 1400px;

  /* ── Motion ── */
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ── Layout ── */
  --sidebar-width: 260px;
  --mobile-header-height: 56px;
}

/* ── Animated mesh background ── */
.ai-mesh-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ai-mesh-bg::before,
.ai-mesh-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: meshFloat 20s ease-in-out infinite;
}

.ai-mesh-bg::before {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--ultra-green) 0%, transparent 70%);
  top: -200px;
  right: -100px;
}

.ai-mesh-bg::after {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--ultra-purple) 0%, transparent 70%);
  bottom: -150px;
  left: -100px;
  animation-delay: -10s;
}

.ai-mesh-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.2;
  animation: meshFloat 15s ease-in-out infinite;
}

.ai-mesh-orb:nth-child(1) {
  width: 300px; height: 300px;
  background: var(--ultra-cyan);
  top: 40%; left: 30%;
  animation-delay: -5s;
}

.ai-mesh-orb:nth-child(2) {
  width: 200px; height: 200px;
  background: var(--ultra-blue);
  top: 60%; right: 20%;
  animation-delay: -12s;
}

@keyframes meshFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 30px) scale(0.95); }
}

/* ── Grid overlay ── */
.ai-grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black, transparent);
}

/* ── App shell ── */
.ai-app-shell {
  position: relative;
  z-index: 1;
  font-family: var(--font-sans) !important;
  display: flex;
  height: 100vh;
  background: var(--ai-bg-primary);
  color: var(--ai-text-primary);
  overflow: hidden;
}

.ai-main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.ai-main-content {
  flex: 1;
  overflow: auto;
  position: relative;
  z-index: 1;
  animation: viewEnter 0.4s ease-out;
}

.ai-app-shell main {
  position: relative;
  animation: viewEnter 0.4s ease-out;
}

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

/* ── Mobile header ── */
.ai-mobile-header {
  display: none;
  align-items: center;
  gap: 12px;
  height: var(--mobile-header-height);
  padding: 0 16px;
  background: var(--ai-bg-secondary);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  flex-shrink: 0;
  z-index: 10;
}

.ai-mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  color: var(--ai-text-primary);
  cursor: pointer;
  transition: all var(--transition);
}

.ai-mobile-menu-btn:hover {
  border-color: var(--ultra-cyan);
  background: rgba(0, 212, 170, 0.08);
}

.ai-mobile-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  background: linear-gradient(135deg, var(--ultra-cyan), var(--ultra-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Sidebar ── */
.ai-sidebar {
  backdrop-filter: var(--glass-blur) !important;
  -webkit-backdrop-filter: var(--glass-blur) !important;
  border-right: 1px solid var(--glass-border) !important;
  transition: width var(--transition) !important;
  width: var(--sidebar-width);
  background: var(--ai-bg-secondary) !important;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  flex-shrink: 0;
}

.ai-sidebar-desktop {
  display: flex;
}

.ai-sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 12px;
}

.ai-sidebar-subtitle {
  color: var(--ai-text-secondary);
  font-size: 0.72rem;
  margin: 4px 0 0;
  opacity: 0.7;
}

.ai-sidebar-nav {
  flex: 1;
  overflow-y: auto;
}

.ai-nav-section-label {
  padding: 12px 20px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ai-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.6;
}

.ai-sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--glass-border);
  font-size: 0.72rem;
  color: var(--ai-text-secondary);
}

.ai-nav-badge-count {
  background: var(--ai-error);
  color: #fff;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
}

.ai-sidebar-logo {
  font-family: var(--font-display) !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--ultra-cyan), var(--ultra-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ai-sidebar-logo-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(0, 168, 107, 0.15);
  color: var(--ultra-cyan);
  border: 1px solid rgba(0, 212, 170, 0.3);
  margin-left: 8px;
  vertical-align: middle;
  -webkit-text-fill-color: var(--ultra-cyan);
}

.ai-nav-btn {
  position: relative;
  border-radius: var(--radius-sm) !important;
  margin: 2px 12px !important;
  width: calc(100% - 24px) !important;
  padding: 11px 16px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  transition: all var(--transition) !important;
  overflow: hidden;
}

.ai-nav-btn.active {
  background: rgba(0, 212, 170, 0.08) !important;
  color: var(--ai-accent) !important;
}

.ai-nav-btn::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--ultra-cyan);
  border-radius: 0 3px 3px 0;
  transform: scaleY(0);
  transition: transform var(--transition);
}

.ai-nav-btn.active::before,
.ai-nav-btn:hover::before {
  transform: scaleY(1);
}

.ai-nav-btn.active {
  background: rgba(0, 212, 170, 0.08) !important;
  box-shadow: inset 0 0 20px rgba(0, 212, 170, 0.05);
}

.ai-nav-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.04) !important;
  transform: translateX(4px);
}

.ai-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.ai-nav-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.ai-nav-badge {
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ── Hero section ── */
.ai-hero {
  position: relative;
  padding: 48px 32px 64px;
  text-align: center;
  overflow: hidden;
}

.ai-hero-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 200px;
  background: radial-gradient(ellipse, rgba(108, 92, 231, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.ai-hero-title {
  font-family: var(--font-display) !important;
  font-size: clamp(2.2rem, 5vw, 3.5rem) !important;
  font-weight: 700 !important;
  letter-spacing: -0.03em;
  line-height: 1.1 !important;
  background: linear-gradient(135deg, #fff 0%, var(--ultra-cyan) 50%, var(--ultra-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleShimmer 4s ease-in-out infinite;
}

@keyframes titleShimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
}

.ai-hero-subtitle {
  font-size: 1.15rem !important;
  max-width: 560px;
  margin: 16px auto 0 !important;
  opacity: 0.85;
}

.ai-hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.ai-stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 40px;
  backdrop-filter: blur(10px);
  font-size: 0.85rem;
  animation: fadeInUp 0.6s ease-out backwards;
}

.ai-stat-pill:nth-child(1) { animation-delay: 0.1s; }
.ai-stat-pill:nth-child(2) { animation-delay: 0.2s; }
.ai-stat-pill:nth-child(3) { animation-delay: 0.3s; }
.ai-stat-pill:nth-child(4) { animation-delay: 0.4s; }

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

/* ── Buttons ── */
.ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  font-family: var(--font-sans);
}

.ai-btn-primary {
  background: linear-gradient(135deg, var(--ultra-green), var(--ultra-cyan));
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 168, 107, 0.35);
}

.ai-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 168, 107, 0.45);
}

.ai-btn-ghost {
  background: var(--glass-bg);
  color: inherit;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
}

.ai-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* ── Cards ── */
.ai-card {
  background: var(--glass-bg) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: var(--radius-lg) !important;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: all var(--transition) !important;
  position: relative;
  overflow: hidden;
}

.ai-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}

.ai-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: var(--shadow-md), var(--shadow-glow) !important;
  border-color: rgba(0, 212, 170, 0.25) !important;
}

.ai-card:hover::after {
  opacity: 1;
}

.ai-card-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
}

/* ── Agent cards grid ── */
.ai-agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.ai-agent-card {
  cursor: pointer;
  text-align: left;
  padding: 24px !important;
}

.ai-agent-card .agent-color-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.ai-skill-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  margin: 2px;
}

/* ── Dashboard module ── */
.ai-dashboard {
  padding: 32px;
  max-width: 1200px;
}

.ai-dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.ai-metric-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  transition: all var(--transition);
}

.ai-metric-card:hover {
  border-color: rgba(0, 212, 170, 0.3);
  box-shadow: var(--shadow-glow);
}

.ai-metric-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin: 8px 0 4px;
}

.ai-metric-label {
  font-size: 0.8rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ai-metric-trend {
  font-size: 0.75rem;
  margin-top: 8px;
}

.ai-metric-trend.up { color: #22c55e; }
.ai-metric-trend.down { color: #ef4444; }

/* ── Prompt library ── */
.ai-prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.ai-prompt-card {
  padding: 20px;
  cursor: pointer;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  transition: all var(--transition);
}

.ai-prompt-card:hover {
  border-color: var(--ultra-purple);
  box-shadow: var(--shadow-glow-purple);
  transform: translateY(-2px);
}

.ai-prompt-category {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ultra-cyan);
  margin-bottom: 8px;
}

/* ── Code tools ── */
.ai-code-tool {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.ai-code-tool textarea,
.ai-code-tool input {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  resize: vertical;
  min-height: 100px;
}

.ai-code-tool textarea:focus,
.ai-code-tool input:focus {
  outline: none;
  border-color: var(--ultra-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15);
}

/* ── Chat enhancements ── */
.ai-chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-msg-bubble {
  animation: bubbleIn 0.35s var(--transition-bounce);
  border-radius: var(--radius-lg) !important;
}

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

.ai-typing-dots span {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ultra-cyan);
  margin: 0 3px;
  animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

/* ── Command palette ── */
.ai-cmd-palette {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.ai-cmd-palette.open {
  opacity: 1;
  pointer-events: all;
}

.ai-cmd-box {
  width: 100%;
  max-width: 560px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transform: scale(0.95) translateY(-10px);
  transition: transform 0.2s;
}

.ai-cmd-palette.open .ai-cmd-box {
  transform: scale(1) translateY(0);
}

.ai-cmd-input {
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--glass-border);
  color: #fff;
  font-size: 1rem;
  font-family: var(--font-sans);
  outline: none;
}

.ai-cmd-list {
  max-height: 320px;
  overflow-y: auto;
}

.ai-cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.15s;
  color: #e2e8f0;
  font-size: 0.9rem;
}

.ai-cmd-item:hover,
.ai-cmd-item.selected {
  background: rgba(0, 212, 170, 0.1);
}

.ai-cmd-item kbd {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 2px 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  font-family: var(--font-mono);
  opacity: 0.6;
}

/* ── Toast notifications ── */
.ai-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.35s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
}

.ai-toast.success { border-left: 3px solid #22c55e; }
.ai-toast.error { border-left: 3px solid #ef4444; }
.ai-toast.info { border-left: 3px solid var(--ultra-cyan); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Section headers ── */
.ai-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.ai-section-title {
  font-family: var(--font-display) !important;
  font-size: 1.75rem !important;
  font-weight: 600 !important;
  letter-spacing: -0.02em;
}

.ai-section-desc {
  font-size: 0.9rem;
  opacity: 0.7;
  margin-top: 4px;
}

/* ── Loading screen v2 ── */
#loading.ai-loading-v2 {
  background: #0a0e1a;
  flex-direction: column;
  gap: 24px;
}

.ai-loader-ring {
  width: 56px;
  height: 56px;
  border: 3px solid rgba(0, 212, 170, 0.15);
  border-top-color: var(--ultra-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.ai-loader-text {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: pulse 2s ease-in-out infinite;
}

.ai-loader-bar {
  width: 200px;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.ai-loader-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ultra-green), var(--ultra-cyan));
  border-radius: 3px;
  animation: loadProgress 1.5s ease-in-out infinite;
}

@keyframes loadProgress {
  0% { width: 0%; margin-left: 0; }
  50% { width: 70%; margin-left: 15%; }
  100% { width: 0%; margin-left: 100%; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* ── AOS overrides ── */
[data-aos] { pointer-events: auto; }

/* ── Scrollbar premium ── */
.ai-app-shell ::-webkit-scrollbar { width: 6px; height: 6px; }
.ai-app-shell ::-webkit-scrollbar-track { background: transparent; }
.ai-app-shell ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}
.ai-app-shell ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 212, 170, 0.3);
}

/* ── Layout primitives ── */
.ai-features-grid {
  padding: 0 0 32px;
}

.ai-quick-card {
  padding: 20px;
  cursor: pointer;
  text-align: center;
  color: var(--ai-text-primary);
  width: 100%;
  border: none;
}

.ai-quick-card-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.ai-dash-metrics-row {
  margin-bottom: 32px;
}

.ai-section-heading {
  color: var(--ai-text-primary);
  margin-bottom: 16px;
  font-size: 1.2rem;
  font-weight: 600;
}

.ai-hero-cta {
  margin-top: 36px;
}

.ai-text-secondary {
  color: var(--ai-text-secondary);
}

.ai-text-accent {
  color: var(--ai-accent);
}

.ai-metric-icon {
  font-size: 1.5rem;
}

/* ── OptCard refinement ── */
.ai-opt-card {
  padding: 28px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: var(--ai-text-primary);
  border: none;
}

.ai-opt-card h3 {
  margin: 0 0 8px;
  font-weight: 600;
  color: var(--ai-text-primary);
}

.ai-opt-card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ai-text-secondary);
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
  .ai-sidebar-desktop { display: none !important; }
  .ai-mobile-header { display: flex; }
  .ai-hero { padding: 32px 16px 48px; }
  .ai-dashboard, .ai-view-content { padding: 20px 16px !important; }
  .ai-hero-stats { gap: 12px; }
  .ai-cmd-palette { padding-top: 10vh; padding-left: 16px; padding-right: 16px; }
  .ai-fab { bottom: 16px; right: 16px; }
}

@media (min-width: 992px) {
  .ai-mobile-header { display: none !important; }
  .ai-sidebar-desktop { display: flex !important; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.ai-reduced-motion * {
  animation: none !important;
  transition: none !important;
}

/* ── High contrast ── */
.ai-high-contrast .ai-card,
.ai-high-contrast .ai-nav-btn {
  border-width: 2px !important;
}

/* ── View content wrapper ── */
.ai-view-content {
  padding: 32px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Floating action button ── */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 88px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ultra-green), var(--ultra-cyan));
  border: none;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 168, 107, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: all var(--transition);
}

.ai-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 30px rgba(0, 168, 107, 0.5);
}

/* ── Status indicators ── */
.ai-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.ai-status-dot.online {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
  animation: statusPulse 2s ease-in-out infinite;
}

.ai-status-dot.offline { background: #ef4444; }

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Page title bar ── */
.ai-page-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.ai-page-subtitle {
  opacity: 0.65;
  font-size: 0.95rem;
  margin-bottom: 28px;
}

/* ── Agent card internals ── */
.ai-agent-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.ai-agent-icon {
  font-size: 2rem;
  line-height: 1;
}

.ai-agent-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.ai-agent-role {
  margin: 0;
  font-size: 0.85rem;
}

.ai-agent-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ── Chat view layout ── */
.ai-chat-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ai-chat-agent-icon {
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

.ai-chat-messages {
  flex: 1;
  overflow: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.ai-chat-empty {
  text-align: center;
  margin: auto;
  padding: 48px 24px;
}

.ai-chat-empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.ai-msg-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.ai-msg-row-user {
  flex-direction: row-reverse;
}

.ai-msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.ai-msg-bubble {
  max-width: 70%;
  padding: 12px 16px;
  line-height: 1.5;
}

.ai-msg-bubble-user {
  border-radius: 16px 16px 4px 16px;
}

.ai-msg-bubble-ai {
  border-radius: 16px 16px 16px 4px;
}

.ai-typing-wrap {
  padding: 12px 16px;
  border-radius: 16px 16px 16px 4px;
  width: fit-content;
  margin-bottom: 16px;
}

.ai-chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--glass-border);
}

.ai-chat-input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.ai-chat-textarea {
  flex: 1;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.95rem;
  resize: none;
  max-height: 150px;
  min-height: 44px;
  font-family: var(--font-sans);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.ai-chat-textarea:focus {
  outline: none;
  border-color: var(--ultra-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.12);
}

.ai-chat-send {
  padding: 12px 20px !important;
  font-size: 0.95rem;
}

/* ── List cards (history, recent) ── */
.ai-list-card {
  width: 100%;
  text-align: left;
  padding: 16px 20px;
  margin-bottom: 10px;
  cursor: pointer;
  color: inherit;
  transition: all var(--transition);
}

.ai-list-card:hover {
  border-color: rgba(0, 212, 170, 0.3) !important;
  transform: translateX(4px);
}

.ai-list-card-title {
  font-weight: 500;
  margin-bottom: 4px;
}

.ai-list-card-meta {
  font-size: 0.85rem;
  opacity: 0.65;
}

/* ── Models / providers grid ── */
.ai-models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.ai-model-card {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  transition: all var(--transition);
}

.ai-model-card:hover {
  border-color: rgba(108, 92, 231, 0.4);
  box-shadow: var(--shadow-glow-purple);
}

.ai-model-card.active {
  border-color: var(--ultra-cyan);
  box-shadow: var(--shadow-glow);
}

.ai-model-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(0, 212, 170, 0.12);
  color: var(--ultra-cyan);
  border: 1px solid rgba(0, 212, 170, 0.25);
  margin-top: 8px;
}

/* ── Gradient border effect ── */
.ai-gradient-border {
  position: relative;
}

.ai-gradient-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--ultra-cyan), var(--ultra-purple));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}

.ai-gradient-border:hover::before {
  opacity: 1;
}

