/**
 * analysis.css
 * Last modified: v017.078 (2025-02-12)
 * Changes: Initial creation — themeable styles for category outro + profile report
 */

/* ============================================
   Category Outro & Profile Report Styles
   
   All colors use theme variables (--theme-*)
   so they adapt to any theme automatically.
   Scale colors use CSS variables from :root
   (--color-hardno, --color-love, etc.)
   ============================================ */

/* === Category Outro Screen === */

.category-outro {
  text-align: center;
  padding: 1rem 0.5rem 2rem;
  max-width: var(--maxw);
  margin: 0 auto;
}

.category-outro-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 1rem;
  background: color-mix(in srgb, var(--theme-accent-action) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--theme-accent-action) 30%, transparent);
  border-radius: 2rem;
  font-size: var(--fs-sm);
  color: var(--theme-accent-action);
  font-weight: 600;
  margin-bottom: 1rem;
}

.category-outro-badge .outro-badge-icon {
  font-size: 1.1em;
}

.category-outro-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--theme-text-primary);
  margin: 0.5rem 0 0.25rem;
}

.category-outro-subtitle {
  font-size: var(--fs-md);
  color: var(--theme-text-secondary);
  margin: 0 0 1.5rem;
}

/* Quick stats row */
.category-outro-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.outro-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.outro-stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--theme-text-primary);
}

.outro-stat-label {
  font-size: var(--fs-xs);
  color: var(--theme-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Insight cards */
.category-outro-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.outro-insight-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: color-mix(in srgb, var(--theme-bg-secondary) 80%, transparent);
  border: 1px solid var(--theme-border-secondary);
  border-radius: var(--radius-lg);
  text-align: left;
  backdrop-filter: blur(var(--theme-blur-amount));
  -webkit-backdrop-filter: blur(var(--theme-blur-amount));
  animation: outroCardFadeIn 0.4s ease both;
}

.outro-insight-card:nth-child(1) { animation-delay: 0.1s; }
.outro-insight-card:nth-child(2) { animation-delay: 0.25s; }
.outro-insight-card:nth-child(3) { animation-delay: 0.4s; }
.outro-insight-card:nth-child(4) { animation-delay: 0.55s; }

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

.outro-insight-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 0.1rem;
}

.outro-insight-body {
  flex: 1;
  min-width: 0;
}

.outro-insight-title {
  font-weight: 700;
  font-size: var(--fs);
  color: var(--theme-text-primary);
  margin-bottom: 0.2rem;
}

.outro-insight-message {
  font-size: var(--fs-sm);
  color: var(--theme-text-secondary);
  line-height: 1.4;
}

/* Review unanswered button (optional, shown when unanswered exist) */
.category-outro-review-unanswered {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  background: transparent;
  color: var(--theme-text-secondary);
  border: 1px solid var(--theme-border-secondary);
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 0.5rem;
}

.category-outro-review-unanswered:hover {
  background: color-mix(in srgb, var(--theme-bg-secondary) 60%, transparent);
  color: var(--theme-text-primary);
  border-color: var(--theme-accent-primary);
}

/* Next category button */
.category-outro-next {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  background: var(--theme-accent-action);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.2s, transform 0.1s;
  margin-top: 0.5rem;
}

.category-outro-next:hover {
  background: var(--theme-accent-success);
  transform: translateY(-1px);
}

.category-outro-next:active {
  transform: translateY(0);
}

/* Empty state when no insights triggered */
.category-outro-empty {
  padding: 1rem;
  color: var(--theme-text-muted);
  font-size: var(--fs-sm);
  font-style: italic;
}

/* === Profile Report === */

.profile-report {
  padding: 1rem 0 2rem;
  max-width: var(--maxw);
  margin: 0 auto;
}

/* Congrats header */
.report-header {
  text-align: center;
  margin-bottom: 2rem;
}

.report-header-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  display: block;
}

.report-header-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--theme-text-primary);
  margin: 0 0 0.3rem;
}

.report-header-subtitle {
  font-size: 1rem;
  color: var(--theme-text-secondary);
  margin: 0 0 0.5rem;
}

.report-header-stats {
  font-size: var(--fs-sm);
  color: var(--theme-text-muted);
}

/* Report sections */
.report-section {
  margin-bottom: 1.5rem;
}

.report-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--theme-text-title);
  margin: 0 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.report-section-title .section-icon {
  font-size: 1.2em;
}

.report-section-desc {
  font-size: var(--fs-sm);
  color: var(--theme-text-muted);
  margin: -0.5rem 0 0.75rem;
}

