:root {
  color-scheme: light;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background-color: #f5f7fb;
  color: #1b1f3b;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f5f7fb 0%, #ffffff 100%);
}

header {
  background-color: #1b1f3b;
  color: #f9fbff;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

header h1 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
}

header p {
  margin: 0;
  font-size: 1rem;
  opacity: 0.8;
}

main {
  max-width: 960px;
  margin: 2.5rem auto;
  padding: 0 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

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

.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 8px 24px rgba(27, 31, 59, 0.08);
  border: 1px solid rgba(27, 31, 59, 0.08);
}

.card h2 {
  margin-top: 0;
  font-size: 1.25rem;
  color: #22306b;
}

.tests {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 8px 24px rgba(27, 31, 59, 0.08);
  border: 1px solid rgba(27, 31, 59, 0.08);
}

.sentiment-demo {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: 0 8px 24px rgba(27, 31, 59, 0.08);
  border: 1px solid rgba(27, 31, 59, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sentiment-demo__header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  color: #22306b;
}

.sentiment-demo__header p {
  margin: 0;
  color: #4b5563;
}

.sentiment-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: #374151;
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(27, 31, 59, 0.18);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  background-color: #f8f9ff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: #4c51bf;
  box-shadow: 0 0 0 3px rgba(76, 81, 191, 0.12);
}

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

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button-primary,
.button-secondary {
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.2s ease;
}

.button-primary {
  background: linear-gradient(135deg, #4c51bf, #6366f1);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.3);
}

.button-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(99, 102, 241, 0.35);
}

.button-secondary {
  background: #e0e7ff;
  color: #3730a3;
}

.button-secondary:hover {
  background: #c7d2fe;
}

.sentiment-lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.sentiment-list,
.sentiment-results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sentiment-posts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sentiment-post-card {
  background: #f8faff;
  border-radius: 12px;
  border: 1px solid rgba(27, 31, 59, 0.12);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sentiment-post-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.sentiment-post-card__title {
  font-weight: 600;
  color: #1b1f3b;
}

.sentiment-post-card__text {
  margin: 0;
  color: #374151;
  white-space: pre-wrap;
}

.sentiment-remove {
  border: none;
  background: transparent;
  color: #ef4444;
  font-weight: 600;
  cursor: pointer;
}

.sentiment-remove:hover {
  text-decoration: underline;
}

.sentiment-empty,
.sentiment-empty-result {
  margin: 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.sentiment-results-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.sentiment-result-card {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 1rem 1.1rem;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sentiment-result-card[data-sentiment="bullish"] {
  border-color: rgba(34, 197, 94, 0.3);
  background: #ecfdf5;
}

.sentiment-result-card[data-sentiment="bearish"] {
  border-color: rgba(248, 113, 113, 0.35);
  background: #fef2f2;
}

.sentiment-result-card[data-sentiment="neutral"] {
  border-color: rgba(148, 163, 184, 0.3);
  background: #f8fafc;
}

.sentiment-badge {
  align-self: flex-start;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  background: #1d4ed8;
  color: #f8fafc;
}

.sentiment-summary {
  margin: 0;
  font-size: 0.95rem;
  color: #1f2937;
}

.sentiment-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: #4b5563;
}

.sentiment-tickers {
  margin: 0;
  font-size: 0.85rem;
  color: #1f2937;
}

.sentiment-raw summary {
  cursor: pointer;
  font-weight: 600;
  color: #1d4ed8;
}

.sentiment-raw pre {
  margin: 0.5rem 0 0;
  white-space: pre-wrap;
  font-size: 0.85rem;
  background: rgba(15, 23, 42, 0.04);
  padding: 0.75rem;
  border-radius: 10px;
}

.sentiment-spinner {
  font-size: 0.9rem;
  color: #4c51bf;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.module-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  border-radius: 14px;
  border: 1px solid rgba(27, 31, 59, 0.12);
  background: #f8faff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
}

.module-card[data-status="success"] {
  border-color: rgba(22, 163, 74, 0.25);
  background: #ecfdf5;
}

.module-card[data-status="skipped"] {
  border-color: rgba(217, 119, 6, 0.25);
  background: #fffbeb;
}

.module-card[data-status="error"] {
  border-color: rgba(220, 38, 38, 0.3);
  background: #fef2f2;
}

.module-card[data-status="unknown"] {
  border-color: rgba(148, 163, 184, 0.3);
  background: #f8fafc;
}

.module-card[data-status="pending"] {
  border-color: rgba(99, 102, 241, 0.25);
  background: #eef2ff;
}

.module-icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff;
  background: #4c51bf;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.module-icon--x {
  background: #101828;
}

.module-icon--reddit {
  background: #ff4500;
}

.module-icon--xai {
  background: #1d4ed8;
}

.module-info {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.module-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #1b1f3b;
}

.module-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(99, 102, 241, 0.12);
  color: #3730a3;
}

.module-card[data-status="success"] .module-chip {
  background: rgba(34, 197, 94, 0.15);
  color: #166534;
}

.module-card[data-status="skipped"] .module-chip {
  background: rgba(217, 119, 6, 0.15);
  color: #92400e;
}

.module-card[data-status="error"] .module-chip {
  background: rgba(220, 38, 38, 0.15);
  color: #991b1b;
}

.module-card[data-status="unknown"] .module-chip {
  background: rgba(148, 163, 184, 0.2);
  color: #1e293b;
}

.module-description {
  margin: 0;
  font-size: 0.9rem;
  color: #475569;
}

.module-detail {
  margin: 0;
  font-size: 0.85rem;
  color: #1f2937;
}

.module-empty {
  margin: 0;
  font-size: 0.9rem;
  color: #475569;
}

.tests-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.tests button {
  background-color: #5661f6;
  border: none;
  border-radius: 8px;
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.tests button:hover:not(:disabled) {
  background-color: #3943d3;
}

.tests button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem 1.5rem;
  margin: 0 0 1.5rem;
}

.status-grid div {
  background: #f5f7fb;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(27, 31, 59, 0.08);
}

.status-grid dt {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5661f6;
}

.status-grid dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1b1f3b;
}

pre#log-output {
  background: #0f172a;
  color: #f8fafc;
  padding: 1rem;
  border-radius: 8px;
  min-height: 160px;
  max-height: 360px;
  overflow-y: auto;
  font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  max-width: 320px;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  font-weight: 600;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  color: #0f172a;
  background: #e2e8f0;
  z-index: 1000;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-success {
  background: #bbf7d0;
  color: #166534;
}

.toast.toast-warning {
  background: #fde68a;
  color: #854d0e;
}

.toast.toast-error {
  background: #fecaca;
  color: #7f1d1d;
}

.toast.toast-info {
  background: #c7d2fe;
  color: #312e81;
}

@media (max-width: 640px) {
  header {
    padding: 1.5rem 1rem;
  }

  main {
    margin: 1.5rem auto;
    padding: 0 1rem 2rem;
  }

  .module-card {
    flex-direction: column;
    align-items: stretch;
  }

  .module-header {
    align-items: flex-start;
  }
}
