* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* replaced blue gradient with brown gradient */
  background: linear-gradient(135deg, #f5f1eb 0%, #f9f7f4 100%);
  min-height: 100vh;
  color: #2d3748;
  overflow-x: hidden;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.statistics-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px;
  width: 100%;
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header {
  text-align: center;
  margin-bottom: 48px;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  padding: 60px 24px;
  /* replaced blue gradient with brown gradient */
  background: linear-gradient(135deg, #8b7355 0%, #78643a 100%);
  border-bottom: 3px solid #a88264;
  position: relative;
  overflow: hidden;
  animation: slideDown 0.6s ease-out;
  box-shadow: 0 8px 32px rgba(120, 100, 58, 0.25);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  pointer-events: none;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }
}

.page-header h1 {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #ffffff;
  position: relative;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.95);
  position: relative;
  font-weight: 400;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.overview-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.stat-card {
  /* replaced blue gradient with brown gradient */
  background: linear-gradient(135deg, #a88264 0%, #8b7355 100%);
  border-radius: 20px;
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  border: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  animation: scaleIn 0.5s ease-out backwards;
  /* updated box shadow for brown theme */
  box-shadow: 0 8px 24px rgba(120, 100, 58, 0.25);
  min-height: 140px;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.stat-card:nth-child(1) {
  animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
  animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
  animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
  animation-delay: 0.4s;
}

.stat-card:nth-child(5) {
  animation-delay: 0.5s;
}

.stat-card:nth-child(6) {
  animation-delay: 0.6s;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-8px);
  /* updated hover shadow for brown theme */
  box-shadow: 0 16px 40px rgba(120, 100, 58, 0.4);
}

.stat-icon {
  font-size: 56px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
  position: relative;
  z-index: 1;
}

.stat-card:hover .stat-icon {
  transform: rotate(5deg) scale(1.1);
}


.stat-info, .stat-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    background: rgba(255, 255, 255, 0.2);
    padding: 11px 21px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.stat-value {
  font-size: 48px;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
}

.stat-card:hover .stat-value {
  transform: scale(1.05);
}

.stat-label {
  font-size: 13px;
  color: #ffffff;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  opacity: 0.95;
}

.charts-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.chart-card {
  background: white;
  border-radius: 16px;
  padding: 28px;
  /* updated border color to brown */
  border: 2px solid #a88264;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeInUp 0.6s ease-out backwards;
  /* updated box shadow for brown theme */
  box-shadow: 0 4px 12px rgba(120, 100, 58, 0.08);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chart-card:nth-child(1) {
  animation-delay: 0.2s;
}

.chart-card:nth-child(2) {
  animation-delay: 0.3s;
}

.chart-card:nth-child(3) {
  animation-delay: 0.4s;
}

.chart-card:hover {
  /* updated hover border and shadow for brown theme */
  border-color: #8b7355;
  box-shadow: 0 12px 32px rgba(120, 100, 58, 0.2);
  transform: translateY(-4px);
}

.chart-card h2 {
  font-size: 18px;
  color: #78643a;
  margin-bottom: 20px;
  font-weight: 700;
}

.chart-card canvas {
  max-height: 280px;
}

.top-students-section,
.competitions-stats-section,
.schools-stats-section,
.class-details-section {
  background: white;
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 48px;
  /* updated border color to brown */
  border: 2px solid #a88264;
  animation: fadeInUp 0.6s ease-out backwards;
  /* updated box shadow for brown theme */
  box-shadow: 0 4px 12px rgba(120, 100, 58, 0.08);
}

.top-students-section h2,
.competitions-stats-section h2,
.schools-stats-section h2,
.class-details-section h2 {
  font-size: 24px;
  color: #78643a;
  margin-bottom: 24px;
  font-weight: 700;
}

.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.student-card {
  /* replaced blue gradient with brown gradient */
  background: linear-gradient(135deg, #a88264 0%, #8b7355 100%);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  color: white;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  position: relative;
  overflow: hidden;
  animation: scaleIn 0.5s ease-out backwards;
  /* updated box shadow for brown theme */
  box-shadow: 0 4px 12px rgba(120, 100, 58, 0.25);
}

.student-card:nth-child(1) {
  animation-delay: 0.1s;
}

.student-card:nth-child(2) {
  animation-delay: 0.15s;
}

.student-card:nth-child(3) {
  animation-delay: 0.2s;
}

.student-card:nth-child(4) {
  animation-delay: 0.25s;
}

.student-card:nth-child(5) {
  animation-delay: 0.3s;
}

.student-card:nth-child(6) {
  animation-delay: 0.35s;
}

.student-card:nth-child(7) {
  animation-delay: 0.4s;
}

.student-card:nth-child(8) {
  animation-delay: 0.45s;
}

.student-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.student-card:hover {
  transform: translateY(-8px) scale(1.02);
  /* updated hover shadow for brown theme */
  box-shadow: 0 16px 32px rgba(120, 100, 58, 0.4);
}

/* Added styles for avatar initials */
.avatar-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, #8b7355 0%, #78643a 100%);
  border-radius: 50%;
}

/* Improved avatar image handling and styling */
.student-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 12px;
  /* replaced blue gradient with brown gradient */
  background: linear-gradient(135deg, #8b7355 0%, #78643a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  transition: transform 0.3s ease;
  /* updated box shadow for brown theme */
  box-shadow: 0 4px 12px rgba(120, 100, 58, 0.3);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

.student-card:hover .student-avatar {
  transform: scale(1.1) rotate(5deg);
}

.student-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.student-grade {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 12px;
  /* Added text overflow handling for longer school names */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.student-participations {
  font-size: 32px;
  font-weight: 900;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.competitions-table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  scroll-behavior: smooth;
}

.competitions-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  border-radius: 12px;
  overflow: hidden;
}

.competitions-table thead {
  /* replaced blue gradient with brown gradient */
  background: linear-gradient(135deg, #8b7355 0%, #78643a 100%);
}

.competitions-table th {
  color: white;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 18px 24px;
  text-align: left;
  border: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.competitions-table td {
  color: #2d3748;
  font-size: 14px;
  padding: 16px 24px;
  /* updated border color to brown theme light shade */
  border-bottom: 1px solid #efe4d8;
  vertical-align: middle;
}

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

.competitions-table tbody tr {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.competitions-table tbody tr:hover {
  /* updated background color for brown theme */
  background: #f5f1eb;
  transform: scale(1.01);
}

.schools-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.school-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  /* updated background color for brown theme */
  background: #f5f1eb;
  border-radius: 12px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  /* updated border color to brown */
  border: 2px solid #e8dcc8;
  animation: fadeInLeft 0.5s ease-out backwards;
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.school-item:nth-child(1) {
  animation-delay: 0.1s;
}

.school-item:nth-child(2) {
  animation-delay: 0.15s;
}

.school-item:nth-child(3) {
  animation-delay: 0.2s;
}

.school-item:nth-child(4) {
  animation-delay: 0.25s;
}

.school-item:nth-child(5) {
  animation-delay: 0.3s;
}

.school-item:hover {
  background: white;
  /* updated hover border color to brown */
  border-color: #8b7355;
  transform: translateX(8px);
  /* updated hover shadow for brown theme */
  box-shadow: 0 8px 24px rgba(120, 100, 58, 0.2);
}

.school-name {
  font-size: 16px;
  font-weight: 700;
  /* updated text color to brown */
  color: #78643a;
  margin-bottom: 4px;
  /* Added better text wrapping for long school names */
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.school-students {
  font-size: 13px;
  /* updated text color to brown shade */
  color: #8b7355;
}

.school-participations {
  font-size: 32px;
  font-weight: 900;
  /* updated text color to brown */
  color: #8b7355;
}

.planning-section {
  margin-bottom: 48px;
  animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.planning-card {
  background: white;
  border-radius: 16px;
  padding: 28px;
  /* updated border color to brown */
  border: 2px solid #a88264;
  /* updated box shadow for brown theme */
  box-shadow: 0 4px 12px rgba(120, 100, 58, 0.08);
}

.planning-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.planning-header h2 {
  font-size: 24px;
  color: #78643a;
  font-weight: 700;
}

.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  /* updated text color to brown shade */
  color: #8b7355;
  cursor: pointer;
  padding: 4px 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 6px;
}

.btn-close:hover {
  /* updated hover colors for brown theme */
  color: #78643a;
  background: #e8dcc8;
  transform: rotate(90deg);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  /* updated label color to brown */
  color: #78643a;
  font-size: 14px;
  font-weight: 600;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  /* updated border color to brown */
  border: 2px solid #a88264;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: white;
  color: #2d3748;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  /* updated focus border color to brown */
  border-color: #8b7355;
  /* updated focus shadow for brown theme */
  box-shadow: 0 0 0 3px rgba(120, 100, 58, 0.1);
  transform: translateY(-2px);
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  /* replaced blue gradient with brown gradient */
  background: linear-gradient(135deg, #8b7355 0%, #78643a 100%);
  color: white;
  /* updated box shadow for brown theme */
  box-shadow: 0 4px 12px rgba(120, 100, 58, 0.3);
}

.btn-primary:hover {
  transform: translateY(-3px);
  /* updated hover shadow for brown theme */
  box-shadow: 0 8px 20px rgba(120, 100, 58, 0.4);
}

.btn-primary:active {
  transform: translateY(-1px);
  /* updated active shadow for brown theme */
  box-shadow: 0 4px 12px rgba(120, 100, 58, 0.3);
}

.btn-secondary {
  /* updated background color for brown theme */
  background: #e8dcc8;
  /* updated text color to brown */
  color: #78643a;
  /* updated border color to brown */
  border: 2px solid #a88264;
}

.btn-secondary:hover {
  /* updated hover background for brown theme */
  background: #d8cdb8;
  /* updated hover border color to brown */
  border-color: #8b7355;
  transform: translateY(-2px);
}

.action-bar {
  text-align: center;
  padding: 24px;
  background: white;
  border-radius: 16px;
  margin-bottom: 48px;
  /* updated border color to brown */
  border: 2px solid #a88264;
  /* updated box shadow for brown theme */
  box-shadow: 0 4px 12px rgba(120, 100, 58, 0.08);
}

.btn-plan {
  padding: 14px 28px;
  /* replaced blue gradient with brown gradient */
  background: linear-gradient(135deg, #8b7355 0%, #78643a 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* updated box shadow for brown theme */
  box-shadow: 0 4px 12px rgba(120, 100, 58, 0.3);
}

.btn-plan:hover {
  transform: translateY(-3px) scale(1.02);
  /* updated hover shadow for brown theme */
  box-shadow: 0 8px 20px rgba(120, 100, 58, 0.4);
}

.btn-plan:active {
  transform: translateY(-1px) scale(1);
  /* updated active shadow for brown theme */
  box-shadow: 0 4px 12px rgba(120, 100, 58, 0.3);
}

.class-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.class-detail-card {
  /* updated background color for brown theme */
  background: #f5f1eb;
  border-radius: 12px;
  padding: 20px;
  /* updated left border color to brown */
  border-left: 4px solid #8b7355;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  /* updated border color to brown */
  border: 2px solid #e8dcc8;
  border-left: 4px solid #8b7355;
  animation: fadeInUp 0.5s ease-out backwards;
}

.class-detail-card:nth-child(1) {
  animation-delay: 0.1s;
}

.class-detail-card:nth-child(2) {
  animation-delay: 0.15s;
}

.class-detail-card:nth-child(3) {
  animation-delay: 0.2s;
}

.class-detail-card:nth-child(4) {
  animation-delay: 0.25s;
}

.class-detail-card:nth-child(5) {
  animation-delay: 0.3s;
}

.class-detail-card:nth-child(6) {
  animation-delay: 0.35s;
}

.class-detail-card:hover {
  transform: translateX(8px);
  /* updated hover border color to brown */
  border-color: #8b7355;
  /* updated hover shadow for brown theme */
  box-shadow: 0 8px 24px rgba(120, 100, 58, 0.2);
  border-left-color: #78643a;
  background: white;
}

.class-name {
  font-size: 18px;
  font-weight: 700;
  /* updated text color to brown */
  color: #78643a;
  margin-bottom: 12px;
}

.class-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  /* updated text color to brown shade */
  color: #8b7355;
  /* updated border color to brown theme light shade */
  border-bottom: 1px solid #efe4d8;
}

.class-stat-row:last-child {
  border-bottom: none;
}

.class-stat-label {
  font-weight: 600;
  /* updated text color to brown */
  color: #78643a;
}

.class-stat-value {
  font-weight: 700;
  /* updated text color to brown */
  color: #8b7355;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #8b7355;
  font-size: 15px;
  animation: pulse 2s ease-in-out infinite;
}

/* ======= LOADING / EMPTY / ERROR STATES ======= */

.state-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px 24px;
  color: #8b7355;
  font-size: 15px;
  font-weight: 500;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e8dcc8;
  border-top: 4px solid #8b7355;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: #8b7355;
  font-size: 15px;
  text-align: center;
}

.state-empty-icon {
  font-size: 48px;
  opacity: 0.6;
}

.state-empty p {
  margin: 0;
  max-width: 320px;
  line-height: 1.5;
}

.state-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: #a0522d;
  font-size: 15px;
  text-align: center;
}

.state-error-icon {
  font-size: 40px;
}

.state-error p {
  margin: 0;
  max-width: 320px;
  line-height: 1.5;
}

.btn-retry {
  margin-top: 8px;
  padding: 10px 24px;
  background: linear-gradient(135deg, #8b7355 0%, #78643a 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(120, 100, 58, 0.3);
}

.btn-retry:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(120, 100, 58, 0.4);
}

/* Teacher card variant */
.teacher-card .student-grade {
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
  line-height: 1.4;
}

/* ======= STATUS BADGES ======= */

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-badge.active {
  background: #d4edda;
  color: #155724;
}

.status-badge.upcoming {
  background: #fff3cd;
  color: #856404;
}

.status-badge.completed {
  background: #e8dcc8;
  color: #78643a;
}

/* ======= PARTICIPATION LABEL ======= */

.student-participations-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-top: 2px;
}

/* ======= STATISTICS MODE SELECTION MODAL ======= */

.stats-mode-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.3s ease-out;
}

.stats-mode-modal {
  background: white;
  border-radius: 24px;
  padding: 48px 40px;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
  animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.stats-mode-header {
  text-align: center;
  margin-bottom: 36px;
}

.stats-mode-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: #78643a;
  margin-bottom: 8px;
}

.stats-mode-header p {
  font-size: 15px;
  color: #8b7355;
}

.stats-mode-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stats-mode-btn {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: #f5f1eb;
  border: 2px solid #e8dcc8;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  width: 100%;
}

.stats-mode-btn:hover:not(:disabled) {
  background: white;
  border-color: #8b7355;
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(120, 100, 58, 0.2);
}

.stats-mode-btn:active:not(:disabled) {
  transform: translateY(-2px);
}

.stats-mode-btn:disabled {
  cursor: not-allowed;
}

.stats-mode-icon {
  font-size: 48px;
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #a88264 0%, #8b7355 100%);
  border-radius: 16px;
  filter: none;
}

.stats-mode-info {
  flex: 1;
}

.stats-mode-title {
  font-size: 18px;
  font-weight: 700;
  color: #78643a;
  margin-bottom: 4px;
}

.stats-mode-desc {
  font-size: 13px;
  color: #8b7355;
  line-height: 1.5;
}

/* Mode switcher in page header */
.stats-mode-switcher {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
}

.mode-switch-btn {
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-switch-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
}

.mode-switch-btn.active {
  background: rgba(255, 255, 255, 0.95);
  border-color: white;
  color: #78643a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ======= INSTITUTION BANNER ======= */

.institution-banner {
  background: linear-gradient(135deg, #8b7355 0%, #78643a 100%);
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: 0 8px 24px rgba(120, 100, 58, 0.25);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.5s ease-out;
}

.institution-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.institution-banner-content {
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
  z-index: 1;
}

.institution-banner-icon {
  font-size: 56px;
  flex-shrink: 0;
}

.institution-banner-info h2 {
  font-size: 28px;
  font-weight: 700;
  color: white;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.institution-banner-info p {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.9);
}

/* ПОВНА АДАПТАЦІЯ ПІД ВСІ ПРИСТРОЇ */

@media (max-width: 1024px) {
  .statistics-page {
    padding: 32px 20px;
  }

  .page-header {
    padding: 48px 20px;
  }

  .page-header h1 {
    font-size: 40px;
  }

  .subtitle {
    font-size: 16px;
  }

  .overview-section {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .stat-card {
    padding: 24px;
    min-height: 120px;
  }

  .stat-icon {
    font-size: 48px;
  }

  .stat-value {
    font-size: 40px;
  }

  .charts-section {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .chart-card canvas {
    max-height: 260px;
  }

  .students-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .class-details-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 768px) {
  .statistics-page {
    padding: 24px 16px;
  }

  .page-header {
    padding: 36px 16px;
    margin-bottom: 32px;
  }

  .page-header h1 {
    font-size: 32px;
    /* Corrected: Completed the font-size property */
  }

  .subtitle {
    font-size: 14px;
    /* Added for consistency, scaling down from 16px */
  }

  .overview-section {
    grid-template-columns: 1fr;
    /* Stack cards on smaller screens */
    gap: 12px;
    margin-bottom: 32px;
  }

  .stat-card {
    padding: 20px;
    min-height: 100px;
    flex-direction: column;
    /* Stack icon and info vertically */
    text-align: center;
    gap: 16px;
  }

  .stat-icon {
    font-size: 40px;
  }

  .stat-info {
    padding: 16px 24px;
  }

  .stats-mode-modal {
    padding: 32px 20px;
  }

  .stats-mode-header h2 {
    font-size: 22px;
  }

  .stats-mode-btn {
    padding: 16px;
    gap: 14px;
  }

  .stats-mode-icon {
    font-size: 36px;
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .stats-mode-title {
    font-size: 15px;
  }

  .stats-mode-desc {
    font-size: 12px;
  }

  .stats-mode-switcher {
    flex-direction: row;
    gap: 6px;
  }

  .mode-switch-btn {
    padding: 8px 16px;
    font-size: 13px;
  }

  .institution-banner {
    padding: 20px;
  }

  .institution-banner-content {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  .institution-banner-info h2 {
    font-size: 22px;
  }
}