/* ============================================
   Pattern Tool — Dashboard & Form Styles
   ============================================ */

/* --- Dashboard Tabs --- */
.dashboard-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: var(--space-xl);
  border-bottom: 2px solid var(--border-subtle);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dash-tab {
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.dash-tab:hover {
  color: var(--text-cream);
}

.dash-tab.active {
  color: var(--accent-amber);
  border-bottom-color: var(--accent-amber);
}

/* --- Dashboard Views --- */
.dash-view {
  display: none;
}

.dash-view.active {
  display: block;
}

.dash-intro {
  max-width: var(--max-width-text);
  margin-bottom: var(--space-xl);
}

.dash-intro h2 {
  color: var(--accent-amber);
  margin-bottom: var(--space-sm);
}

.dash-cta {
  text-align: center;
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--space-xl);
}

.dash-cta p {
  color: var(--text-muted);
  max-width: 32rem;
  margin: 0 auto var(--space-md);
}

/* --- Charts --- */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.chart-card h3 {
  font-family: var(--font-heading);
  color: var(--text-heading);
  margin-bottom: var(--space-xs);
}

.chart-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-md);
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

.chart-container-sm {
  height: 250px;
}

.chart-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-sm);
  text-align: center;
  font-style: italic;
}

/* --- Timeline Heatmap --- */
.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.heatmap-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: var(--space-md);
  min-height: 200px;
  overflow-x: auto;
}

.heatmap-row {
  display: flex;
  align-items: center;
  height: 28px;
  margin-bottom: 4px;
  position: relative;
}

.heatmap-label {
  width: 140px;
  flex-shrink: 0;
  font-family: var(--font-data);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  padding-right: var(--space-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heatmap-bar-area {
  flex: 1;
  position: relative;
  height: 100%;
}

.heatmap-service-bar {
  position: absolute;
  height: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(196, 149, 106, 0.25);
  border-radius: 2px;
}

.heatmap-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.heatmap-dot:hover {
  transform: translate(-50%, -50%) scale(1.5);
  z-index: 10;
}

.heatmap-tooltip {
  position: fixed;
  background: var(--bg-deep);
  border: 1px solid var(--accent-amber);
  border-radius: 4px;
  padding: 0.5rem 0.8rem;
  font-size: 0.8rem;
  color: var(--text-cream);
  pointer-events: none;
  z-index: 1000;
  max-width: 250px;
  display: none;
}

.heatmap-axis {
  display: flex;
  margin-left: 140px;
  justify-content: space-between;
  font-family: var(--font-data);
  font-size: 0.7rem;
  color: var(--text-muted);
  padding-top: var(--space-xs);
  border-top: 1px solid var(--border-subtle);
}

/* --- Condition Filters --- */
.condition-filters {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-xl);
}

.filter-btn {
  padding: 0.5rem 1.2rem;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--filter-colour, var(--accent-amber));
  color: var(--text-cream);
}

.filter-btn.active {
  background: var(--filter-colour, var(--accent-amber));
  color: var(--bg-deep);
  border-color: var(--filter-colour, var(--accent-amber));
  font-weight: 500;
}

.condition-panel {
  display: none;
}

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

/* --- Dental Generations --- */
.dental-generations {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin: var(--space-xl) 0;
  flex-wrap: wrap;
}

.dental-gen-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: var(--space-lg);
  text-align: center;
  min-width: 180px;
  flex: 1;
  max-width: 220px;
}

.dental-gen-label {
  font-family: var(--font-data);
  font-size: 0.75rem;
  color: var(--accent-teal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
}

.dental-gen-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--text-heading);
  margin-bottom: var(--space-sm);
}

.dental-gen-pct {
  font-family: var(--font-data);
  font-size: 2.5rem;
  font-weight: 500;
  color: var(--accent-amber);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.dental-gen-detail {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dental-gen-arrow {
  font-size: 1.5rem;
  color: var(--accent-amber);
  opacity: 0.5;
}

/* --- Form Steps --- */
.form-steps {
  display: flex;
  gap: 2px;
  margin-bottom: var(--space-xl);
  overflow-x: auto;
}

.form-step-indicator {
  flex: 1;
  padding: var(--space-sm);
  text-align: center;
  font-family: var(--font-data);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-radius: 3px 3px 0 0;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.form-step-indicator.active {
  background: var(--bg-card);
  color: var(--accent-amber);
}

.form-step-indicator.completed {
  background: var(--bg-card);
  color: var(--accent-teal);
}

.form-step {
  display: none;
  max-width: var(--max-width-text);
}

.form-step.active {
  display: block;
}

.form-step h3 {
  color: var(--accent-amber);
  margin-bottom: var(--space-xs);
}

.form-step > p {
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.form-nav {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.required {
  color: var(--danger-red);
}

/* --- Checkbox styling --- */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin-top: 0.25rem;
  flex-shrink: 0;
  accent-color: var(--accent-teal);
}

.checkbox-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: var(--space-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  max-height: 20rem;
  overflow-y: auto;
}

.checkbox-group-label {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--accent-teal);
  margin-top: var(--space-xs);
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--border-subtle);
}

.checkbox-group-label:first-child {
  margin-top: 0;
}

/* --- Condition entries --- */
.condition-entry,
.child-entry {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
}

/* --- Family sections --- */
.family-section {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.family-section:last-child {
  border-bottom: none;
}

/* --- Review summary --- */
.review-summary {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: var(--space-lg);
}

.review-section {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.review-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.review-section h4 {
  font-family: var(--font-heading);
  color: var(--accent-amber);
  font-size: 1rem;
  margin-bottom: var(--space-xs);
}

.review-item {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

.review-item-label {
  color: var(--text-muted);
}

.review-item-value {
  color: var(--text-cream);
  text-align: right;
}

/* --- No data state --- */
.no-data {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-muted);
}

.no-data h3 {
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .dashboard-tabs {
    gap: 0;
  }

  .dash-tab {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.85rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .dental-generations {
    flex-direction: column;
  }

  .dental-gen-card {
    max-width: 100%;
    width: 100%;
  }

  .dental-gen-arrow {
    transform: rotate(90deg);
  }

  .heatmap-label {
    width: 80px;
    font-size: 0.6rem;
  }

  .heatmap-axis {
    margin-left: 80px;
  }

  .form-step-indicator {
    font-size: 0.7rem;
    padding: var(--space-xs);
  }

  .chart-container {
    height: 250px;
  }
}
