/* ═══════════════════════════════════════════════════════════
   DataViz AI — Analytics Dashboard Stylesheet
   Aesthetic: Dark Data-Intelligence (Bloomberg meets SaaS)
   Fonts: Space Mono (data) + DM Sans (UI)
   ═══════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────── */
:root {
  --bg-base:      #0d0f17;
  --bg-surface:   #12151f;
  --bg-elevated:  #1a1d2e;
  --bg-hover:     #1e2338;

  --border:       #1e2235;
  --border-light: #252a3d;

  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #4a5568;
  --text-data:      #cbd5e0;

  --accent:         #00e5ff;
  --accent-dim:     rgba(0, 229, 255, 0.12);
  --accent-glow:    rgba(0, 229, 255, 0.3);

  --purple:         #7c4dff;
  --green:          #10b981;
  --red:            #ef4444;
  --yellow:         #f59e0b;

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;

  --font-ui:   'DM Sans', system-ui, sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --topbar-h:  58px;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* ── App Shell ─────────────────────────────────────────── */
.adv-app {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
}

/* Subtle grid texture overlay */
.adv-app::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

/* ═══════════════════════════════════════════════════════════
   PHASE 1 — INPUT PANEL
   ═══════════════════════════════════════════════════════════ */

.adv-input-panel {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

/* Radial glow behind panel */
.adv-input-panel::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(0,229,255,0.05) 0%, transparent 65%),
              radial-gradient(circle at 30% 70%, rgba(124,77,255,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
}

.adv-input-inner {
  width: 100%;
  max-width: 640px;
  position: relative;
}

/* Brand */
.adv-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 36px;
}
.adv-brand.small { margin-bottom: 0; }
.adv-brand-icon {
  font-size: 22px;
  color: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
.adv-brand-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.adv-brand-name em {
  font-style: normal;
  color: var(--accent);
}
.adv-brand.small .adv-brand-icon { font-size: 16px; }
.adv-brand.small .adv-brand-name { font-size: 14px; }

/* Hero */
.adv-hero-title {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.adv-gradient-text {
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.adv-hero-sub {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 36px;
  font-weight: 300;
}

/* Tabs */
.adv-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 20px;
  width: fit-content;
}

.adv-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: none;
  border-radius: calc(var(--radius-md) - 3px);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.adv-tab.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.adv-tab:hover:not(.active) { color: var(--text-primary); }

/* Tab Content */
.adv-tab-content { display: none; }
.adv-tab-content.active { display: block; }

/* URL Input */
.adv-url-input-wrap {
  position: relative;
  margin-bottom: 10px;
}

.adv-url-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition);
}

.adv-url-input {
  width: 100%;
  padding: 16px 16px 16px 48px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.adv-url-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.adv-url-input:focus + .adv-url-icon { color: var(--accent); }
.adv-url-input::placeholder { color: var(--text-muted); }

/* URL Examples */
.adv-url-examples {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.adv-url-examples span {
  font-size: 12px;
  color: var(--text-muted);
}

.adv-example-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all var(--transition);
}
.adv-example-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Textarea */
.adv-textarea {
  width: 100%;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.adv-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.adv-textarea::placeholder { color: var(--text-muted); font-family: var(--font-ui); font-size: 13px; }

/* CTA Button */
.adv-action-row {
  margin-top: 20px;
}

.adv-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 28px;
  background: linear-gradient(135deg, var(--accent) 0%, #0091ea 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #0d0f17;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.adv-cta-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}
.adv-cta-btn:hover::before { opacity: 1; }
.adv-cta-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px var(--accent-glow); }
.adv-cta-btn:active { transform: translateY(0); }
.adv-cta-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Error Box */
.adv-error-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: #fca5a5;
  animation: adv-slide-in 0.3s ease;
}
.adv-error-box[hidden] { display: none; }
.adv-error-box svg { flex-shrink: 0; margin-top: 1px; }

.adv-error-switch {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
}

/* Loading State */
.adv-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 28px;
  padding: 24px;
}
.adv-loading[hidden] { display: none; }

.adv-loading-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 32px;
}
.adv-loading-bars span {
  display: block;
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  animation: adv-bar-bounce 1.2s ease-in-out infinite;
}
.adv-loading-bars span:nth-child(1) { height: 12px; animation-delay: 0s; }
.adv-loading-bars span:nth-child(2) { height: 24px; animation-delay: 0.1s; }
.adv-loading-bars span:nth-child(3) { height: 18px; animation-delay: 0.2s; }
.adv-loading-bars span:nth-child(4) { height: 30px; animation-delay: 0.3s; }
.adv-loading-bars span:nth-child(5) { height: 14px; animation-delay: 0.4s; }

