:root {
  --pu-blue: #0f2b5c;
  --pu-blue-hover: #0a1f42;
  --pu-blue-light: #e8f0fe;
  --pu-red: #c8102e;
  --pu-red-dark: #a00c24;
  --pu-teal: #007a87;
  --pu-gold: #f59e0b;
  --pu-gold-light: #fef3c7;
  --pu-green: #10b981;
  --pu-green-light: #d1fae5;
  --pu-bg: #f4f6fa;
  --card-bg: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -3px rgba(15, 43, 92, 0.1), 0 4px 6px -2px rgba(15, 43, 92, 0.05);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

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

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--pu-bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* =========================================================
   SCREEN 1: AUTHENTICATION SCREEN
   ========================================================= */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(circle at 10% 20%, rgba(200, 16, 46, 0.04) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(15, 43, 92, 0.08) 0%, transparent 40%),
              #f8fafc;
}

.auth-card {
  width: 100%;
  max-width: 520px;
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(226, 232, 240, 0.8);
  overflow: hidden;
  animation: fadeInDown 0.5s ease-out;
}

.auth-logo-wrapper {
  padding: 36px 32px 24px;
  text-align: center;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
}

.auth-logo {
  max-width: 260px;
  height: auto;
  object-fit: contain;
}

.auth-card-body {
  padding: 32px;
}

.auth-badge {
  display: inline-block;
  background: #f1f5f9;
  color: var(--pu-blue);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 50px;
  margin-bottom: 14px;
}

.auth-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.auth-subheading {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

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

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 1.05rem;
  pointer-events: none;
}

.form-control {
  width: 100%;
  padding: 13px 16px 13px 44px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  background-color: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.form-control:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--pu-blue);
  box-shadow: 0 0 0 4px rgba(15, 43, 92, 0.12);
}

.auth-error-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.82rem;
  font-weight: 500;
  animation: shake 0.3s ease-in-out;
}

.auth-submit-btn {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--pu-blue) 0%, #173d7a 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(15, 43, 92, 0.2);
}

.auth-submit-btn:hover {
  background: linear-gradient(135deg, #0b2249 0%, var(--pu-blue) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 43, 92, 0.28);
}

.auth-submit-btn:active {
  transform: translateY(0);
}

.auth-footer-help {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed #e2e8f0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.auth-footer-help i {
  color: var(--pu-teal);
}

/* =========================================================
   SCREEN 2: NAVBAR / UPPER BAR
   ========================================================= */
.pu-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.navbar-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-left {
  display: flex;
  align-items: center;
}

.nav-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
}

.navbar-right {
  display: flex;
  align-items: center;
}

.profile-widget {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-profile-img {
  max-height: 48px;
  max-width: 270px;
  height: auto;
  object-fit: contain;
  display: block;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* =========================================================
   MAIN CONTENT & PAGE HEADING
   ========================================================= */
.main-content {
  padding: 28px 20px 60px;
}

.content-container {
  max-width: 1240px;
  margin: 0 auto;
}

.page-title-banner {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 22px 28px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.portal-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.1px;
  color: var(--pu-teal);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.main-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 1.85rem;
  font-weight: 800;
  color: #0f2b5c;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.2;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 50px;
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

/* =========================================================
   STUDENT PROFILE CARD
   ========================================================= */
.student-info-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}

.header-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--pu-blue-light);
  color: var(--pu-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.header-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 20px;
}

.info-item {
  display: flex;
  flex-direction: column;
}

.info-item.span-2 {
  grid-column: span 2;
}

.info-label {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.info-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

.highlight-value {
  color: var(--pu-blue);
  font-weight: 700;
}

.font-mono {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.92rem;
  letter-spacing: 0.5px;
  color: #0f172a;
}

/* =========================================================
   SEMESTER SELECTOR SECTION
   ========================================================= */
.semester-selection-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.selection-header {
  margin-bottom: 16px;
}

.selection-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-num {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--pu-blue) 0%, #1e40af 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.selection-title-group h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f2b5c;
}

.selection-title-group p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sem-tabs-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.sem-tab-btn {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 12px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.sem-tab-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.sem-tab-btn.active {
  background: linear-gradient(135deg, #0f2b5c 0%, #1e3a8a 100%);
  border-color: #0f2b5c;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 43, 92, 0.25);
  transform: translateY(-2px);
}

.sem-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #475569;
}

.sem-tab-btn.active .sem-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.sem-badge.latest {
  background: #fef3c7;
  color: #b45309;
}

.sem-tab-btn.active .sem-badge.latest {
  background: #f59e0b;
  color: #ffffff;
}

.sem-name {
  font-size: 0.86rem;
  font-weight: 600;
}

/* =========================================================
   DYNAMIC SEMESTER RESULT CARD
   ========================================================= */
.result-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.3s ease;
}

.result-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1.5px solid #f1f5f9;
  flex-wrap: wrap;
  gap: 16px;
}

