/* Demo widget — homepage + demo pages */

.demo-section {
  border-bottom: 0.5px solid var(--c-border);
}

body.page-home .demo-panel {
  width: 100%;
  margin-top: clamp(1.5rem, 3vw, 2rem);
  padding-top: clamp(1.5rem, 3vw, 2rem);
  border-top: 0.5px solid var(--c-border);
  text-align: left;
}

body.page-home .demo-panel-hidden {
  display: none;
}

body.page-home .demo-panel h2 {
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--c-text-primary);
  margin: 0 0 clamp(0.5rem, 1vw, 1rem);
  text-align: left;
}

body.page-home .demo-panel .hp-section-sub {
  margin-bottom: 0;
}

.demo-widget {
  border: 0.5px solid var(--c-border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 1.5rem;
}

.demo-state {
  padding: 1.5rem;
}

.demo-state-hidden {
  display: none;
}

.demo-input-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-text-tertiary);
  margin-bottom: 0.5rem;
}

.demo-textarea {
  width: 100%;
  font-size: 14px;
  line-height: 1.7;
  color: var(--c-text-primary);
  background: var(--c-bg-subtle);
  border: 0.5px solid var(--c-border);
  border-radius: 8px;
  padding: 0.875rem 1rem;
  resize: vertical;
  font-family: 'Inter', system-ui, sans-serif;
  box-sizing: border-box;
}

.demo-textarea:focus {
  outline: none;
  border-color: var(--c-border-accent);
}

.demo-input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  gap: 1rem;
}

.demo-hint {
  font-size: 12px;
  color: var(--c-text-tertiary);
}

.demo-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--c-btn-bg);
  color: var(--c-btn-text);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  transition: background-color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.demo-btn-primary:hover {
  background: var(--c-btn-bg-hover);
  transform: translateY(-1px);
}

/* Trial CTA: 2 lines inside the blue box (overrides inline-flex + nowrap above) */
.cta-trial .demo-btn-primary {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  white-space: normal !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  color: var(--c-btn-text) !important;
  font-weight: 600;
  line-height: 1.2;
  width: 100%;
  min-height: 0 !important;
  transform: none !important;
}

.cta-trial .demo-btn-primary:hover {
  background: transparent !important;
  transform: none !important;
}

.cta-trial .demo-btn-primary > span:first-child,
.cta-trial .demo-btn-primary .cta-trial-badge {
  display: block;
}

.cta-trial-badge {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.01em;
}

.demo-trust-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--c-text-tertiary);
  margin-top: 0.875rem;
}

.demo-trust-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.demo-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.demo-col-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--c-text-tertiary);
  margin-bottom: 0.5rem;
}

.demo-col-content {
  font-size: 13px;
  line-height: 1.75;
  color: var(--c-text-secondary);
  background: var(--c-bg-subtle);
  border: 0.5px solid var(--c-border);
  border-radius: 8px;
  padding: 0.875rem 1rem;
  min-height: 100px;
}

.token {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  padding: 1px 6px;
  border-radius: 4px;
  margin: 0 1px;
}

.token-person { background: #dbeafe; color: #1e40af; }
.token-org { background: #f3e8ff; color: #6b21a8; }
.token-amount { background: #dcfce7; color: #15803d; }
.token-date { background: #fef3c7; color: #b45309; }
.token-email { background: #f0fdf4; color: #166534; }
.token-phone { background: #f0f9ff; color: #0369a1; }

html:not([data-theme="light"]) .token-person { background: #1e3a5f; color: #93c5fd; }
html:not([data-theme="light"]) .token-org { background: #3b1f5e; color: #d8b4fe; }
html:not([data-theme="light"]) .token-amount { background: #14532d; color: #86efac; }
html:not([data-theme="light"]) .token-date { background: #78350f; color: #fcd34d; }
html:not([data-theme="light"]) .token-email { background: #14532d; color: #86efac; }
html:not([data-theme="light"]) .token-phone { background: #0c4a6e; color: #7dd3fc; }

.demo-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: var(--c-bg-subtle);
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 12px;
  color: var(--c-text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.demo-entity-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-accent);
}

.demo-reveal {
  background: var(--c-bg-subtle);
  border: 0.5px solid var(--c-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}

.demo-reveal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-text-primary);
  margin-bottom: 4px;
}

.demo-reveal-sub {
  font-size: 13px;
  color: var(--c-text-secondary);
  margin-bottom: 1rem;
}

.demo-email-row {
  display: flex;
  gap: 8px;
  margin-bottom: 0.625rem;
}

.demo-email-row input {
  flex: 1;
  font-size: 14px;
  padding: 10px 14px;
  border: 0.5px solid var(--c-border-strong);
  border-radius: 8px;
  background: var(--c-bg);
  color: var(--c-text-primary);
  font-family: 'Inter', system-ui, sans-serif;
}

.demo-email-row input:focus {
  outline: none;
  border-color: var(--c-border-accent);
}

.demo-restart {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--c-text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-top: 0.75rem;
  font-family: 'Inter', system-ui, sans-serif;
}

.demo-restart:hover {
  color: var(--c-text-secondary);
}

.demo-thanks {
  text-align: center;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.demo-thanks-icon {
  font-size: 32px;
  color: var(--c-text-accent);
  line-height: 1;
}

.demo-thanks-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--c-text-primary);
}

.demo-thanks-sub {
  font-size: 14px;
  color: var(--c-text-secondary);
  max-width: 360px;
  line-height: 1.6;
  margin: 0 auto;
}

.demo-full-link {
  text-align: center;
  margin-top: 1rem;
}

/* Demo page */
body.page-demo .demo-page {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3rem) 0 2rem;
}

body.page-demo .demo-page-header,
body.page-demo .demo-page-header h1,
body.page-demo .demo-page-header p,
body.page-demo .demo-page-header .hp-section-label {
  text-align: center;
}

body.page-demo .demo-page-header {
  text-align: center;
  margin-bottom: 2rem;
}

body.page-demo .demo-page-header h1 {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 0.75rem;
  color: var(--c-text-primary);
}

body.page-demo .demo-page-header p {
  font-size: 16px;
  color: var(--c-text-secondary);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

.demo-examples {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.demo-example-label {
  font-size: 13px;
  color: var(--c-text-tertiary);
}

.demo-example-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.demo-example-btn {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border: 0.5px solid var(--c-border-strong);
  border-radius: 20px;
  background: var(--c-bg);
  color: var(--c-text-secondary);
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  transition: all 0.15s ease;
}

.demo-example-btn:hover {
  border-color: var(--c-border-accent);
  color: var(--c-text-accent);
}

.demo-example-btn.active {
  background: var(--c-text-primary);
  color: var(--c-bg);
  border-color: var(--c-text-primary);
}

html:not([data-theme="light"]) .demo-example-btn.active {
  background: var(--c-text-primary);
  color: var(--c-bg);
}

.demo-entities-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 0.5px solid var(--c-border);
}

.demo-entities-section h2 {
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 600;
  color: var(--c-text-primary);
  margin: 0 0 0.5rem;
}

.demo-entities-section > p {
  font-size: 15px;
  color: var(--c-text-secondary);
  margin: 0 0 1.5rem;
}

@media (max-width: 640px) {
  .demo-result-grid {
    grid-template-columns: 1fr;
  }
  .demo-input-footer {
    flex-direction: column;
    align-items: flex-start;
  }
  .demo-email-row {
    flex-direction: column;
  }
  .demo-entity-count {
    margin-left: 0;
    width: 100%;
  }
}
