/* === Detailed Metrics (All Metrics) Styles === */

/* Section layout */
.dash-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 40px;
}

.dash-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

.dm-section-desc {
  font-size: 0.82rem;
  color: #8a8578;
  line-height: 1.45;
  margin: 0 0 16px 0;
  padding: 0;
}

/* Stats Grid */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.dash-stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.dash-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.dash-stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Stars */
.dash-stars { margin-top: 8px; }
.dash-stars .star { font-size: 1.2rem; }
.dash-stars .star.full { color: #d97757; }
.dash-stars .star.half { color: #d97757; opacity: 0.6; }
.dash-stars .star.empty { color: #e8e6dc; }

/* Insight cards */
.dash-insight-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.dash-insight-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.dash-insight-card.alert {
  border-color: var(--primary);
  background: #fef8f6;
}

.dash-insight-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.dash-insight-card.alert .dash-insight-value {
  color: var(--primary-dark);
}

.dash-insight-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Charts grid */
.dash-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.dash-chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
}

.dash-chart-card h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Prevent canvas from growing unbounded */
#tab-all-metrics .dash-chart-card {
  min-height: 0;
  overflow: hidden;
}

/* === Collapsible sections === */

.dm-mt { margin-top: 20px; }

.dash-collapsible-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dash-collapsible-toggle:hover { opacity: 0.8; }
.dash-toggle-icon { font-size: 0.7rem; color: #8a8880; transition: transform 0.2s ease; }
.dm-collapsed { display: none !important; }

/* Sentiment colors */
.dm-sentiment-positive { color: #788c5d; }
.dm-sentiment-neutral { color: #b0aea5; }
.dm-sentiment-negative { color: #c0513f; }

/* Risk levels */
.dm-risk-critical { color: #c0513f; }
.dm-risk-high { color: #d97757; }
.dm-risk-medium { color: #b0aea5; }
.dm-risk-low { color: #788c5d; }

/* Subsection title */
.dm-subsection-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #2d2b27;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e8e6dc;
}

/* No data message */
.dm-no-data { color: #8a8880; font-size: 0.85rem; font-style: italic; padding: 16px 0; }

/* === Month Selector === */

.dm-month-selector {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.dm-month-selector label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.dm-month-selector select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}

/* === Data Context Section === */

.dm-data-context {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.dm-data-context-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 16px;
}

.dm-data-context-table {
  width: 100%;
  border-collapse: collapse;
}

.dm-data-context-table tr {
  border-bottom: 1px solid #e8e6dc;
}

.dm-data-context-table tr:last-child {
  border-bottom: none;
}

.dm-data-context-table td {
  padding: 10px 0;
}

.dm-data-context-table .dm-dc-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.dm-data-context-table .dm-dc-value {
  text-align: right;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.dm-data-context-months {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e8e6dc;
}

.dm-data-context-month {
  background: #faf9f5;
  border: 1px solid #e8e6dc;
  border-radius: 8px;
  padding: 10px 16px;
  text-align: center;
  flex: 1;
  min-width: 100px;
}

.dm-data-context-month .dm-dcm-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.dm-data-context-month .dm-dcm-count {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
}

/* === Chatbot Pitch Banner === */

.dm-chatbot-pitch {
  background: linear-gradient(135deg, #141413 0%, #2d2b27 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: #faf9f5;
  box-shadow: var(--shadow);
}

.dm-chatbot-pitch-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.dm-chatbot-pitch-tagline {
  font-size: 0.9rem;
  color: #d97757;
  font-weight: 500;
  margin-bottom: 12px;
}

.dm-chatbot-pitch-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #b0aea5;
  margin-bottom: 16px;
}

.dm-chatbot-pitch-cta {
  display: inline-block;
  background: #d97757;
  color: #fff;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

.dm-chatbot-pitch-cta:hover {
  background: #c0513f;
}

/* === Month-over-Month Grid === */

.dm-mom-grid {
  display: grid;
  gap: 12px;
}

.dm-mom-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.dm-mom-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }

.dm-mom-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
}

.dm-mom-card:first-child {
  border-color: #d97757;
  border-width: 2px;
}

.dm-mom-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.dm-mom-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.dm-mom-unit {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
}

.dm-mom-trend {
  margin-top: 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.dm-trend-good { color: #788c5d; }
.dm-trend-bad { color: #c0513f; }
.dm-trend-flat { color: #b0aea5; }

/* === Chart Container === */

.dm-chart-container {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
}

/* === Section Insight Box === */

/* Stars collected badge */
.dm-stars-badge {
  display: inline-block;
  background: #f0ede6;
  border: 1px solid #ddd9cf;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.75rem;
  color: #7a7568;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.dm-section-insight {
  background: #faf9f5;
  border: 1px solid #e8e6dc;
  border-left: 3px solid #d97757;
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #5a5850;
}

.dm-section-insight strong {
  color: #d97757;
}

/* === Themes Comparison Table === */

.dm-themes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.dm-themes-table th,
.dm-themes-table td {
  padding: 10px 14px;
  text-align: center;
  border-bottom: 1px solid #e8e6dc;
}

.dm-themes-table th {
  background: #faf9f5;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
}

.dm-themes-table th:first-child,
.dm-themes-table td:first-child {
  text-align: left;
  font-weight: 600;
}

.dm-themes-table tr:last-child td { border-bottom: none; }

.dm-themes-table .dm-table-trend {
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 4px;
}

/* === Executive Summary (kept) === */

.dm-exec-ai-summary {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.dm-exec-ai-summary p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #5a5850;
  margin: 0;
}

.dm-exec-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.dm-exec-metric {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.dm-exec-metric-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.dm-exec-star {
  font-size: 1.2rem;
  color: #d97757;
  margin-left: 2px;
}
.dm-exec-metric-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.dm-exec-highlights {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}
.dm-exec-highlight-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.dm-exec-highlight-list li {
  padding: 8px 0 8px 20px;
  border-bottom: 1px solid #f0efe8;
  font-size: 0.9rem;
  color: #5a5850;
  line-height: 1.5;
  position: relative;
}
.dm-exec-highlight-list li:last-child { border-bottom: none; }
.dm-exec-highlight-list li::before {
  content: '\2022';
  color: #d97757;
  font-weight: 700;
  position: absolute;
  left: 0;
  top: 8px;
}

/* === Emotion cards (for sentiment section) === */

.dm-emotion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.dm-emotion-card {
  background: #fff;
  border: 1px solid #e8e6dc;
  border-radius: 8px;
  padding: 14px 12px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.dm-emotion-card.negative { border-left: 3px solid #c0513f; }
.dm-emotion-card.positive { border-left: 3px solid #788c5d; }
.dm-emotion-name { font-size: 0.8rem; font-weight: 600; text-transform: capitalize; color: #2d2b27; }
.dm-emotion-count { font-size: 1.4rem; font-weight: 800; color: #2d2b27; margin: 4px 0; }
.dm-emotion-pct { font-size: 0.7rem; color: #8a8880; }

/* Severity badges */
.dm-severity-badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
}
.dm-severity-critical { background: #fde8e4; color: #c0513f; }
.dm-severity-high { background: #fef0e8; color: #d97757; }
.dm-severity-medium { background: #f0efe8; color: #8a8880; }
.dm-severity-low { background: #e8f0df; color: #788c5d; }

/* === Radar Chart === */

.dm-radar-container {
  max-width: 600px;
  margin: 0 auto;
}

/* Sentiment colors for table cells */
.dm-sentiment-positive { color: #788c5d; font-weight: 600; }
.dm-sentiment-negative { color: #c0513f; font-weight: 600; }

/* Category descriptions list above table */
.dm-category-descriptions {
  background: #faf9f5;
  border: 1px solid #e8e6dc;
  border-radius: var(--radius, 8px);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.dm-category-desc-item {
  font-size: 0.8rem;
  color: #5a5850;
  line-height: 1.5;
  padding: 6px 0;
  border-bottom: 1px solid #eae8e0;
}

.dm-category-desc-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.dm-category-desc-item strong {
  color: #3a3830;
}

/* === Responsive === */

@media (max-width: 768px) {
  .dash-charts-grid { grid-template-columns: 1fr; }
  .dash-insight-cards { grid-template-columns: 1fr 1fr; }
  .dash-stats-grid { grid-template-columns: 1fr 1fr; }
  .dm-mom-grid.cols-3 { grid-template-columns: 1fr; }
  .dm-mom-grid.cols-6 { grid-template-columns: repeat(2, 1fr); }
  .dm-data-context-months { flex-direction: column; }
  .dm-emotion-grid { grid-template-columns: repeat(2, 1fr); }
  .dm-exec-metrics { grid-template-columns: repeat(2, 1fr); }
  .dm-themes-table { font-size: 0.75rem; }
  .dm-themes-table th, .dm-themes-table td { padding: 8px 6px; }
  .dm-chart-container { padding: 12px; }
  .dm-radar-container { max-width: 100%; }
  .dm-section-desc { font-size: 0.78rem; }
  .dm-subsection-title { font-size: 0.85rem; }
  .dm-month-selector { flex-wrap: wrap; }
  .dm-month-selector label { font-size: 0.8rem; }
  .dm-category-descriptions { padding: 12px; }
  .dm-category-desc-item { font-size: 0.78rem; }

  /* Collapsible sections — bigger touch target */
  .dash-collapsible-toggle { padding: 14px 0; min-height: 44px; }
}

@media (max-width: 480px) {
  .dash-insight-cards { grid-template-columns: 1fr; }
  .dash-stats-grid { grid-template-columns: 1fr; }
  .dm-mom-grid.cols-3, .dm-mom-grid.cols-6 { grid-template-columns: 1fr; }
  .dm-emotion-grid { grid-template-columns: 1fr; }
  .dm-exec-metrics { grid-template-columns: 1fr; }
  .dm-chart-container { padding: 8px; }
  .dm-radar-section { display: none; }
  .dm-data-context { padding: 14px; }
  .dm-data-context-title { font-size: 0.78rem; margin-bottom: 10px; }
  .dm-data-context-table .dm-dc-label { font-size: 0.78rem; }
  .dm-data-context-table .dm-dc-value { font-size: 0.85rem; }
  .dm-data-context-month { padding: 8px 10px; min-width: 0; }
  .dm-data-context-month .dm-dcm-count { font-size: 0.95rem; }
  .dm-exec-ai-summary p { font-size: 0.82rem; }
  .dm-chatbot-pitch { padding: 20px 16px; }
  .dm-chatbot-pitch h3 { font-size: 1rem; }

  /* Tables — horizontal scroll on mobile */
  .dm-themes-table { font-size: 0.7rem; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dm-themes-table th, .dm-themes-table td { padding: 6px 5px; white-space: nowrap; }

  /* Emotion cards */
  .dm-emotion-card { padding: 8px; }
  .dm-emotion-name { font-size: 0.72rem; }
  .dm-emotion-count { font-size: 1rem; }
}

/* === Review Modal (chart click-to-view) === */

#reviewsModalOverlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#reviewsModalOverlay.hidden {
  display: none;
}

#reviewsModalOverlay .modal-content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  padding: 32px;
}

#reviewsModalOverlay .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

#reviewsModalOverlay .modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #141413;
}

#reviewsModalOverlay .modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6b6960;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
}

#reviewsModalOverlay .modal-close:hover {
  color: #141413;
  background: rgba(0,0,0,0.05);
}

.dm-reviews-modal {
  max-width: 700px;
  width: 95%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.dm-reviews-modal-count {
  font-size: 0.82rem;
  color: #8a8578;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e8e6dc;
}

.dm-reviews-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
}

.dm-review-card {
  background: #faf9f5;
  border: 1px solid #e8e6dc;
  border-radius: 8px;
  padding: 16px;
}

.dm-review-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.dm-review-card-stars {
  font-size: 1rem;
  letter-spacing: 1px;
}

.dm-review-card-author {
  font-size: 0.82rem;
  font-weight: 600;
  color: #2d2b27;
}

.dm-review-card-date {
  font-size: 0.75rem;
  color: #8a8578;
  margin-left: auto;
}

.dm-review-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #2d2b27;
  margin-bottom: 6px;
}

.dm-review-card-content {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #5a5850;
  margin-bottom: 8px;
}

.dm-review-card-reply {
  background: #fff;
  border: 1px solid #e8e6dc;
  border-left: 3px solid #788c5d;
  border-radius: 0 6px 6px 0;
  padding: 10px 14px;
  margin-top: 8px;
}

.dm-review-card-reply-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #788c5d;
  margin-bottom: 4px;
}

.dm-review-card-reply-text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #5a5850;
}

.dm-review-card-link {
  display: inline-block;
  font-size: 0.8rem;
  color: #d97757;
  text-decoration: none;
  font-weight: 500;
  margin-top: 6px;
}

.dm-review-card-link:hover {
  text-decoration: underline;
}

/* Review modal — mobile */
@media (max-width: 480px) {
  .dm-reviews-modal {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    padding: 16px;
  }
  #reviewsModalOverlay .modal-content {
    padding: 16px;
    border-radius: 12px 12px 0 0;
    max-height: 92vh;
  }
  #reviewsModalOverlay .modal-header h3 { font-size: 0.95rem; }
  .dm-reviews-modal-count { font-size: 0.75rem; margin-bottom: 10px; padding-bottom: 8px; }
  .dm-review-card { padding: 12px; }
  .dm-review-card-title { font-size: 0.85rem; }
  .dm-review-card-content { font-size: 0.8rem; }
  .dm-review-card-reply { padding: 8px 10px; }
  .dm-review-card-reply-text { font-size: 0.78rem; }
  .dm-review-card-date { margin-left: 0; width: 100%; margin-top: 2px; }
}
