/* Dashboard Totals */
.dashboard-filters {
  display: flex;
  align-items: center;
}

.timeframe-filter-form {
  margin: 0;
}

.timeframe-select {
  padding: 0.5rem 2rem 0.5rem 1rem;
  font-size: 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: white;
  color: #374151;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  transition: all 0.2s;
}

.timeframe-select:hover {
  border-color: #9ca3af;
}

.timeframe-select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.dashboard-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.05;
  z-index: 0;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Color variants with gradients */
.stat-card--blue::before {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.stat-card--purple::before {
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.stat-card--green::before {
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.stat-card--orange::before {
  background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.stat-card--blue .stat-icon {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.stat-card--purple .stat-icon {
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.stat-card--green .stat-icon {
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.stat-card--orange .stat-icon {
  background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
}

.stat-icon svg {
  width: 24px;
  height: 24px;
  color: white;
}

.stat-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  margin-bottom: 0;
  line-height: 1;
}

.stat-value-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  line-height: 1;
}

.stat-card--blue .stat-engaged {
  color: #3498db;
}

.stat-card--purple .stat-engaged {
  color: #9b59b6;
}

.stat-card--green .stat-engaged {
  color: #2ecc71;
}

.stat-card--orange .stat-engaged {
  color: #e67e22;
}

.stat-separator {
  color: #d1d5db;
  font-weight: 400;
}

.stat-total {
  color: #9ca3af;
  font-size: 1.5rem;
}

.stat-sublabel {
  font-size: 0.625rem;
  color: #9ca3af;
  margin-top: 0.25rem;
  line-height: 1;
  white-space: nowrap;
}

/* Circular progress indicator */
.stat-progress {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.stat-progress-ring {
  width: 42px;
  height: 42px;
}

.circular-chart {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.circle-bg {
  fill: none;
  stroke: #f3f4f6;
  stroke-width: 3.8;
}

.circle {
  fill: none;
  stroke-width: 3.8;
  stroke-linecap: round;
  animation: progress 1s ease-out forwards;
}

.stat-card--blue .circle {
  stroke: #3498db;
}

.stat-card--purple .circle {
  stroke: #9b59b6;
}

.stat-card--green .circle {
  stroke: #2ecc71;
}

.stat-card--orange .circle {
  stroke: #e67e22;
}

@keyframes progress {
  0% {
    stroke-dasharray: 0 100;
  }
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dashboard-card {
  background: white;
  border-radius: 6px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: visible;
}

.dashboard-card-wide {
  grid-column: 1 / -1;
}

.dashboard-card h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #f3f4f6;
}

.dashboard-card h3 {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  margin: 1rem 0 0.75rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.top-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #fafbfc;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s;
}

.top-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  transform: translateX(2px);
}

/* Ranking badges */
.rank-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rank-badge--1 {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
  color: #916c00;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.rank-badge--2 {
  background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 50%, #c0c0c0 100%);
  color: #5a5a5a;
  box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
}

.rank-badge--3 {
  background: linear-gradient(135deg, #cd7f32 0%, #e6a157 50%, #cd7f32 100%);
  color: #5c3a1a;
  box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

.rank-badge--4,
.rank-badge--5 {
  background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
  color: white;
}

.top-item-content {
  flex: 1;
  min-width: 0;
}

.top-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.top-item-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: #111827;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-item-name a {
  color: #3498db;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.top-item-name a:hover {
  color: #2980b9;
}

.top-item-value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.count-badge {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  padding: 0.25rem 0.625rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
  cursor: help;
  transition: all 0.2s;
  position: relative;
}

.count-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 6px rgba(52, 152, 219, 0.4);
}

/* Custom tooltip */
.count-badge[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #1f2937;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.count-badge[data-tooltip]::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1f2937;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 1000;
}

.count-badge[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.count-badge[data-tooltip]:hover::after {
  opacity: 1;
}

/* Horizontal bar chart */
.top-item-bar {
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}

.top-item-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3498db 0%, #2ecc71 100%);
  border-radius: 3px;
  transform-origin: left;
  animation: fillBar 1s ease-out;
}

@keyframes fillBar {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

.top-item:nth-child(1) .top-item-bar-fill {
  background: linear-gradient(90deg, #ffd700 0%, #ffed4e 100%);
}

.top-item:nth-child(2) .top-item-bar-fill {
  background: linear-gradient(90deg, #8b9dc3 0%, #b4c5e4 100%);
}

.top-item:nth-child(3) .top-item-bar-fill {
  background: linear-gradient(90deg, #cd7f32 0%, #e6a157 100%);
}

.top-item:nth-child(4) .top-item-bar-fill,
.top-item:nth-child(5) .top-item-bar-fill {
  background: linear-gradient(90deg, #3498db 0%, #5dade2 100%);
}


/* Distribution List */
.distribution-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.distribution-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #f9fafb;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.distribution-item:hover {
  background: #f3f4f6;
}

.distribution-item--enhanced {
  flex-direction: row;
  align-items: center;
  padding: 0.625rem 0.875rem;
  background: #fafbfc;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  gap: 0.75rem;
  transition: all 0.2s;
}

.distribution-item--enhanced:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  transform: translateX(2px);
}

.distribution-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.distribution-name-wrapper {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.distribution-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.distribution-category {
  font-size: 0.6875rem;
  color: #9ca3af;
  font-weight: 400;
  flex-shrink: 0;
}

.distribution-value {
  font-size: 0.8125rem;
  color: #6b7280;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.distribution-value-wrapper {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.activity-count-badge {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  padding: 0.25rem 0.625rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3);
  min-width: 35px;
  text-align: center;
  cursor: help;
  transition: all 0.2s;
  position: relative;
}

.activity-count-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 8px rgba(26, 188, 156, 0.4);
}

/* Custom tooltip for activity count */
.activity-count-badge[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #1f2937;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.activity-count-badge[data-tooltip]::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1f2937;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 1000;
}

.activity-count-badge[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.activity-count-badge[data-tooltip]:hover::after {
  opacity: 1;
}

.progress-bar {
  width: 100px;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.progress-bar--enhanced {
  width: 150px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.progress-fill {
  height: 100%;
  background: #3498db;
  transition: width 0.3s ease;
}

.progress-fill--enhanced {
  height: 100%;
  background: linear-gradient(90deg, #e74c3c 0%, #c0392b 100%);
  border-radius: 4px;
  transform-origin: left;
  animation: fillActivityBar 1s ease-out;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

@keyframes fillActivityBar {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

/* Red variant for Activities total */
.impact-total--enhanced.impact-total--teal {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

/* Student Impact */
.impact-summary {
  margin-bottom: 1.5rem;
}

.impact-total {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background: #3498db;
  border-radius: 6px;
  text-align: center;
  color: white;
}

.impact-total--enhanced {
  background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.25rem;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.impact-total--enhanced::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }
}

.impact-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(10px);
}

.impact-icon svg {
  width: 28px;
  height: 28px;
  color: white;
}

.impact-content {
  flex: 1;
  position: relative;
  z-index: 1;
}

.impact-label {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  opacity: 0.95;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.impact-number {
  font-size: 2.75rem;
  font-weight: 700;
  display: block;
  line-height: 1;
}

.impact-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.impact-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: #f9fafb;
  border-radius: 4px;
}

.impact-item--enhanced {
  flex-direction: row;
  align-items: center;
  padding: 0.625rem 0.875rem;
  background: #fafbfc;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  gap: 0.75rem;
  transition: all 0.2s;
}

.impact-item--enhanced:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  transform: translateX(2px);
}

.impact-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.impact-item-name-wrapper {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.impact-item-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.impact-item-category {
  font-size: 0.6875rem;
  color: #9ca3af;
  font-weight: 400;
  flex-shrink: 0;
}

.impact-item-value {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.student-count-badge {
  background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
  color: white;
  padding: 0.25rem 0.625rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(230, 126, 34, 0.3);
  min-width: 45px;
  text-align: center;
  cursor: help;
  transition: all 0.2s;
  position: relative;
}

.student-count-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 8px rgba(230, 126, 34, 0.4);
}

/* Custom tooltip for student count */
.student-count-badge[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #1f2937;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.student-count-badge[data-tooltip]::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1f2937;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 1000;
}

.student-count-badge[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.student-count-badge[data-tooltip]:hover::after {
  opacity: 1;
}

/* Impact horizontal bars */
.impact-bar {
  width: 150px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.impact-bar-fill {
  height: 100%;
  border-radius: 4px;
  transform-origin: left;
  animation: fillImpactBar 1s ease-out;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  background: linear-gradient(90deg, #e67e22 0%, #f39c12 100%);
}

@keyframes fillImpactBar {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

/* Badge Variations */
.badge-primary {
  background: #3498db;
  color: white;
}

/* Empty State */
.empty-state {
  text-align: center;
  color: #9ca3af;
  padding: 1.5rem;
  font-size: 0.875rem;
  font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .dashboard-totals {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-card-wide {
    grid-column: 1;
  }
}