/* Stats Dashboard Styles */
.stats-dashboard {
  margin: 20px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Tier Badge Styles */
.tier-badge-container {
  margin-bottom: 25px;
  display: flex;
  justify-content: center;
}

.tier-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px 40px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  color: white;
  min-width: 300px;
  position: relative;
  overflow: hidden;
}

.tier-badge::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: rotate(45deg);
}

.tier-rank {
  font-size: 14px;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 5px;
}

.tier-name {
  font-size: 32px;
  font-weight: 700;
  margin: 10px 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.tier-description {
  font-size: 16px;
  opacity: 0.95;
  font-style: italic;
}

/* Tier-specific colors */
.tier-level-1 {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.tier-level-2 {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.tier-level-3 {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.tier-level-4 {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.tier-level-5 {
  background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
}

.tier-level-6 {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.tier-level-7 {
  background: linear-gradient(135deg, #ff9a56 0%, #ff6a88 100%);
}

.tier-level-8 {
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  color: #333;
}

.tier-level-9 {
  background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
}

.tier-level-10 {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stats-row {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
}

.stats-dropdown {
  flex: 1;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stats-dropdown.full-width {
  flex: 1 1 100%;
}

.stats-toggle {
  width: 100%;
  padding: 15px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.site-stats .stats-toggle {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stats-toggle:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.stats-toggle.active .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-arrow {
  transition: transform 0.3s ease;
  font-size: 12px;
}

.stats-label {
  font-size: 18px;
}

.stats-grade,
.stats-average {
  background: rgba(255,255,255,0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  margin-left: auto;
  margin-right: 15px;
}

.stats-content {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.stats-content.show {
  max-height: 800px; /* Increased to allow help section to expand */
  padding: 20px;
  overflow-y: auto; /* Only adds scroll if content exceeds 800px */
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.stats-table th {
  text-align: left;
  padding: 12px 8px;
  background: #f8f9fa;
  font-weight: 600;
  color: #495057;
  border-bottom: 2px solid #dee2e6;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-table th.text-center {
  text-align: center;
}

.stats-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e9ecef;
}

.stats-table td.text-center {
  text-align: center;
}

.stats-table tr:hover {
  background: #f8f9fa;
}

.stats-table .total-row td {
  font-weight: 600;
  background: #e9ecef;
  border-top: 2px solid #dee2e6;
  padding: 12px 8px;
}

.stats-table .disabled-row {
  opacity: 0.4;
  font-style: italic;
}

.stats-table .disabled-row:hover {
  background: transparent;
  cursor: not-allowed;
}

.coming-soon {
  font-size: 11px;
  color: #6c757d;
  font-weight: normal;
  margin-left: 5px;
}

/* Variance cell colors */
.variance-cell .positive {
  color: #28a745;
  font-weight: 600;
}

.variance-cell .negative {
  color: #dc3545;
  font-weight: 600;
}

.variance-cell .neutral {
  color: #6c757d;
}

/* Help Section */
.stats-help-section {
  border-top: 2px solid #dee2e6;
  margin-top: 15px;
  padding-top: 10px;
}

.stats-help-toggle {
  width: 100%;
  padding: 10px 15px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #495057;
  transition: background 0.2s ease;
}

.stats-help-toggle:hover {
  background: #e9ecef;
}

.stats-help-toggle.active .help-arrow {
  transform: rotate(180deg);
}

.help-arrow {
  transition: transform 0.3s ease;
  font-size: 12px;
}

.stats-help-content {
  padding: 15px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 4px 4px;
  font-size: 13px;
  line-height: 1.6;
  max-height: none; /* Let it expand naturally */
  overflow: visible;
}

.help-item {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #dee2e6;
}

.help-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.help-item strong {
  color: #495057;
  display: block;
  margin-bottom: 4px;
}

.help-item em {
  color: #6c757d;
  font-size: 12px;
}

/* Variance Display */
.stats-variance {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.variance-content {
  color: white;
  font-size: 18px;
  font-weight: 500;
}

.variance-value {
  font-size: 32px;
  font-weight: 700;
  margin: 0 8px;
}

.variance-content.above {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  padding: 15px;
  border-radius: 8px;
}

.variance-content.below {
  background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
  padding: 15px;
  border-radius: 8px;
}

.variance-percent {
  display: inline-block;
  margin-left: 8px;
  font-size: 14px;
  opacity: 0.9;
}

/* Responsive */
@media (max-width: 768px) {
  .stats-row {
    flex-direction: column;
  }
  
  .variance-content {
    font-size: 16px;
  }
  
  .variance-value {
    font-size: 24px;
  }
}