/* Desire distribution bars */
.desire-distribution {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.desire-bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.desire-bar-label {
  width: 70px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-align: right;
  color: var(--theme-text-secondary);
  flex-shrink: 0;
}

.desire-bar-track {
  flex: 1;
  height: 20px;
  background: var(--theme-scale-bar-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}

.desire-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.6s ease;
  min-width: 2px;
}

/* Scale colors for bars — using CSS variables from :root */
.desire-bar-fill[data-level="love"]    { background: var(--color-love); }
.desire-bar-fill[data-level="like"]    { background: var(--color-like); }
.desire-bar-fill[data-level="fine"]    { background: var(--color-fine); }
.desire-bar-fill[data-level="curious"] { background: var(--color-curious); }
.desire-bar-fill[data-level="softno"]  { background: var(--color-softno); }
.desire-bar-fill[data-level="hardno"]  { background: var(--color-hardno); }
.desire-bar-fill[data-level="unknown"] { background: var(--color-unknown); }

.desire-bar-count {
  width: 40px;
  font-size: var(--fs-xs);
  color: var(--theme-text-muted);
  flex-shrink: 0;
}

/* Top categories */
.top-categories-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.top-category-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: color-mix(in srgb, var(--theme-bg-secondary) 80%, transparent);
  border: 1px solid var(--theme-border-secondary);
  border-radius: var(--radius-md);
}

.top-category-rank {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--theme-text-muted);
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}

.top-category-rank:first-child {
  color: var(--theme-accent-action);
}

.top-category-info {
  flex: 1;
  min-width: 0;
}

.top-category-name {
  font-weight: 600;
  font-size: var(--fs);
  color: var(--theme-text-primary);
}

.top-category-bar {
  margin-top: 0.3rem;
  height: 6px;
  background: var(--theme-scale-bar-bg);
  border-radius: 3px;
  overflow: hidden;
}

.top-category-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--theme-accent-action);
  transition: width 0.6s ease;
}

.top-category-pct {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--theme-accent-action);
  flex-shrink: 0;
}

/* Discovery zone items */
.discovery-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.discovery-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: color-mix(in srgb, var(--color-love) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-love) 25%, transparent);
  border-radius: 2rem;
  font-size: var(--fs-xs);
  color: var(--theme-text-primary);
}

.discovery-item-icon {
  font-size: 0.9em;
}

/* Boundary map */
.boundary-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.boundary-stat-card {
  flex: 1;
  padding: 0.75rem;
  background: color-mix(in srgb, var(--theme-bg-secondary) 80%, transparent);
  border: 1px solid var(--theme-border-secondary);
  border-radius: var(--radius-md);
  text-align: center;
}

.boundary-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--theme-text-primary);
}

.boundary-stat-label {
  font-size: var(--fs-xs);
  color: var(--theme-text-muted);
  margin-top: 0.15rem;
}

.boundary-stat-card.hard .boundary-stat-value {
  color: var(--color-hardno);
}

.boundary-stat-card.soft .boundary-stat-value {
  color: var(--color-softno);
}

/* Category heatmap */
.category-heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
}

.heatmap-card {
  padding: 0.65rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--theme-border-secondary);
  text-align: center;
  background: color-mix(in srgb, var(--theme-bg-secondary) 80%, transparent);
  transition: border-color 0.2s;
}

.heatmap-card-icon {
  font-size: 1.3rem;
  margin-bottom: 0.25rem;
  display: block;
}

.heatmap-card-name {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--theme-text-primary);
  margin-bottom: 0.35rem;
  line-height: 1.2;
}

.heatmap-card-bar {
  height: 4px;
  background: var(--theme-scale-bar-bg);
  border-radius: 2px;
  overflow: hidden;
}

.heatmap-card-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* Color coding for heatmap based on enthusiasm */
.heatmap-card[data-heat="high"]  .heatmap-card-bar-fill { background: var(--color-love); }
.heatmap-card[data-heat="medium"] .heatmap-card-bar-fill { background: var(--color-like); }
.heatmap-card[data-heat="low"]    .heatmap-card-bar-fill { background: var(--color-fine); }
.heatmap-card[data-heat="none"]   .heatmap-card-bar-fill { background: var(--color-unknown); }

.heatmap-card[data-heat="high"]  { border-color: color-mix(in srgb, var(--color-love) 30%, transparent); }
.heatmap-card[data-heat="medium"] { border-color: color-mix(in srgb, var(--color-like) 25%, transparent); }

/* Profile insight cards (reuse outro cards with slight tweaks) */
.profile-insight-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.profile-insight-cards .outro-insight-card {
  animation: none;
}

/* Report actions — reuse existing action buttons */
.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--theme-border-secondary);
}

/* Experience gap visual */
.experience-gap-visual {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: color-mix(in srgb, var(--theme-bg-secondary) 80%, transparent);
  border: 1px solid var(--theme-border-secondary);
  border-radius: var(--radius-lg);
}

.gap-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.gap-bar-label {
  font-size: var(--fs-xs);
  color: var(--theme-text-muted);
  display: flex;
  justify-content: space-between;
}

.gap-bar-track {
  height: 12px;
  background: var(--theme-scale-bar-bg);
  border-radius: 6px;
  overflow: hidden;
}

.gap-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s ease;
}

.gap-bar-fill.desire {
  background: var(--color-love);
}

.gap-bar-fill.experience {
  background: var(--theme-accent-action);
}

.gap-message {
  font-size: var(--fs-sm);
  color: var(--theme-text-secondary);
  margin-top: 0.5rem;
  text-align: center;
}

/* === Mobile tweaks === */
@media (max-width: 768px) {
  .category-heatmap {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  
  .category-outro-stats {
    gap: 1rem;
  }
  
  .boundary-stats {
    flex-direction: column;
    gap: 0.5rem;
  }
}
