/* ==========================================================================
   UNPG BSc Math 2024-2028 Results Portal Stylesheet
   ========================================================================== */

.results-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  width: 100%;
}

/* Hero Section */
.unpg-hero {
  padding: 2.5rem 0 1.5rem;
  text-align: center;
}

.unpg-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-cyan);
  margin-bottom: 1rem;
}

.unpg-title {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.unpg-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 720px;
  margin: 0 auto 1.5rem;
}

/* Quick Metrics Bar */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.metric-pill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s ease;
}

.metric-pill-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.metric-icon.gold {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.metric-icon.purple {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.metric-icon.emerald {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.metric-data {
  display: flex;
  flex-direction: column;
}

.metric-val {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Main Navigation Tabs */
.portal-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.portal-tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
}

.portal-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.portal-tab-btn.active {
  color: var(--accent-cyan);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-color: transparent;
}

.portal-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-cyan);
}

.tab-badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
}

/* Tab Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.25s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Tab 1: Search & Find Results
   ========================================================================== */

.search-box-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.3);
}

.search-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-input-group {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.85rem 2.75rem 0.85rem 2.85rem;
  font-size: 1rem;
  font-family: var(--font-sans);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-clear-btn {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem;
  display: none;
}

.search-clear-btn:hover {
  color: var(--text-primary);
}

.search-btn {
  padding: 0.85rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-sans);
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.search-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.search-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.search-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s ease;
}

.search-chip:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Results Feedback & Filter */
.results-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.results-count {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.results-count strong {
  color: var(--text-primary);
}

.filter-select {
  padding: 0.45rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
}

/* Student Cards Grid */
.students-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.student-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.student-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.4);
}

.student-card-top {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.student-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(99, 102, 241, 0.2));
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-cyan);
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.student-meta {
  flex: 1;
  min-width: 0;
}

