/* ============================================================
   Opsalis Demo Pages — Shared Stylesheet
   Extends ../style.css
   Colors: white #ffffff, dark slate #1e293b, teal #00b894
   ============================================================ */

@import url("../style.css");

/* ---------- Demo Container ---------- */
.demo-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Breadcrumb ---------- */
.demo-breadcrumb {
  padding: 5rem 0 1rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

.demo-breadcrumb a {
  color: #64748b;
  transition: color 0.2s;
}

.demo-breadcrumb a:hover {
  color: #00b894;
}

.demo-breadcrumb span {
  margin: 0 0.5rem;
  color: #cbd5e1;
}

/* ---------- Demo Hero ---------- */
.demo-hero {
  padding: 2rem 0 3.5rem;
  text-align: center;
  background:
    radial-gradient(ellipse 80% 50% at 50% -5%, rgba(0, 184, 148, 0.08) 0%, transparent 70%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.demo-hero h1 {
  font-size: 2.75rem;
  margin-bottom: 1rem;
}

.demo-hero .demo-tagline {
  font-size: 1.15rem;
  color: #64748b;
  max-width: 38rem;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---------- Demo Architecture SVG ---------- */
.demo-architecture {
  padding: 3rem 0;
  text-align: center;
}

.demo-architecture svg {
  max-width: 100%;
  height: auto;
}

.demo-architecture .arch-caption {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 1rem;
}

/* ---------- Business Case ---------- */
.demo-business {
  padding: 3rem 0;
}

.demo-business h2 {
  margin-bottom: 1.25rem;
}

.demo-business p {
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 1rem;
  max-width: 48rem;
}

/* ---------- Interactive Demo ---------- */
.demo-interactive {
  padding: 3rem 0;
}

.demo-interactive h2 {
  margin-bottom: 1.5rem;
}

.demo-interactive-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Form panel */
.demo-form-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.75rem;
}

.demo-form-panel h3 {
  font-size: 1rem;
  margin-bottom: 1.25rem;
  color: #1e293b;
}

.demo-field {
  margin-bottom: 1rem;
}

.demo-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.demo-field input,
.demo-field select,
.demo-field textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #1e293b;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.demo-field textarea {
  font-family: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  min-height: 6rem;
  resize: vertical;
}

.demo-field input:focus,
.demo-field select:focus,
.demo-field textarea:focus {
  border-color: #00b894;
  box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.1);
}

.demo-run-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  background: #00b894;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  margin-top: 0.5rem;
}

.demo-run-btn:hover {
  background: #00a381;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 184, 148, 0.25);
}

.demo-run-btn:active {
  transform: translateY(0);
}

.demo-run-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.demo-run-btn .spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.demo-run-btn.loading .spinner {
  display: inline-block;
}

.demo-run-btn.loading .btn-text {
  opacity: 0.7;
}

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

/* Result panel */
.result-panel {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 1.5rem;
  min-height: 300px;
  overflow: auto;
  max-height: 600px;
}

.result-panel .result-placeholder {
  color: #475569;
  font-size: 0.9rem;
  text-align: center;
  padding: 4rem 1rem;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #1e293b;
}

.latency-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 100px;
  font-family: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.latency-badge.fast {
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.latency-badge.medium {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.latency-badge.slow {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 100px;
  font-family: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

.result-panel pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-panel code {
  font-family: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.82rem;
  color: #e2e8f0;
  line-height: 1.7;
}

.result-error {
  color: #ef4444;
  font-size: 0.9rem;
  padding: 1rem;
}

.result-error .error-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.result-error .error-detail {
  color: #94a3b8;
  font-size: 0.85rem;
}

/* ---------- Code Samples ---------- */
.demo-code {
  padding: 3rem 0;
}

.demo-code h2 {
  margin-bottom: 1.5rem;
}

.code-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0;
}

.code-tab {
  padding: 0.6rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.code-tab:hover {
  color: #1e293b;
}

.code-tab.active {
  color: #00b894;
  border-bottom-color: #00b894;
}

.code-panel {
  display: none;
}

.code-panel.active {
  display: block;
}

.code-panel .code-block {
  border-radius: 0 0 8px 8px;
  margin-top: 0;
  border-top: none;
}

/* ---------- Self-Host Instructions ---------- */
.demo-selfhost {
  padding: 3rem 0;
  border-top: 1px solid #e2e8f0;
}

.demo-selfhost h2 {
  margin-bottom: 1.5rem;
}

.selfhost-steps {
  max-width: 48rem;
}

.selfhost-step {
  position: relative;
  padding-left: 3.5rem;
  padding-bottom: 2.5rem;
}

.selfhost-step:last-child {
  padding-bottom: 0;
}

.selfhost-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 1.125rem;
  top: 2.25rem;
  bottom: 0;
  width: 1px;
  background: rgba(0, 184, 148, 0.2);
}

.selfhost-step-num {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: rgba(0, 184, 148, 0.08);
  color: #00b894;
  font-size: 0.95rem;
  font-weight: 700;
  border: 1px solid rgba(0, 184, 148, 0.2);
}

.selfhost-step h4 {
  margin-bottom: 0.5rem;
  padding-top: 0.15rem;
}

.selfhost-step p {
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 0.5rem;
}

/* ---------- SEO Footer ---------- */
.demo-footer-cta {
  padding: 3rem 0;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

.demo-footer-cta h2 {
  margin-bottom: 1rem;
}

.demo-footer-cta p {
  color: #64748b;
  margin: 0 auto 1.5rem;
  max-width: 36rem;
}

.related-demos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 2rem;
}

.related-demo-link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 100px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.related-demo-link:hover {
  color: #00b894;
  border-color: rgba(0, 184, 148, 0.3);
  background: rgba(0, 184, 148, 0.04);
}

/* ---------- Demo Hub Grid ---------- */
.demo-hub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.demo-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.75rem;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.15s;
  display: flex;
  flex-direction: column;
}

.demo-card:hover {
  border-color: rgba(0, 184, 148, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.demo-card-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: rgba(0, 184, 148, 0.08);
  color: #00b894;
  font-size: 1.25rem;
}

.demo-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: #1e293b;
}

.demo-card p {
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.6;
  flex: 1;
}

.demo-card .demo-card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #00b894;
  transition: gap 0.2s;
}

.demo-card:hover .demo-card-link {
  gap: 0.6rem;
}

/* ---------- Demo Category Section ---------- */
.demo-category {
  margin-bottom: 3rem;
}

.demo-category h2 {
  margin-bottom: 0.5rem;
}

.demo-category .category-desc {
  color: #64748b;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .demo-interactive-layout {
    grid-template-columns: 1fr;
  }

  .demo-hub-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .demo-hero h1 {
    font-size: 2rem;
  }

  .demo-hero .demo-tagline {
    font-size: 1rem;
  }

  .demo-interactive-layout {
    grid-template-columns: 1fr;
  }

  .demo-hub-grid {
    grid-template-columns: 1fr;
  }

  .code-tabs {
    overflow-x: auto;
  }

  .result-panel {
    min-height: 200px;
  }
}

@media (max-width: 480px) {
  .demo-hero h1 {
    font-size: 1.65rem;
  }

  .demo-breadcrumb {
    font-size: 0.8rem;
  }

  .demo-form-panel {
    padding: 1.25rem;
  }

  .result-panel {
    padding: 1rem;
  }

  .selfhost-step {
    padding-left: 2.75rem;
  }
}