.report-title-area h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f2b5c;
  margin-bottom: 4px;
}

.report-title-area p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* DOWNLOAD BUTTON (ONLY FOR SEMESTER 6) */
.btn-download-marksheet {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #c8102e 0%, #a00c24 100%);
  color: #ffffff;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.3);
  animation: pulseButton 2s infinite ease-in-out;
}

.btn-download-marksheet:hover {
  background: linear-gradient(135deg, #b00d27 0%, #88091d 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(200, 16, 46, 0.4);
}

.btn-download-marksheet i {
  font-size: 1.1rem;
}

/* KPI SCORES / SUMMARY BAR */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
}

.kpi-card.highlight-kpi {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #86efac;
}

.kpi-card.cgpa-kpi {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #93c5fd;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kpi-card.highlight-kpi .kpi-label {
  color: #166534;
}

.kpi-card.cgpa-kpi .kpi-label {
  color: #1e40af;
}

.kpi-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.1;
  color: #0f172a;
}

.kpi-card.highlight-kpi .kpi-value {
  color: #15803d;
}

.kpi-card.cgpa-kpi .kpi-value {
  color: #1d4ed8;
}

.kpi-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* COURSE GRADE TABLE */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

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

.courses-table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 16px;
  border-bottom: 1.5px solid #e2e8f0;
}

.courses-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

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

.courses-table tr:hover td {
  background-color: #fafbfc;
}

.courses-table .text-center {
  text-align: center;
}

.courses-table .text-right {
  text-align: right;
}

.total-row {
  background-color: #f8fafc !important;
  font-weight: 700;
}

.total-row td {
  border-top: 1.5px solid #cbd5e1 !important;
  border-bottom: none !important;
  color: #0f2b5c !important;
}

/* GRADE BADGES */
.grade-tag {
  display: inline-block;
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.grade-o { background: #dcfce7; color: #166534; }
.grade-aplus { background: #e0f2fe; color: #0369a1; }
.grade-a { background: #e0e7ff; color: #4338ca; }
.grade-bplus { background: #fef3c7; color: #b45309; }
.grade-b { background: #ffedd5; color: #c2410c; }
.grade-p { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.grade-f { background: #fee2e2; color: #b91c1c; }

/* SEMESTER REMARKS BOX */
.sem-remarks-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
}

.remark-tag {
  font-weight: 600;
  color: #0f172a;
}

.remark-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  color: #065f46;
  padding: 4px 12px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.82rem;
}

/* =========================================================
   GRADING SCALE LEGEND
   ========================================================= */
.grading-legend-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.legend-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 14px;
}

.legend-table-responsive {
  width: 100%;
  overflow-x: auto;
}

.legend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.legend-table th, .legend-table td {
  padding: 8px 14px;
  border: 1px solid #e2e8f0;
  text-align: center;
}

.legend-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
}

/* =========================================================
   FOOTER
   ========================================================= */
.pu-footer {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 30px 20px 24px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-container {
  max-width: 1240px;
  margin: 0 auto;
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-brand {
  max-width: 600px;
}

.footer-logo {
  height: 40px;
  margin-bottom: 8px;
  object-fit: contain;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: #475569;
}

.footer-bottom {
  padding-top: 18px;
  text-align: center;
  font-size: 0.78rem;
}

/* =========================================================
   ANIMATIONS & RESPONSIVE
   ========================================================= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes pulseButton {
  0%, 100% { box-shadow: 0 4px 14px rgba(200, 16, 46, 0.3); }
  50% { box-shadow: 0 6px 22px rgba(200, 16, 46, 0.55); }
}

@media (max-width: 992px) {
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .info-item.span-2 {
    grid-column: span 2;
  }
  .sem-tabs-bar {
    grid-template-columns: repeat(3, 1fr);
  }
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .navbar-container {
    padding: 10px 14px;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  .navbar-right {
    width: 100%;
    justify-content: space-between;
  }
  .page-title-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
  }
  .main-heading {
    font-size: 1.45rem;
  }
  .info-grid {
    grid-template-columns: 1fr;
  }
  .info-item.span-2 {
    grid-column: span 1;
  }
  .sem-tabs-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi-row {
    grid-template-columns: 1fr;
  }
  .result-card-header {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-download-marksheet {
    justify-content: center;
  }
}
