/* DataFlow AI — Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #3366ff;
  --brand-light: #6090ff;
  --brand-focus-shadow: 0 0 0 3px rgba(51,102,255,0.2);
  --base-font-size: 14px;
  --surface-950: #080e16;
  --surface-900: #111f2d;
  --surface-800: #1e3042;
  --surface-700: #334a5e;
  --surface-600: #475c72;
  --surface-400: #98aabf;
  --surface-200: #e8eef5;
  --text-primary: #f0f6ff;
  --text-secondary: #94a3b8;
  --border: rgba(255,255,255,0.08);
  --border-active: rgba(51,102,255,0.5);
  --glass: rgba(255,255,255,0.04);
  --glass-hover: rgba(255,255,255,0.07);
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #06b6d4;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--surface-950);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface-900); }
::-webkit-scrollbar-thumb { background: var(--surface-600); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-400); }

/* Glass Card */
.glass-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}
.glass-card:hover { background: var(--glass-hover); border-color: rgba(255,255,255,0.12); }

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, #6090ff 0%, #a78bfa 50%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Glow Effects */
.glow-brand { box-shadow: 0 0 30px rgba(51,102,255,0.3), 0 0 60px rgba(51,102,255,0.1); }
.glow-success { box-shadow: 0 0 20px rgba(16,185,129,0.3); }
.glow-text { text-shadow: 0 0 30px rgba(96,144,255,0.8); }

/* Sidebar */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--surface-900) 0%, var(--surface-950) 100%);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
}

.sidebar-logo {
  background: linear-gradient(135deg, #3366ff 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.03em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  margin: 2px 0;
  text-decoration: none;
}
.nav-item:hover { background: var(--glass-hover); color: var(--text-primary); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(51,102,255,0.2) 0%, rgba(124,58,237,0.1) 100%);
  color: #fff;
  border: 1px solid rgba(51,102,255,0.3);
}
.nav-item.active .nav-icon { color: var(--brand-light); }

/* Main Content */
.main-content {
  margin-left: 260px;
  min-height: 100vh;
  padding: 0;
}

