/* ==========================================================================
   Tanishayan (ContraVault AI) - Interactive Demo Widget Styling (Light Theme)
   ========================================================================== */

.demo-widget-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  margin-top: 2rem;
  text-align: left;
}

/* Demo Top Bar */
.demo-topbar {
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.demo-tender-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.demo-tender-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 4px;
  font-weight: 600;
}

.demo-tender-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

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

/* Pipeline Step Tabs */
.demo-step-nav {
  display: flex;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.demo-step-btn {
  flex: 1;
  padding: 0.85rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.demo-step-btn:hover {
  color: var(--primary);
  background: rgba(79, 70, 229, 0.04);
}

.demo-step-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg-surface);
}

.demo-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border-medium);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: center;
}

.demo-step-btn.active .demo-step-num {
  background: var(--primary);
  color: #FFF;
}

/* Demo Body & Panels */
.demo-body {
  padding: 1.5rem;
  min-height: 440px;
  background: var(--bg-main);
}

.demo-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.demo-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Ingest Panel */
.upload-dropzone {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.upload-dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem auto;
}

.processing-sim {
  margin-top: 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.sim-progress-bar {
  height: 8px;
  background: var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.sim-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent-emerald));
  transition: width 0.4s ease;
}

/* Go/No-Go Scorecard Panel */
.scorecard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.scorecard-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--accent-emerald-light);
  border: 1px solid var(--accent-emerald-border);
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  color: var(--accent-emerald);
  font-weight: 700;
  font-size: 1.1rem;
}

.scorecard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.scorecard-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.scorecard-item-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.scorecard-item-val {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Risk Heatmap & Clause List */
.clause-risk-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.clause-risk-table th {
  background: var(--bg-surface-elevated);
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.clause-risk-table td {
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.risk-level-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.risk-high {
  background: var(--accent-rose-light);
  color: var(--accent-rose);
  border: 1px solid var(--accent-rose-border);
}

.risk-medium {
  background: var(--accent-amber-light);
  color: var(--accent-amber);
  border: 1px solid var(--accent-amber-border);
}

.risk-low {
  background: var(--accent-emerald-light);
  color: var(--accent-emerald);
  border: 1px solid var(--accent-emerald-border);
}

/* Source Page Citation Box */
.citation-link {
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
}

.citation-popover {
  background: #FFF;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  box-shadow: var(--shadow-md);
  border-left: 3px solid var(--primary);
}

/* Forms & Package Export Panel */
.form-fill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.form-preview-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.form-field-item {
  margin-bottom: 0.85rem;
}

.form-field-label {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.form-field-value {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  margin-top: 0.2rem;
}

@media (max-width: 768px) {
  .scorecard-grid, .form-fill-grid {
    grid-template-columns: 1fr;
  }
}
