/* Demo Page Styles
 * Extends design-system theme with demo-specific components
 * Maintains visual consistency with the landing page
 */

/* === Layout === */

.container {
  width: 100%;
  max-width: 1536px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

/* === Demo Hero Section === */

.demo-hero {
  padding: 3rem 0 4rem;
  text-align: center;
  background-color: var(--b-bg-1);
}

.demo-hero-content {
  max-width: 720px;
  margin: 0 auto;
}

.demo-hero h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  color: var(--b-txt);
}

.demo-hero .highlight {
  color: var(--b-accent);
}

.demo-hero .subheadline {
  font-size: var(--text-lg);
  color: var(--b-txt-muted);
  margin-bottom: 2rem;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

/* Session Status Card */
.session-status-card {
  display: inline-block;
  background: var(--b-bg-2);
  border: 1px solid var(--b-line);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  min-width: 200px;
}

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

.status-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--b-txt-muted);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--b-line);
  border-radius: 6px;
  color: var(--b-txt-muted);
  cursor: pointer;
  transition: var(--transition-base);
}

.btn-icon:hover {
  border-color: var(--b-accent);
  color: var(--b-accent);
}

.btn-icon svg {
  width: 14px;
  height: 14px;
}

.status-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-icon {
  display: flex;
  align-items: center;
}

.status-icon svg {
  width: 20px;
  height: 20px;
}

.status-text {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--b-txt);
}

/* Status states */
.status-display.status-active .status-icon { color: var(--b-success); }
.status-display.status-pending .status-icon { color: var(--b-accent); }
.status-display.status-error .status-icon { color: var(--b-danger); }

/* === Challenge Flow Section === */

.challenge-flow-section {
  padding: 3rem 0 4rem;
  background-color: var(--b-bg-2);
  border-top: 1px solid var(--b-line);
  border-bottom: 1px solid var(--b-line);
}

.flow-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
}

@media (min-width: 1024px) {
  .flow-grid {
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    gap: 1rem;
  }
}

/* Flow Card */
.flow-card {
  background: var(--b-bg-1);
  border: 1px solid var(--b-line);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 320px;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.flow-card:hover {
  border-color: var(--b-accent);
}

@media (min-width: 1024px) {
  .flow-card {
    flex: 1;
    max-width: none;
  }
}

.flow-step {
  position: absolute;
  top: -12px;
  left: 1.5rem;
  width: 24px;
  height: 24px;
  background: var(--b-accent);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.flow-card-header h3 {
  font-size: var(--text-base);
  font-weight: 700;
  margin: 0;
  color: var(--b-txt);
}

.flow-desc {
  font-size: var(--text-sm);
  color: var(--b-txt-muted);
  margin: 0 0 1rem 0;
  line-height: 1.4;
}

.flow-output {
  background: var(--b-bg-2);
  border: 1px solid var(--b-line);
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.flow-output:hover {
  border-color: var(--b-txt-muted);
}

.flow-output pre {
  margin: 0;
  font-family: var(--b-font-mono);
  font-size: var(--text-xs);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--b-txt-muted);
  max-height: 180px;
  overflow-y: auto;
}

/* Flow Arrow */
.flow-arrow {
  display: none;
  color: var(--b-txt-muted);
  opacity: 0.5;
}

@media (min-width: 1024px) {
  .flow-arrow {
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }
}

/* Small button variant */
.btn-sm {
  padding: 0.4rem 0.9rem;
  font-size: var(--text-sm);
  border-radius: 6px;
}

.btn-sm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* === Activity Log Section === */

.activity-section {
  padding: 3rem 0 4rem;
  background-color: var(--b-bg-1);
}

.activity-card {
  max-width: 800px;
  margin: 0 auto;
  background: var(--b-bg-2);
  border: 1px solid var(--b-line);
  border-radius: 12px;
  overflow: hidden;
}

.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--b-line);
  background: var(--b-bg-1);
}

.activity-header h3 {
  font-size: var(--text-base);
  font-weight: 700;
  margin: 0;
  color: var(--b-txt);
}

.activity-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  background: oklch(55% 0.18 140 / 0.15);
  color: var(--b-success);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.activity-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--b-success);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.activity-log {
  padding: 1rem 1.5rem;
  max-height: 240px;
  overflow-y: auto;
}

.activity-log pre {
  margin: 0;
  font-family: var(--b-font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--b-txt);
}

/* === Auth Overlay === */

#pz-auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--b-bg-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.3s ease;
}

#pz-auth-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#pz-auth-overlay .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--b-line);
  border-top-color: var(--b-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

#pz-auth-overlay .status {
  margin-top: 1rem;
  color: var(--b-txt-muted);
  font-size: var(--text-sm);
}

/* === Modal === */

.modal {
  width: 90%;
  max-width: 700px;
  padding: 0;
  border: 1px solid var(--b-line);
  border-radius: 12px;
  background: var(--b-bg-1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal article {
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

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

.modal header h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--b-line);
  border-radius: 6px;
  color: var(--b-txt-muted);
  font-size: 1.25rem;
  cursor: pointer;
  transition: var(--transition-base);
}

.modal-close:hover {
  border-color: var(--b-danger);
  color: var(--b-danger);
}

.modal pre {
  margin: 0;
  padding: 1.5rem;
  font-family: var(--b-font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
}