.adv-loading-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.05em;
  animation: adv-pulse 1.5s ease infinite;
}

@keyframes adv-bar-bounce {
  0%, 100% { transform: scaleY(0.5); opacity: 0.4; }
  50%       { transform: scaleY(1);   opacity: 1; }
}
@keyframes adv-pulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}
@keyframes adv-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ═══════════════════════════════════════════════════════════
   DASHBOARD LAYOUT
   ═══════════════════════════════════════════════════════════ */

.adv-dashboard {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.adv-dashboard[hidden] { display: none; }

/* ── Topbar ─────────────────────────────────────────────── */
.adv-topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow-x: auto;
  scrollbar-width: none;
}
.adv-topbar::-webkit-scrollbar { display: none; }

.adv-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.adv-topbar-center {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.adv-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.adv-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.adv-back-btn:hover { color: var(--text-primary); border-color: var(--border-light); }

.adv-dataset-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Chart Type Switcher */
.adv-chart-switcher {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  overflow-x: auto;
  scrollbar-width: none;
}
.adv-chart-switcher::-webkit-scrollbar { display: none; }

.adv-chart-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 5px 10px;
  border: none;
  border-radius: calc(var(--radius-md) - 2px);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all var(--transition);
  min-width: 52px;
}
.adv-chart-type-btn span { font-size: 16px; line-height: 1; }
.adv-chart-type-btn small { font-size: 9px; letter-spacing: 0.04em; font-weight: 500; }

.adv-chart-type-btn.active {
  background: var(--bg-surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.adv-chart-type-btn:hover:not(.active) { color: var(--text-primary); }

/* Icon Buttons */
.adv-icon-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.adv-icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.adv-icon-btn.small {
  padding: 5px 10px;
  font-size: 12px;
}


/* ── Dashboard Body ─────────────────────────────────────── */
.adv-dashboard-body {
  display: grid;
  grid-template-columns: 1fr 360px;
  flex: 1;
  min-height: 0;
}

.adv-main-col {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Summary Cards ──────────────────────────────────────── */
.adv-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.adv-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: border-color var(--transition);
}
.adv-stat-card:hover { border-color: var(--border-light); }

.adv-stat-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.adv-stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.adv-stat-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.adv-stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  margin-top: 6px;
}
.adv-stat-badge.up   { background: rgba(16,185,129,0.12); color: #10b981; }
.adv-stat-badge.down { background: rgba(239,68,68,0.12);  color: #ef4444; }
.adv-stat-badge.flat { background: rgba(148,163,184,0.12); color: #94a3b8; }

/* ── Chart Wrapper ──────────────────────────────────────── */
.adv-chart-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.adv-chart-header {
  padding: 16px 20px 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.adv-chart-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.adv-chart-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.adv-chart-canvas {
  width: 100%;
  height: 420px;
  padding: 16px;
}

/* ── Data Table ─────────────────────────────────────────── */
.adv-table-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.adv-table-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.adv-table-header h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}
.adv-table-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
}

.adv-data-table {
  padding: 16px;
}

/* Handsontable overrides */
.adv-data-table .handsontable {
  font-family: var(--font-mono) !important;
  font-size: 12px !important;
  color: var(--text-data) !important;
}
.adv-data-table .handsontable th {
  background: var(--bg-elevated) !important;
  color: var(--text-secondary) !important;
  border-color: var(--border) !important;
  font-size: 11px !important;
}
.adv-data-table .handsontable td {
  background: transparent !important;
  border-color: var(--border) !important;
  color: var(--text-data) !important;
}
.adv-data-table .handsontable td.current {
  background: var(--accent-dim) !important;
}
.adv-data-table .handsontable .ht_master .wtHolder {
  overflow: auto !important;
}


/* ═══════════════════════════════════════════════════════════
   PHASE 4 — AI CHAT PANEL
   ═══════════════════════════════════════════════════════════ */

.adv-chat-col {
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h));
  position: sticky;
  top: var(--topbar-h);
  overflow: hidden;
  transition: transform var(--transition), width var(--transition);
}
.adv-chat-col.collapsed {
  width: 0;
  overflow: hidden;
}

.adv-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.adv-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #0d0f17;
  flex-shrink: 0;
}

