:root {
  --bg-dark: #090d16;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --bg-card-hover: rgba(25, 34, 54, 0.85);
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --secondary: #a855f7;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background Ambient Glows */
.glow-bg {
  position: fixed;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, rgba(168, 85, 247, 0.12) 40%, transparent 70%);
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* Header */
.app-header {
  padding: 24px 0;
  border-bottom: 1px solid var(--bg-card-border);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 13, 22, 0.85);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-badge {
  font-size: 28px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 10px;
  border-radius: var(--radius-md);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.logo-title {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.gradient-text {
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.header-badges {
  display: flex;
  gap: 10px;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--bg-card-border);
  color: var(--text-muted);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.match-badge {
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.3);
  background: rgba(168, 85, 247, 0.1);
}

/* Pipeline Tracker Section */
.pipeline-tracker-section {
  margin: 32px 0 24px;
}

.pipeline-steps-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 16px 28px;
  backdrop-filter: blur(20px);
}

.pipeline-step-node {
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
}

.step-icon {
  font-size: 20px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--bg-card-border);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.step-info {
  display: flex;
  flex-direction: column;
}

.step-num {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  font-weight: 600;
}

.step-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.step-status {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  font-weight: 500;
}

.pipeline-step-node.active .step-icon {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-color: var(--primary);
  box-shadow: 0 0 16px var(--primary-glow);
}

.pipeline-step-node.active .step-status {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.pipeline-step-node.completed .step-icon {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-emerald);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.pipeline-step-node.completed .step-status {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.pipeline-connector {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 18px;
  position: relative;
  transition: all 0.4s ease;
}

.pipeline-connector.active {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  box-shadow: 0 0 8px var(--primary-glow);
}

/* Layout Grid */
.app-layout-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 24px;
  margin-bottom: 48px;
}

@media (max-width: 1024px) {
  .app-layout-grid {
    grid-template-columns: 1fr;
  }
}

/* Glass Cards */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-glow);
}

.card-header h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.card-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Presets */
.presets-container {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--bg-card-border);
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 10px;
}

.preset-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--bg-card-border);
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.preset-btn:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--text-main);
  transform: translateY(-1px);
}

/* Form Controls */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.required {
  color: var(--accent-rose);
}

.form-textarea,
.form-select,
.form-input {
  width: 100%;
  background: rgba(10, 15, 26, 0.6);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 14px;
  transition: all 0.2s ease;
  outline: none;
}

.form-textarea:focus,
.form-select:focus,
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.helper-text {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

.form-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-range {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
  margin-top: 8px;
}

.budget-display-value {
  color: var(--accent-emerald);
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Buttons */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
  transition: all 0.25s ease;
  margin-top: 10px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(99, 102, 241, 0.5);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Output Card & Tabs */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--bg-card-border);
  margin-bottom: 24px;
}

.results-title-group h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
}

.results-title-group p {
  font-size: 13px;
  color: var(--text-muted);
}

.results-actions-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.export-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-card-border);
}

.export-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.export-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #fff;
  border-color: rgba(99, 102, 241, 0.4);
}

.export-btn:active {
  transform: scale(0.96);
}

.tabs-nav {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-card-border);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: rgba(16, 24, 39, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #f8fafc;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(99, 102, 241, 0.3);
  font-size: 13px;
  font-weight: 500;
  z-index: 1000;
  backdrop-filter: blur(12px);
  animation: slideUp 0.3s ease;
}

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

@media print {
  body {
    background: #fff;
    color: #000;
  }
  .app-header,
  .pipeline-tracker-section,
  .input-card,
  .results-header,
  .app-footer {
    display: none !important;
  }
  .app-layout-grid {
    display: block !important;
  }
  .output-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .markdown-content {
    color: #111 !important;
  }
  .markdown-content h1,
  .markdown-content h2,
  .markdown-content h3 {
    color: #111 !important;
  }
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

/* States */
.state-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 20px;
}

.placeholder-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.state-placeholder h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.state-placeholder p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 440px;
}

/* Loader */
.loader-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-bar-container {
  width: 100%;
  max-width: 320px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  margin-top: 20px;
  overflow: hidden;
}

.progress-bar-fill {
  width: 30%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 9999px;
  animation: progressPulse 2.5s infinite ease-in-out;
}

@keyframes progressPulse {
  0% { transform: translateX(-100%); width: 40%; }
  50% { width: 60%; }
  100% { transform: translateX(250%); width: 40%; }
}

/* Markdown Content Styling */
.markdown-content {
  font-size: 14.5px;
  color: var(--text-main);
  line-height: 1.7;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  font-family: var(--font-heading);
  margin-top: 22px;
  margin-bottom: 12px;
  color: #fff;
}

.markdown-content h1 {
  font-size: 22px;
  border-bottom: 1px solid var(--bg-card-border);
  padding-bottom: 8px;
}

.markdown-content h2 {
  font-size: 18px;
  color: #818cf8;
}

.markdown-content h3 {
  font-size: 16px;
  color: #c084fc;
}

.markdown-content p {
  margin-bottom: 14px;
}

.markdown-content ul,
.markdown-content ol {
  margin-left: 20px;
  margin-bottom: 16px;
}

.markdown-content li {
  margin-bottom: 6px;
}

.markdown-content strong {
  color: #e2e8f0;
}

.markdown-content hr {
  border: none;
  height: 1px;
  background: var(--bg-card-border);
  margin: 24px 0;
}

.markdown-content blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--bg-card-border);
  padding: 24px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.hidden {
  display: none !important;
}
