/* ==========================================================================
   IdeaScientist-SocSci - Style System
   Theme: Algorithmic Dark Slate & Emerald Sage
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Schibsted+Grotesk:wght@400;500;600;700&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,600;1,9..144,400&family=IBM+Plex+Mono:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  --bg-color: #0b1120;
  --surface-color: #131d31;
  --surface-hover: #1c2b46;
  --surface-accent: #1e293b;
  --border-color: #24344d;
  --border-highlight: #3b5072;
  
  --primary-color: #f8fafc;
  --text-heading: #f1f5f9;
  --text-main: #94a3b8;
  --text-muted: #64748b;
  
  --accent-color: #10b981;        /* Emerald / Sage Green */
  --accent-hover: #059669;
  --accent-glow: rgba(16, 185, 129, 0.18);
  --accent-cyan: #06b6d4;
  --accent-purple: #a855f7;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Schibsted Grotesk', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', Consolas, monospace;

  --container-width: 1140px;
  --header-height: 80px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px var(--accent-glow);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.65;
  padding-top: var(--header-height);
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--text-heading);
  line-height: 1.2;
}

h1 { font-size: 2.8rem; letter-spacing: -0.02em; margin-bottom: 0.75rem; }
h2 { font-size: 1.8rem; margin-bottom: 1rem; }
h3 { font-size: 1.35rem; margin-bottom: 0.5rem; }
p { margin-bottom: 1rem; }

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--primary-color);
}

.mono { font-family: var(--font-mono); }
.italic { font-style: italic; }

/* Container */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(11, 17, 32, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  display: flex;
  align-items: center;
}

header .header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--primary-color);
}

.brand-title span {
  color: var(--accent-color);
  font-style: italic;
}

.badge-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-color);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-full);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-pill {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-pill:hover {
  background: var(--surface-hover);
  color: var(--primary-color);
  border-color: var(--accent-color);
}

.btn-pill.btn-accent {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.active {
  background: var(--accent-color);
  box-shadow: 0 0 8px var(--accent-color);
}

/* Hero Section */
.hero-section {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-main);
  max-width: 880px;
  line-height: 1.7;
}

.hero-subtitle strong {
  color: var(--text-heading);
}

/* Presets Bar */
.presets-section {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-color);
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.preset-card {
  background: rgba(11, 17, 32, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.preset-card:hover {
  background: var(--surface-hover);
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

.preset-card.active {
  border-color: var(--accent-color);
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.1);
}

.preset-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.preset-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.preset-models {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.model-chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--border-color);
  color: var(--text-main);
}

/* Problem Input Area */
.input-workspace {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-heading);
  margin-bottom: 0.4rem;
}

.form-group textarea,
.form-group input {
  width: 100%;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  color: var(--primary-color);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.5;
  transition: border-color 0.2s ease;
}

.form-group textarea:focus,
.form-group input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.launcher-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.btn-primary {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  background: var(--accent-color);
  color: #041f16;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-primary:hover {
  background: #34d399;
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  background: var(--surface-hover);
  color: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--text-main);
}

/* Stepper Pipeline Visualizer */
.pipeline-section {
  margin-bottom: 2.5rem;
}

.pipeline-stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.step-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.9rem 0.8rem;
  position: relative;
  transition: all 0.2s ease;
  cursor: pointer;
}

.step-card.active {
  border-color: var(--accent-color);
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.step-card.completed {
  border-color: var(--accent-cyan);
}

.step-card.running {
  border-color: var(--accent-amber);
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.step-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.step-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.3;
}

.step-status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Artifact Workspace Tabs */
.artifact-workspace {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 3rem;
}

.workspace-header {
  background: rgba(11, 17, 32, 0.7);
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.artifact-tabs {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
}

.tab-btn {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 0.5rem 0.9rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-heading);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: var(--accent-color);
  background: var(--surface-color);
  font-weight: 600;
}

.workspace-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--surface-hover);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background: var(--border-highlight);
  color: var(--primary-color);
}

.artifact-content {
  padding: 2rem;
  max-height: 680px;
  overflow-y: auto;
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.7;
}

/* Markdown Rendering in Artifact */
.artifact-content h1 { font-size: 1.8rem; color: var(--primary-color); margin-top: 1rem; margin-bottom: 0.75rem; }
.artifact-content h2 { font-size: 1.4rem; color: var(--accent-color); margin-top: 1.5rem; margin-bottom: 0.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.35rem; }
.artifact-content h3 { font-size: 1.15rem; color: var(--text-heading); margin-top: 1.25rem; }
.artifact-content h4 { font-size: 1rem; color: var(--text-heading); font-family: var(--font-body); font-weight: 600; margin-top: 1rem; }
.artifact-content ul, .artifact-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.artifact-content li { margin-bottom: 0.35rem; }
.artifact-content blockquote {
  border-left: 3px solid var(--accent-color);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-style: italic;
}
.artifact-content code {
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-size: 0.88em;
  color: #38bdf8;
}
.artifact-content pre {
  background: rgba(0, 0, 0, 0.4);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border-color);
}
.artifact-content pre code {
  background: none;
  padding: 0;
  color: #e2e8f0;
}
.artifact-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 1.75rem 0;
}

/* Latticework Drawer / Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(4, 8, 16, 0.85);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 860px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover { color: var(--primary-color); }

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--primary-color);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.category-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.cat-pill {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--surface-hover);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
}

.cat-pill.active {
  background: var(--accent-color);
  color: #041f16;
  border-color: var(--accent-color);
  font-weight: 600;
}

.models-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.model-entry {
  background: rgba(11, 17, 32, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  transition: all 0.15s ease;
}

.model-entry:hover {
  border-color: var(--border-highlight);
  background: var(--surface-hover);
}

.model-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.model-entry-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
}

.model-entry-disc {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-cyan);
}

.model-entry-essence {
  font-size: 0.88rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.model-entry-social {
  font-size: 0.85rem;
  color: #38bdf8;
  background: rgba(6, 182, 212, 0.08);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  border-left: 3px solid var(--accent-cyan);
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--surface-color);
  border: 1px solid var(--accent-color);
  color: var(--primary-color);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s ease;
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .pipeline-stepper {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  h1 {
    font-size: 2.2rem;
  }
}
