/**
 * comparison-views.css
 * Last modified: v017.040 (2025-02-10)
 * Changes: Fix cramped answer pills, bigger fit indicator, entire card clickable, remove duplicate why text
 */

/* ============================================
   CSS Variables for Match Colors (theme-aware fallbacks)
   Themes can override these via --theme-match-green etc.
   ============================================ */
:root {
  --match-green: var(--theme-match-green, #16a34a);
  --match-yellow: var(--theme-match-yellow, #f59e0b);
  --match-red: var(--theme-match-red, #dc2626);
  --match-green-bg: var(--theme-match-green-bg, rgba(22, 163, 74, 0.08));
  --match-yellow-bg: var(--theme-match-yellow-bg, rgba(245, 158, 11, 0.08));
  --match-red-bg: var(--theme-match-red-bg, rgba(220, 38, 38, 0.08));
}

/* ============================================
   Shared: Profile Header
   ============================================ */
.match-report-view,
.comparison-browse-view {
  max-width: 600px;
  margin: 0 auto;
  padding: 0.5rem;
  padding-bottom: 5rem;
}

.match-report-header {
  text-align: center;
  margin-bottom: 1rem;
}

.match-report-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--theme-text-title);
  margin: 0.5rem 0;
}

.match-report-profile-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.match-report-vs {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--theme-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.match-report-profile-btn {
  padding: 0.5rem 1rem;
  border: 2px solid var(--theme-border-primary);
  border-radius: 999px;
  background: transparent;
  color: var(--theme-text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-report-profile-btn:hover {
  background: var(--theme-bg-secondary);
}

.match-report-profile-btn.loaded {
  color: var(--theme-text-primary);
}

.match-report-profile-a.loaded {
  border-color: var(--theme-accent-action);
  color: var(--theme-accent-action);
}

.match-report-profile-b.loaded {
  border-color: var(--theme-accent-error, #dc2626);
  color: var(--theme-accent-error, #dc2626);
}

/* ============================================
   Placeholder (no profiles loaded)
   ============================================ */
.match-report-placeholder {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--theme-text-muted);
}

.match-report-placeholder-icon {
  margin-bottom: 1rem;
  opacity: 0.4;
  color: var(--theme-text-muted);
}

.match-report-placeholder p {
  font-size: 0.9rem;
}

/* ============================================
   Match Report: Summary Bar
   ============================================ */
.match-report-summary {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--theme-bg-secondary);
  border-radius: 0.75rem;
}

.match-report-progress {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--theme-border-secondary);
  margin-bottom: 0.5rem;
}

.match-report-progress-segment {
  transition: width 0.3s ease;
  min-width: 2px;
}

.match-report-counts {
  display: flex;
  justify-content: space-around;
  font-size: 0.8rem;
  color: var(--theme-text-secondary);
}

.match-report-count-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.match-report-count-item strong {
  font-size: 1rem;
}

/* ============================================
   Match Report: Section Tabs
   ============================================ */
.match-report-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--theme-bg-primary);
  padding: 0.4rem 0;
}

.match-report-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.6rem 0.4rem;
  border: 2px solid var(--theme-border-secondary);
  border-radius: 0.6rem;
  background: transparent;
  color: var(--theme-text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.match-report-tab:hover {
  background: var(--theme-bg-secondary);
}

.match-report-tab.active {
  color: #fff;
  border-color: transparent;
}

.match-report-tab-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.match-report-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-report-tab-count {
  background: rgba(255, 255, 255, 0.25);
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 1.2rem;
  text-align: center;
}

.match-report-tab:not(.active) .match-report-tab-count {
  background: var(--theme-bg-secondary);
  color: var(--theme-text-muted);
}

/* ============================================
   Match Report: Category Groups
   ============================================ */
.match-report-category-group {
  margin-bottom: 1.25rem;
}

.match-report-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--theme-border-secondary);
}

.match-report-category-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--theme-text-title);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.match-report-category-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--theme-text-muted);
  background: var(--theme-bg-secondary);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

/* ============================================
   Match Report: Cards
   ============================================ */
.match-report-cards {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.match-report-card {
  background: var(--theme-bg-secondary);
  border-radius: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-left: 6px solid var(--theme-border-secondary);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.match-report-card:active {
  transform: scale(0.99);
}

.match-report-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.match-report-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--theme-text-primary);
  line-height: 1.3;
  flex: 1;
}