.student-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-roll {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.roll-last-tag {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.75rem;
}

.student-scores-row {
  display: flex;
  gap: 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.score-col {
  flex: 1;
}

.score-col-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.score-col-val {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.score-col-val.topper {
  color: #f59e0b;
}

.score-col-val.good {
  color: #10b981;
}

.student-semesters-list {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.sem-pill {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.sem-pill.completed {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.sem-pill.discontinued {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.student-card-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-card-profile {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-card-profile:hover {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #04101e;
}

.btn-card-pdf {
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-card-pdf:hover {
  background: #a855f7;
  color: #fff;
}

/* Empty State */
.empty-results {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   Tab 2: Toppers & Rankings
   ========================================================================== */

.topper-subtabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.subtab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.subtab-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.subtab-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
}

/* Podium Cards */
.podium-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
  align-items: flex-end;
}

@media (max-width: 768px) {
  .podium-grid {
    grid-template-columns: 1fr;
  }
}

.podium-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.25rem;
  text-align: center;
  position: relative;
  transition: all 0.2s ease;
}

.podium-card:hover {
  transform: translateY(-4px);
}

.podium-card.rank-1 {
  order: 2;
  border-color: rgba(245, 158, 11, 0.4);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-card) 60%);
  padding-top: 2.25rem;
  box-shadow: 0 10px 30px -10px rgba(245, 158, 11, 0.2);
}

.podium-card.rank-2 {
  order: 1;
  border-color: rgba(148, 163, 184, 0.4);
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.08) 0%, var(--bg-card) 60%);
}

.podium-card.rank-3 {
  order: 3;
  border-color: rgba(180, 83, 9, 0.4);
  background: linear-gradient(180deg, rgba(180, 83, 9, 0.08) 0%, var(--bg-card) 60%);
}

@media (max-width: 768px) {
  .podium-card.rank-1 { order: 1; }
  .podium-card.rank-2 { order: 2; }
  .podium-card.rank-3 { order: 3; }
}

.podium-crown {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.podium-rank-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.podium-card.rank-1 .podium-rank-badge {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.podium-card.rank-2 .podium-rank-badge {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

.podium-card.rank-3 .podium-rank-badge {
  background: rgba(180, 83, 9, 0.2);
  color: #d97706;
}

.podium-name {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.podium-roll {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.podium-score {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.podium-score-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* Leaderboard Table */
.leaderboard-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.leaderboard-table th {
  background: var(--bg-secondary);
  padding: 0.85rem 1.25rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.leaderboard-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.85rem;
}

.rank-pill.r1 {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.rank-pill.r2 {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

.rank-pill.r3 {
  background: rgba(180, 83, 9, 0.2);
  color: #d97706;
}

/* ==========================================================================
   Tab 3: Semester Overviews
   ========================================================================== */

.semester-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.sem-select-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.sem-select-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.sem-select-card.active {
  border-color: var(--accent-cyan);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08) 0%, var(--bg-card) 100%);
  box-shadow: 0 0 0 1px var(--accent-cyan);
}

.sem-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.sem-card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.sem-detail-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.sem-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.sem-metric-box {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

.sem-metric-val {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.sem-metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 0.25rem;
}

/* Grade Distribution Bar */
.grades-dist-wrap {
  margin: 2rem 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.grades-dist-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.grades-bar {
  height: 24px;
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.grade-seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  transition: opacity 0.2s ease;
}

.grade-seg:hover {
  opacity: 0.85;
}

.grades-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* ==========================================================================
   Tab 4: Subject Profiles
   ========================================================================== */

.subject-filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.subject-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.subject-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.subject-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.4);
}

.subject-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.subject-code-pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
}

.subject-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.subject-stats-row {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.subject-stat {
  flex: 1;
}

.subject-stat-val {
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================================
   Tab 5: Master Downloads
   ========================================================================== */

.downloads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.download-master-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.download-master-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-3px);
}

.download-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

/* ==========================================================================
   Modal / Overlay: Student & Subject Profiles
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop.open {
  display: flex;
}

.modal-window {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 920px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  position: relative;
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: sticky;
  top: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.modal-title-group h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--text-primary);
}

.modal-title-group p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.modal-close-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: rgba(244, 63, 94, 0.2);
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.4);
}

.modal-body {
  padding: 2rem;
}

/* Modal Content Blocks */
.info-table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.info-item-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.info-item-val {
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 0.15rem;
}

/* Progress Trend Row */
.sgpa-trend-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.trend-steps {
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.trend-step {
  text-align: center;
}

.trend-step-sem {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.trend-step-sgpa {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

/* Semester Scorecard Tables inside Modal */
.sem-scorecard-section {
  margin-bottom: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.sem-scorecard-header {
  background: var(--bg-secondary);
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.sem-scorecard-header h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--text-primary);
}

.sem-scorecard-summary {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
}

.table-responsive {
  overflow-x: auto;
}

.courses-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.courses-table th {
  background: var(--bg-card);
  padding: 0.65rem 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.courses-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.courses-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.course-code-cell {
  font-family: monospace;
  font-weight: 600;
  color: var(--accent-cyan);
}

.course-title-cell {
  font-weight: 500;
  color: var(--text-primary);
}

.marks-cell {
  text-align: center;
}

.grade-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.75rem;
}

.grade-badge.grade-O, .grade-badge.grade-A_plus {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.grade-badge.grade-A, .grade-badge.grade-B_plus {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.grade-badge.grade-B, .grade-badge.grade-C, .grade-badge.grade-P {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.grade-badge.grade-F, .grade-badge.grade-AB {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
}

/* Modal Footer */
.modal-footer {
  padding: 1.25rem 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .unpg-title {
    font-size: 1.75rem;
  }
  .search-form {
    flex-direction: column;
  }
  .search-btn {
    width: 100%;
    justify-content: center;
  }
  .modal-window {
    max-height: 95vh;
  }
  .modal-header, .modal-body, .modal-footer {
    padding: 1.25rem;
  }
}

