/* ===== Dashboard-specific styles ===== */
/* Extends the base styles.css design system */

/* ===== Dashboard Container ===== */
.dash-container {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ===== Dashboard Header ===== */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.back-link:hover {
  background: rgba(124, 92, 252, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: scale(1.08);
}

.dash-header h1 {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.dash-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ===== Range Selector ===== */
.range-selector {
  display: flex;
  gap: 6px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  padding: 4px;
}

.range-btn {
  padding: 7px 16px;
  border-radius: 100px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.range-btn:hover {
  color: var(--text-primary);
}

.range-btn.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 10px var(--accent-primary-glow);
}

/* ===== KPI Row ===== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  padding: 22px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  text-align: center;
  transition: all var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.kpi-icon {
  font-size: 28px;
  margin-bottom: 10px;
}

.kpi-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Chart Cards ===== */
.chart-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px;
  transition: all var(--transition-fast);
}

.chart-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

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

.chart-card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-badge {
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(124, 92, 252, 0.1);
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 600;
}

.chart-body {
  position: relative;
  width: 100%;
}

.chart-body canvas {
  width: 100% !important;
  max-height: 260px;
}

.chart-body-donut {
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-body-donut canvas {
  max-height: 240px;
  max-width: 240px;
}

/* ===== Progress Rings ===== */
.ring-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 8px 0;
}

.ring-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ring-svg {
  width: 70px;
  height: 70px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 6;
}

.ring-fill {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-out;
}

.ring-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: capitalize;
  text-align: center;
}

.ring-pct {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
}

/* ===== Heatmap ===== */
.heatmap-section {
  margin-bottom: 24px;
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, 30px);
  gap: 4px;
  justify-content: center;
  padding: 8px 0;
}

.heatmap-cell {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: rgba(124, 92, 252, 0.06);
  position: relative;
  cursor: default;
  transition: transform var(--transition-fast);
}

.heatmap-cell:hover {
  transform: scale(1.2);
  z-index: 2;
}

.heatmap-cell .tooltip {
  display: none;
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  z-index: 10;
  pointer-events: none;
}

.heatmap-cell:hover .tooltip {
  display: block;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 12px;
}

.heatmap-legend-label {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 4px;
}

.heatmap-cell-legend {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .chart-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .range-selector {
    width: 100%;
    justify-content: center;
  }

  .kpi-value {
    font-size: 26px;
  }

  .ring-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .ring-svg {
    width: 56px;
    height: 56px;
  }
}

@media (max-width: 480px) {
  .dash-container {
    padding: 16px 12px 40px;
  }

  .dash-header h1 {
    font-size: 20px;
  }

  .ring-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .heatmap {
    grid-template-columns: repeat(auto-fill, 24px);
    gap: 3px;
  }

  .heatmap-cell {
    width: 24px;
    height: 24px;
    border-radius: 4px;
  }
}