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

body {
  font-family: 'Cairo', sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 88px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px;
}

.header {
  text-align: center;
  margin-bottom: 30px;
  background: #fff;
  padding: 36px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 10px;
}

.header p {
  color: #7f8c8d;
  font-size: 1.1rem;
}

.back-btn {
  background: linear-gradient(135deg, #c8102e 0%, #a00d24 100%);
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  border: 2px solid #c8102e;
  transition: 0.3s;
}

.back-btn:hover {
  transform: translateY(-2px);
  color: #fff;
  box-shadow: 0 5px 15px rgba(200, 16, 46, 0.3);
}

.tabs-container {
  background: #fff;
  border-radius: 20px;
  padding: 36px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.tabs-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.tab-btn {
  background: #f8f9fa;
  color: #495057;
  border: 2px solid #e9ecef;
  padding: 12px 22px;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.3s;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: 'Cairo', sans-serif;
}

.tab-btn.active {
  background: linear-gradient(135deg, #c8102e 0%, #a00d24 100%);
  color: #fff;
  border-color: #c8102e;
  box-shadow: 0 5px 15px rgba(200, 16, 46, 0.3);
}

.tab-btn:hover {
  transform: translateY(-2px);
  border-color: #c8102e;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.section-title {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #dee2e6;
}

.students-table {
  width: 100%;
  background: #fff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  border: 1px solid #e9ecef;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.table-info,
.table-page-size {
  font-size: 0.92rem;
  font-weight: 600;
  color: #6c757d;
}

.table-page-size strong {
  color: #c8102e;
  margin-right: 4px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e9ecef;
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  background: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.data-table thead th {
  background: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
  font-weight: 700;
  color: #495057;
  font-size: 0.9rem;
  padding: 14px 16px;
  text-align: center;
  white-space: nowrap;
}

.data-table thead th:nth-child(2) {
  text-align: right;
}

.data-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid #f1f3f4;
  text-align: center;
  vertical-align: middle;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.data-table tbody tr:nth-child(even) {
  background: #fcfdff;
}

.data-table tbody tr:hover {
  background: linear-gradient(135deg, #fff5f5 0%, #f8f9fa 100%);
}

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

.table-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 2px solid #e9ecef;
  background: #fff;
  color: #495057;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  cursor: pointer;
  transition: 0.2s;
}

.page-btn:hover:not(:disabled) {
  border-color: #c8102e;
  color: #c8102e;
}

.page-btn.active {
  background: linear-gradient(135deg, #c8102e, #a00d24);
  border-color: #c8102e;
  color: #fff;
  box-shadow: 0 4px 12px rgba(200, 16, 46, 0.25);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.rank-cell {
  text-align: center;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #c8102e, #a00d24);
  padding: 8px 10px;
  border-radius: 50px;
  border: 2px solid #c8102e;
  min-width: 42px;
  display: inline-block;
}

.rank-cell.gold {
  background: linear-gradient(135deg, #f1c40f, #d4ac0d);
  border-color: #d4ac0d;
  color: #3d3200;
}

.rank-cell.silver {
  background: linear-gradient(135deg, #bdc3c7, #95a5a6);
  border-color: #95a5a6;
  color: #2c3e50;
}

.rank-cell.bronze {
  background: linear-gradient(135deg, #e67e22, #d35400);
  border-color: #d35400;
}

.name-cell {
  font-weight: 600;
  color: #2c3e50;
  text-align: right !important;
}

.data-cell {
  text-align: center;
  font-weight: 600;
  color: #495057;
}

.score-cell {
  color: #c8102e;
  font-weight: 700;
}

.percentage-cell {
  color: #27ae60;
  font-weight: 700;
}

.case-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.case-pill.is-pass {
  background: #e8f8ef;
  color: #178a4b;
  border: 1px solid #b7e4c7;
}

.case-pill.is-fail {
  background: #fff0f3;
  color: #c8102e;
  border: 1px solid #f5c2cb;
}

.data-table tbody tr.row-pass {
  background: #f4fbf7;
}

.data-table tbody tr.row-pass:hover {
  background: linear-gradient(135deg, #e8f8ef 0%, #f8f9fa 100%);
}

.data-table tbody tr.row-fail {
  background: #fff5f7;
}

.data-table tbody tr.row-fail:hover {
  background: linear-gradient(135deg, #ffe8ec 0%, #f8f9fa 100%);
}

.no-data {
  text-align: center;
  padding: 40px;
  color: #7f8c8d;
  font-size: 1.1rem;
}

.live-badge {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: stretch;
  gap: 0;
  width: auto;
  min-width: 220px;
  max-width: calc(100vw - 32px);
  background: linear-gradient(135deg, #c8102e 0%, #a00d24 100%);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 8px 10px;
  box-shadow: 0 10px 28px rgba(200, 16, 46, 0.35);
}

.live-badge-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 6px 18px;
  box-shadow: none;
  flex: 1;
  text-align: center;
}

.live-badge-item.online,
.live-badge-item.visits {
  border: none;
  background: transparent;
}

.live-badge-sep {
  width: 1px;
  align-self: stretch;
  margin: 4px 0;
  background: rgba(255, 255, 255, 0.28);
  flex-shrink: 0;
}

.live-badge-item i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.7rem;
  margin: 0;
  flex-shrink: 0;
}

.live-badge-item.online i {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  position: relative;
}

.live-badge-item.online i.online-glow {
  color: transparent;
  background: rgba(255, 255, 255, 0.18);
}

.live-badge-item.online i.online-glow::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.75);
  animation: onlineGlow 1.6s ease-out infinite;
}

.live-badge-item.visits i {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.live-badge-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.live-badge-label,
.live-badge-text {
  display: none;
}

@keyframes onlineGlow {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); opacity: 1; }
  70% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); opacity: 0.85; }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

@media (max-width: 768px) {
  .container { padding: 20px 12px; }
  .header h1 { font-size: 1.6rem; }
  .tabs-container { padding: 20px 14px; }
  .data-table { min-width: 560px; }
  .live-badge {
    left: 12px;
    right: 12px;
    bottom: 12px;
    transform: none;
    width: auto;
    max-width: none;
    justify-content: space-around;
    padding: 10px 12px;
    border-radius: 18px;
  }
  .live-badge-item {
    padding: 2px 6px;
    flex: 1;
    justify-content: center;
  }
  .live-badge-num { font-size: 0.9rem; }
  body { padding-bottom: 84px; }
}