.adv-chat-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.adv-chat-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}

.adv-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: adv-blink 2s ease infinite;
}
@keyframes adv-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.adv-chat-collapse {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition);
}
.adv-chat-collapse:hover { color: var(--text-primary); }

/* Chat Messages */
.adv-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.adv-chat-msg {
  display: flex;
  max-width: 100%;
}
.adv-chat-msg.user { justify-content: flex-end; }
.adv-chat-msg.assistant { justify-content: flex-start; }

.adv-chat-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.6;
  max-width: 88%;
  animation: adv-slide-in 0.2s ease;
}
.adv-chat-msg.user .adv-chat-bubble {
  background: linear-gradient(135deg, var(--accent), #0091ea);
  color: #0d0f17;
  border-bottom-right-radius: 3px;
}
.adv-chat-msg.assistant .adv-chat-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 3px;
}
.adv-chat-bubble ul {
  margin: 8px 0 0 16px;
  color: var(--text-secondary);
}
.adv-chat-bubble ul li { margin-bottom: 3px; }

/* Typing indicator */
.adv-chat-typing .adv-chat-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px;
}
.adv-typing-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); opacity: 0.4;
  animation: adv-typing 1.2s ease infinite;
}
.adv-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.adv-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes adv-typing {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  50%       { opacity: 1;   transform: translateY(-4px); }
}

/* Quick Prompts */
.adv-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.adv-prompt-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all var(--transition);
  white-space: nowrap;
}
.adv-prompt-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Chat Input */
.adv-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.adv-chat-input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  resize: none;
  outline: none;
  transition: border-color var(--transition);
  line-height: 1.5;
}
.adv-chat-input:focus { border-color: var(--accent); }
.adv-chat-input::placeholder { color: var(--text-muted); }

.adv-chat-send {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: #0d0f17;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  align-self: flex-end;
}
.adv-chat-send:hover { background: #26f0ff; box-shadow: 0 4px 12px var(--accent-glow); }
.adv-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }


/* ═══════════════════════════════════════════════════════════
   PHASE 5 — EMBED MODAL
   ═══════════════════════════════════════════════════════════ */

.adv-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: adv-fade-in 0.2s ease;
}
.adv-modal-overlay[hidden] { display: none; }

@keyframes adv-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.adv-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  animation: adv-modal-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes adv-modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.adv-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.adv-modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.adv-modal-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition);
}
.adv-modal-close:hover { color: var(--text-primary); border-color: var(--border-light); }

.adv-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.adv-modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.adv-embed-preview {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.adv-embed-preview iframe {
  border: none;
  pointer-events: none;
}

.adv-embed-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.adv-code-block {
  position: relative;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  overflow-x: auto;
}

.adv-code-block pre {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  line-height: 1.7;
}

.adv-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 11px;
  cursor: pointer;
  transition: all var(--transition);
}
.adv-copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.adv-copy-btn.copied { color: var(--green); border-color: var(--green); }

.adv-embed-sizes {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.adv-embed-sizes span {
  font-size: 12px;
  color: var(--text-muted);
}
.adv-size-btn {
  padding: 5px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all var(--transition);
}
.adv-size-btn.active { border-color: var(--accent); color: var(--accent); }
.adv-size-btn:hover { border-color: var(--border-light); color: var(--text-primary); }


/* ═══════════════════════════════════════════════════════════
   AI NOTE BADGE
   ═══════════════════════════════════════════════════════════ */
.adv-ai-note {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  color: #fbbf24;
  margin-top: 8px;
}


/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  .adv-dashboard-body {
    grid-template-columns: 1fr;
  }
  .adv-chat-col {
    position: static;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 480px;
  }
}

@media (max-width: 768px) {
  .adv-topbar-center { display: none; }
  .adv-chart-canvas { height: 300px; }
  .adv-summary-cards { grid-template-columns: repeat(2, 1fr); }
  .adv-dataset-title { display: none; }
  .adv-icon-btn span { display: none; }
}

@media (max-width: 480px) {
  .adv-hero-title { font-size: 28px; }
  .adv-main-col { padding: 16px; }
  .adv-summary-cards { grid-template-columns: 1fr 1fr; }
}


/* ═══════════════════════════════════════════════════════════
   SCROLLBARS
   ═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