/* Header */
.topbar {
  height: 64px;
  background: rgba(8,14,22,0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Page Container */
.page-container { padding: 32px; }

/* Stat Card */
.stat-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), #7c3aed);
  opacity: 0;
  transition: opacity 0.2s;
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover { background: var(--glass-hover); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }

/* Button Styles */
.btn-primary {
  background: linear-gradient(135deg, #3366ff 0%, #5244e5 100%);
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.01em;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(51,102,255,0.4); opacity: 0.95; }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--glass);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-secondary:hover { background: var(--glass-hover); border-color: rgba(255,255,255,0.15); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-ghost:hover { background: var(--glass); color: var(--text-primary); }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-blue { background: rgba(51,102,255,0.15); color: #93b3ff; border: 1px solid rgba(51,102,255,0.2); }
.badge-green { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.2); }
.badge-yellow { background: rgba(245,158,11,0.15); color: #fcd34d; border: 1px solid rgba(245,158,11,0.2); }
.badge-red { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.2); }
.badge-purple { background: rgba(139,92,246,0.15); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.2); }
.badge-cyan { background: rgba(6,182,212,0.15); color: #67e8f9; border: 1px solid rgba(6,182,212,0.2); }

/* Input */
.input-field {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
  width: 100%;
}
.input-field:focus { border-color: var(--brand); background: rgba(51,102,255,0.05); box-shadow: var(--brand-focus-shadow); }
.input-field::placeholder { color: var(--surface-600); }

/* Textarea */
.textarea-field {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
  width: 100%;
  resize: vertical;
  font-family: inherit;
  line-height: 1.6;
}
.textarea-field:focus { border-color: var(--brand); background: rgba(51,102,255,0.04); box-shadow: 0 0 0 3px rgba(51,102,255,0.1); }
.textarea-field::placeholder { color: var(--surface-600); }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px 16px;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.data-table tr:last-child td { border-bottom: none; }

/* Toggle */
.ai-toggle {
  display: flex;
  background: var(--surface-900);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.ai-toggle-option {
  flex: 1;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  border: none;
  background: transparent;
  color: var(--text-secondary);
}
.ai-toggle-option.active {
  background: linear-gradient(135deg, #3366ff, #7c3aed);
  color: white;
  box-shadow: 0 4px 14px rgba(51,102,255,0.3);
}

/* Progress Bar */
.progress-bar {
  height: 4px;
  background: var(--surface-800);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3366ff, #7c3aed);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.16,1,0.3,1);
}

/* Streaming Animation */
.streaming-cursor::after {
  content: '▊';
  animation: blink 0.8s step-end infinite;
  color: var(--brand-light);
  margin-left: 2px;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* Chart container */
.chart-container { width: 100%; border-radius: 12px; overflow: hidden; }

/* Node (ETL) */
.etl-node {
  background: var(--surface-900);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  cursor: grab;
  transition: all 0.2s;
  min-width: 160px;
  position: absolute;
  user-select: none;
}
.etl-node:hover { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(51,102,255,0.2); }
.etl-node.active { border-color: var(--brand); background: rgba(51,102,255,0.08); }

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}
.tooltip .tooltip-text {
  visibility: hidden;
  opacity: 0;
  background: var(--surface-800);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  transition: all 0.15s;
  z-index: 999;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.tooltip:hover .tooltip-text { visibility: visible; opacity: 1; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-content {
  background: var(--surface-900);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  max-width: 560px;
  width: 90%;
  animation: slideUp 0.3s cubic-bezier(0.16,1,0.3,1);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--surface-800) 25%, var(--surface-700) 50%, var(--surface-800) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Login Page */
.login-bg {
  background: radial-gradient(ellipse at 20% 50%, rgba(51,102,255,0.15) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 50%, rgba(124,58,237,0.1) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 0%, rgba(16,185,129,0.05) 0%, transparent 50%),
              var(--surface-950);
}

/* Grid pattern */
.grid-bg {
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* Dashboard card */
.dashboard-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.25s ease;
  cursor: pointer;
}
.dashboard-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  border-color: rgba(51,102,255,0.25);
}
.dashboard-card-preview {
  height: 140px;
  background: var(--surface-900);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Prompt templates */
.template-chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-secondary);
  white-space: nowrap;
}
.template-chip:hover { background: rgba(51,102,255,0.15); border-color: rgba(51,102,255,0.3); color: var(--text-primary); }

/* Animated gradient border */
.gradient-border {
  position: relative;
  border-radius: 16px;
}
.gradient-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  background: linear-gradient(135deg, #3366ff, #7c3aed, #34d399, #3366ff);
  background-size: 200% 200%;
  animation: gradientMove 4s linear infinite;
  z-index: -1;
}
@keyframes gradientMove { 0% { background-position: 0% 0%; } 100% { background-position: 200% 200%; } }

/* Notification dot */
.notif-dot {
  width: 8px; height: 8px;
  background: var(--brand);
  border-radius: 50%;
  position: absolute;
  top: 2px; right: 2px;
  box-shadow: 0 0 0 2px var(--surface-950);
}
.notif-dot.pulse { animation: pulse-ring 1.5s cubic-bezier(0.4,0,0.6,1) infinite; }
@keyframes pulse-ring { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.5); } }

/* Separator */
.separator {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* Range slider */
input[type='range'] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--surface-700);
  border-radius: 2px;
  outline: none;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: var(--brand);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(51,102,255,0.2);
  transition: box-shadow 0.15s;
}
input[type='range']::-webkit-slider-thumb:hover { box-shadow: 0 0 0 5px rgba(51,102,255,0.3); }

/* Responsive */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

/* Animation utilities */
.animate-fade-in { animation: fadeIn 0.3s ease-out; }
.animate-slide-up { animation: slideUp 0.4s cubic-bezier(0.16,1,0.3,1); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Status indicator */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-active { background: var(--success); box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.status-draft { background: var(--surface-600); }
.status-processing { background: var(--info); animation: pulse-ring 1.5s infinite; }
.status-error { background: var(--error); }
