/* ==========================================================================
   Kazi Nazrul Academy - Dedicated Stylesheet for Merit Roster (merit-roster.html)
   Scope: Page-specific styles only (Base/header/footer loaded via style.css)
   ========================================================================== */

/* Page Wrapper */
.merit-page-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Hero / Lead Banner */
.merit-lead-box {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 40%, #f0fdf4 100%);
  border: 1px solid #fde68a;
  border-left: 6px solid #d97706;
  border-radius: 14px;
  padding: 24px 28px;
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.08);
}

.merit-lead-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.merit-lead-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 10px;
}

.merit-lead-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #d97706;
  color: #ffffff;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.merit-lead-box p {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.7;
  color: #451a03;
}

/* Toolbar & Filter Bar */
.merit-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.merit-search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.merit-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.9rem;
  pointer-events: none;
}

.merit-search-input {
  width: 100%;
  height: 46px;
  min-height: 46px;
  box-sizing: border-box;
  padding: 0 14px 0 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: max(0.9rem, 16px);
  color: #1e293b;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.merit-search-input:focus {
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.merit-filters-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.merit-filter-select {
  height: 46px;
  min-height: 46px;
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: max(0.88rem, 16px);
  color: #334155;
  background: #ffffff;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: border-color 0.2s ease;
}

.merit-filter-select:focus {
  border-color: #d97706;
}

.merit-filters-group .kna-custom-select {
  min-width: 190px;
}

/* Status Strip */
.merit-status-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.88rem;
  color: #475569;
}

.merit-status-strip strong {
  color: #b45309;
  font-weight: 700;
}

/* Merit Roster Grid */
.merit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

/* Student Card */
.ts-student-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.ts-student-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(217, 119, 6, 0.12);
  border-color: #fde68a;
}

/* Photo Frame & Rank Badge */
.ts-photo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f8fafc;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ts-student-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
  display: block;
}

.ts-student-card:hover .ts-student-photo {
  transform: scale(1.03);
}

.ts-initials-avatar {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: #ffffff;
  letter-spacing: 2px;
  user-select: none;
}

.ts-rank-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.4px;
  z-index: 2;
  text-transform: uppercase;
}

.ts-rank-badge.rank-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
}

.ts-rank-badge.rank-silver {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(100, 116, 139, 0.4);
}

.ts-rank-badge.rank-bronze {
  background: linear-gradient(135deg, #b45309, #78350f);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(120, 53, 15, 0.4);
}

.ts-rank-badge.rank-standard {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

/* Card Body */
.ts-card-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-grow: 1;
}

.ts-student-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ts-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ts-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  line-height: 1.4;
}

.ts-pill-class {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.ts-pill-year {
  background: #fefce8;
  color: #854d0e;
  border: 1px solid #fef08a;
}

/* Score Section */
.ts-score-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.ts-score-bar-wrap {
  flex: 1;
  height: 8px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
}

.ts-score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 9999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.ts-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.ts-score-badge i {
  font-size: 0.75rem;
  color: #f59e0b;
}

/* Board Tag */
.ts-board-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.ts-board-tag i {
  color: #0ea5e9;
  flex-shrink: 0;
}

/* Skeleton Loading Shimmer */
.skeleton-shimmer {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.ts-card-skeleton {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.skel-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
}

.skel-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skel-line {
  height: 16px;
  border-radius: 4px;
}

.skel-line.w-75 { width: 75%; }
.skel-line.w-50 { width: 50%; height: 20px; border-radius: 9999px; }
.skel-line.w-40 { width: 40%; height: 14px; margin-top: 6px; }

/* Empty / Fallback State */
.merit-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 24px;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  color: #64748b;
}

.merit-empty-icon {
  font-size: 3rem;
  color: #f59e0b;
  margin-bottom: 16px;
}

.merit-empty h3 {
  font-size: 1.25rem;
  color: #1e293b;
  margin: 0 0 8px;
  font-weight: 700;
}

.merit-empty p {
  margin: 0 auto 20px;
  max-width: 480px;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
  body[data-page="merit-roster"] .main {
    padding-top: 138px;
  }
  .merit-lead-box {
    padding: 20px 18px;
  }
  .merit-lead-title {
    font-size: 1.2rem;
  }
  .merit-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
  }
  .merit-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    gap: 10px;
  }
  .merit-search-box {
    min-width: 100%;
  }
  .merit-filters-group {
    width: 100%;
    flex-direction: column;
  }
  .merit-filters-group .kna-custom-select,
  .merit-filter-select {
    width: 100%;
    min-width: 100%;
  }
}

@media (max-width: 480px) {
  .merit-lead-box {
    padding: 16px 14px;
    border-left-width: 4px;
  }
  .merit-lead-title {
    font-size: 1.15rem;
  }
  .merit-lead-badge {
    font-size: 0.8rem;
    padding: 5px 12px;
  }
  .merit-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .ts-photo-wrap {
    aspect-ratio: 4 / 3;
    max-height: 240px;
  }
  .ts-card-body {
    padding: 16px 16px 18px;
  }
  .merit-status-strip {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

@media (max-width: 360px) {
  .merit-lead-box {
    padding: 14px 10px;
  }
  .merit-lead-title {
    font-size: 1.05rem;
  }
  .ts-card-body {
    padding: 12px 10px 14px;
  }
  .merit-toolbar {
    padding: 10px;
  }
}