.match-report-card-badge {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.match-report-card-answers {
  display: flex;
  gap: 0.5rem;
}

.match-report-answer-pill {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.35rem;
  padding: 0.4rem 0.5rem;
  background: var(--theme-bg-primary);
  border-radius: 0.4rem;
  font-size: 0.75rem;
  min-height: 1.8rem;
}

/* Sticky profile names bar — shows who is left vs right */
.match-report-profile-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--theme-bg-secondary);
  border-bottom: 1px solid var(--theme-border-secondary);
  border-radius: 0.4rem 0.4rem 0 0;
  margin-bottom: 0.25rem;
}

.match-report-profile-bar-name {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--theme-text-primary);
  padding: 0.15rem 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   Match Report: Empty State
   ============================================ */
.match-report-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--theme-text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* ============================================
   Browse View: Show Mode Toggle
   ============================================ */
.browse-show-toggle {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  background: var(--theme-bg-secondary);
  border-radius: 0.5rem;
  padding: 0.2rem;
}

.browse-toggle-btn {
  flex: 1;
  padding: 0.45rem 0.75rem;
  border: none;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--theme-text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.browse-toggle-btn.active {
  background: var(--theme-accent-action);
  color: #fff;
}

.browse-toggle-btn:not(.active):hover {
  background: var(--theme-bg-primary);
}

/* ============================================
   Browse View: Category Navigation (pill strip)
   ============================================ */
.browse-category-nav {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  padding: 0.4rem 0;
  margin-bottom: 0.75rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.browse-category-nav::-webkit-scrollbar {
  display: none;
}

.browse-category-pill {
  flex-shrink: 0;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--theme-border-secondary);
  border-radius: 999px;
  background: transparent;
  color: var(--theme-text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.browse-category-pill:hover {
  background: var(--theme-bg-secondary);
}

.browse-category-pill.active {
  background: var(--theme-accent-action);
  color: #fff;
  border-color: var(--theme-accent-action);
}

/* ============================================
   Browse View: Category Content
   ============================================ */
.browse-category-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--theme-text-title);
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--theme-border-primary);
}

/* ============================================
   Browse View: Navigation Buttons
   ============================================ */
.browse-nav-buttons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--theme-border-secondary);
}

.browse-nav-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--theme-border-secondary);
  border-radius: 0.5rem;
  background: var(--theme-bg-secondary);
  color: var(--theme-text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.browse-nav-btn:hover:not(:disabled) {
  background: var(--theme-accent-action);
  color: #fff;
  border-color: var(--theme-accent-action);
}

.browse-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.browse-nav-counter {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--theme-text-muted);
}

/* ============================================
   Mobile-first responsive adjustments
   ============================================ */
@media (max-width: 480px) {
  .match-report-view,
  .comparison-browse-view {
    padding: 0.35rem;
  }

  .match-report-title {
    font-size: 1.1rem;
  }

  .match-report-tab {
    padding: 0.5rem 0.25rem;
    font-size: 0.68rem;
    gap: 0.2rem;
  }

  .match-report-tab-label {
    display: none;
  }

  .match-report-tab-count {
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
  }

  .match-report-card {
    padding: 0.5rem 0.6rem;
    border-left-width: 5px;
  }

  .match-report-card-title {
    font-size: 0.8rem;
  }

  .match-report-profile-bar-name {
    font-size: 0.65rem;
  }

  .browse-category-pill {
    font-size: 0.65rem;
    padding: 0.3rem 0.5rem;
  }
}

/* ============================================
   Cross-View Navigation Switcher
   ============================================ */
.compare-view-switcher {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  background: var(--theme-bg-secondary);
  border-radius: 0.5rem;
  padding: 0.2rem;
}

.compare-switcher-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.4rem 0.5rem;
  border: none;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--theme-text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compare-switcher-btn.active {
  background: var(--theme-accent-action);
  color: #fff;
}

.compare-switcher-btn:not(.active):hover {
  background: var(--theme-bg-primary);
}

/* ============================================
   Perspective Warning Banner
   ============================================ */
.compare-perspective-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--match-yellow-bg);
  border: 1px solid var(--match-yellow);
  border-radius: 0.5rem;
  color: var(--match-yellow);
  font-size: 0.78rem;
  line-height: 1.4;
}

.compare-perspective-warning svg {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* ============================================
   Match Report: Category Summary (mini breakdown)
   ============================================ */
.match-report-cat-summary {
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--theme-bg-secondary);
  border-radius: 0.6rem;
}

.match-report-cat-summary-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--theme-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.match-report-cat-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.match-report-cat-summary-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.4rem;
  border-radius: 0.3rem;
  background: var(--theme-bg-primary);
  font-size: 0.7rem;
}

.match-report-cat-summary-label {
  font-weight: 500;
  color: var(--theme-text-secondary);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-report-cat-summary-badges {
  display: flex;
  gap: 0.15rem;
}

/* Shared category badges (used in summary and browse view) */
.cat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1rem;
  padding: 0.1rem 0.3rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
}

