/* ===== TOP 3 FOCUS AREAS ===== */

.top3-section {
  margin: 0 0 2rem;
}

/* .top3-subtitle and .kpi-subtitle styling is now controlled
   by style.css via the shared sub-header rules.
   Do NOT redefine font-size/weight/color here. */

#top3Grid {
  display: block;
}

/* Scrollable container — applied when RD, RQM, or Site selected */
#top3Grid.scrollable {
  display: block;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 8px;
}

/* When scrollable but single-site, use a 3-col grid inside */
#top3Grid.scrollable.single-site-mode {
  display: block;
  max-height: 500px;
  overflow-y: auto;
}

/* Custom scrollbar for dark theme */
#top3Grid.scrollable::-webkit-scrollbar {
  width: 6px;
}

#top3Grid.scrollable::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 3px;
}

#top3Grid.scrollable::-webkit-scrollbar-thumb {
  background: var(--bg-card-border);
  border-radius: 3px;
}

#top3Grid.scrollable::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.top3-card {
  background: var(--bg-card);
  border: 1px solid var(--accent-orange);
  border-left: 4px solid var(--accent-orange);
  border-radius: 10px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 180px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* When inside scrollable block mode (per-site), add margin */
#top3Grid.scrollable:not(.single-site-mode) > .top3-card {
  margin-bottom: 12px;
}

.top3-card:hover {
  box-shadow: 0 4px 16px rgba(255, 152, 0, 0.15);
}

/* ===== RANK BADGE (top-right corner) ===== */
.top3-rank-badge {
  background: var(--accent-green);
  color: #000;
  font-size: 14px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 4px;
  line-height: 1;
  display: inline-block;
  margin-bottom: 6px;
}

/* ===== CARD HEADER ===== */
.top3-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.top3-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top3-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.top3-goal-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.top3-metric-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.top3-from-goal {
  font-size: 14px;
  color: var(--accent-orange);
  font-weight: 600;
}

/* ===== SIDE-BY-SIDE VALUE BLOCKS ===== */
.top3-values-row {
  display: flex;
  gap: 24px;
  margin: 12px 0;
  align-items: flex-start;
}

.top3-value-block {
  flex: 1;
}

.top3-value-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.top3-value {
  font-size: 38px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.top3-threshold {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ===== FOOTER ===== */
.top3-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--bg-card-border);
}

.top3-prev-value {
  font-size: 14px;
  color: var(--text-secondary);
}

.top3-prev-value span {
  font-weight: 600;
  color: var(--text-primary);
}

.top3-change {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
}

.top3-change.improved {
  color: var(--accent-green);
}

.top3-change.worsened {
  color: var(--accent-red);
}

.top3-change .arrow {
  font-size: 12px;
}

/* Per-site groups */
.top3-site-group {
  margin-bottom: 16px;
}

.top3-site-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 10px;
  padding: 6px 12px;
  background: rgba(33, 150, 243, 0.08);
  border-radius: 6px;
  display: inline-block;
}

.top3-site-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* Responsive */
@media (max-width: 1024px) {
  #top3Grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #top3Grid.scrollable.single-site-mode {
    grid-template-columns: repeat(2, 1fr);
  }

  .top3-site-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  #top3Grid {
    grid-template-columns: 1fr;
  }

  #top3Grid.scrollable.single-site-mode {
    grid-template-columns: 1fr;
  }

  .top3-site-cards {
    grid-template-columns: 1fr;
  }

  .top3-value {
    font-size: 28px;
  }

  .top3-values-row {
    flex-direction: column;
    gap: 12px;
  }
}