.cat-badge-green {
  background: var(--match-green-bg);
  color: var(--match-green);
}

.cat-badge-yellow {
  background: var(--match-yellow-bg);
  color: var(--match-yellow);
}

.cat-badge-red {
  background: var(--match-red-bg);
  color: var(--match-red);
}

/* ============================================
   Match Report: Show All Toggle
   ============================================ */
.match-report-show-all-toggle {
  margin-bottom: 0.5rem;
  padding: 0 0.25rem;
}

.match-report-show-all-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--theme-text-secondary);
  cursor: pointer;
}

.match-report-show-all-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.match-report-unknown-count {
  font-size: 0.72rem;
  color: var(--theme-text-muted);
}

/* ============================================
   Match Report: Expandable Card Detail
   ============================================ */
.match-report-card-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
  opacity: 0;
  padding: 0;
}

.match-report-card.expanded .match-report-card-detail {
  max-height: 300px;
  opacity: 1;
  padding-top: 0.5rem;
}

.match-report-card-chevron {
  display: flex;
  justify-content: center;
  padding-top: 0.15rem;
  color: var(--theme-text-muted);
  transition: transform 0.25s ease;
}

.match-report-card.expanded .match-report-card-chevron {
  transform: rotate(180deg);
}

.match-report-card-why {
  font-size: 0.75rem;
  color: var(--theme-text-secondary);
  padding: 0.3rem 0.5rem;
  background: var(--theme-bg-primary);
  border-radius: 0.3rem;
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.match-report-card-whose-limit {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--match-red);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.match-report-card-desc {
  font-size: 0.75rem;
  color: var(--theme-text-muted);
  line-height: 1.4;
  border-top: 1px solid var(--theme-border-secondary);
  padding-top: 0.35rem;
}

/* Desire label text in answer pill */
.match-report-answer-desire-label {
  font-size: 0.72rem;
  color: var(--theme-text-primary);
  font-weight: 600;
}

/* Experience level row in answer pill — full width forces wrap */
.match-report-answer-experience {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.65rem;
  color: var(--theme-text-muted);
  opacity: 0.75;
  flex-basis: 100%;
}

/* ============================================
   Match Report: Tab Switch Animation
   ============================================ */
.match-report-content-animate {
  animation: matchContentFadeIn 0.2s ease-out;
}

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

/* ============================================
   Browse View: Sticky Category Navigation
   ============================================ */
.browse-category-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--theme-bg-primary);
}

/* ============================================
   Browse View: Per-Category Match Summary
   ============================================ */
.browse-cat-match-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}

.browse-cat-match-summary .cat-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
}

/* Tablet and up */
@media (min-width: 640px) {
  .match-report-view,
  .comparison-browse-view {
    max-width: 700px;
    padding: 1rem;
  }

  .match-report-cards {
    gap: 0.5rem;
  }

  .match-report-card {
    padding: 0.75rem 1rem;
  }

  .match-report-card-answers {
    gap: 0.75rem;
  }

  .compare-switcher-btn {
    font-size: 0.78rem;
    padding: 0.45rem 0.75rem;
  }
}

/* ============================================
   Print View — Match Report
   ============================================ */
@media print {
  /* Hide non-essential UI */
  .compare-view-switcher,
  .match-report-profile-row,
  .match-report-show-all-toggle,
  .match-report-card-chevron,
  .compare-perspective-warning,
  .browse-show-toggle,
  .browse-category-nav,
  .browse-nav-buttons,
  .bottom-nav,
  .bottom-menu-panel,
  #bottomBar {
    display: none !important;
  }

  /* Full width, no background */
  .match-report-view,
  .comparison-browse-view {
    max-width: 100% !important;
    padding: 0 !important;
  }

  /* Remove backgrounds for print */
  .match-report-summary,
  .match-report-cat-summary,
  .match-report-card,
  .match-report-answer-pill {
    background: none !important;
    border: 1px solid #ccc !important;
  }

  /* Expand all cards for print */
  .match-report-card-detail {
    max-height: none !important;
    opacity: 1 !important;
    padding-top: 0.3rem !important;
  }

  /* Force visible text */
  .match-report-card-title,
  .match-report-card-why,
  .match-report-card-desc {
    color: #333 !important;
  }

  /* Page breaks */
  .match-report-category-group {
    break-inside: avoid;
  }

  .match-report-title {
    font-size: 1.5rem !important;
    margin-bottom: 0.5rem;
  }

  .match-report-tabs {
    position: static !important;
  }
}
