/* Portal Styles */
.portal-body {
  background: var(--bg-alt);
  min-height: 100vh;
}

.portal-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--utd-green) 0%, var(--utd-green-dark) 100%);
  padding: 2rem;
}

.login-card {
  background: var(--bg);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: min(440px, 100%);
  padding: 2.5rem;
}

.login-card .logo-center {
  text-align: center;
  margin-bottom: 2rem;
}
.login-card .logo-center img { width: 80px; margin: 0 auto 1rem; }
.login-card h1 { font-family: var(--font-serif); font-size: 1.5rem; text-align: center; color: var(--utd-green); }
.login-card .subtitle { text-align: center; color: var(--text-muted); font-size: .9rem; margin-bottom: 1.5rem; }

.role-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  margin-bottom: 1.5rem;
}
.role-btn {
  padding: .75rem .5rem;
  border: 2px solid var(--border);
  background: var(--bg-alt);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
  text-align: center;
}
.role-btn.active {
  border-color: var(--utd-orange);
  background: var(--utd-orange);
  color: #fff;
}

.login-error {
  background: #fee;
  color: #c00;
  padding: .75rem;
  border-radius: var(--radius);
  font-size: .85rem;
  margin-bottom: 1rem;
  display: none;
}
[data-theme="dark"] .login-error { background: #3a1515; color: #ff6b6b; }

.back-public {
  display: block;
  text-align: center;
  margin-top: 1.5rem;
  font-size: .9rem;
}

.demo-credentials {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--bg-alt);
  border-radius: var(--radius);
  font-size: .8rem;
  color: var(--text-muted);
}
.demo-credentials strong { color: var(--utd-orange); }

/* Portal layout */
.portal-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.portal-sidebar {
  background: var(--utd-green-dark);
  color: #fff;
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-brand img { width: 40px; }
.sidebar-brand span { font-size: .85rem; font-weight: 600; line-height: 1.2; }

.sidebar-user {
  padding: 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.user-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--utd-orange);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.sidebar-user .name { font-weight: 600; font-size: .9rem; }
.sidebar-user .role { font-size: .75rem; opacity: .7; }

.sidebar-nav { padding: 1rem 0; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  color: rgba(255,255,255,.75);
  font-size: .9rem;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(255,255,255,.08);
  color: #fff;
  border-left-color: var(--utd-orange);
}

.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-footer a { color: rgba(255,255,255,.6); font-size: .85rem; }
.sidebar-footer a:hover { color: #fff; }

.portal-main { padding: 2rem; overflow-y: auto; }
.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.portal-header h1 { font-family: var(--font-serif); font-size: 1.75rem; color: var(--utd-green); }

.portal-section { display: none; }
.portal-section.active { display: block; }

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.dash-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.dash-card .label { font-size: .85rem; color: var(--text-muted); }
.dash-card .value { font-size: 2rem; font-weight: 700; color: var(--utd-orange); margin-top: .25rem; }

.data-table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: .9rem;
}
.data-table th, .data-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th { background: var(--utd-green); color: #fff; font-weight: 600; }
.data-table tr:hover { background: var(--bg-alt); }

.panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.panel h3 { font-size: 1.1rem; color: var(--utd-green); margin-bottom: 1rem; }

.notif-list { list-style: none; }
.notif-list li {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  align-items: start;
}
.notif-list li.unread { background: var(--utd-beige); }
.notif-dot { width: 8px; height: 8px; background: var(--utd-orange); border-radius: 50%; margin-top: .5rem; flex-shrink: 0; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-actions { display: flex; gap: .75rem; margin-top: 1rem; flex-wrap: wrap; }
.btn-sm { padding: .5rem 1rem; font-size: .85rem; }
.btn-danger { background: #dc3545; color: #fff; border-color: #dc3545; }
.btn-danger:hover { background: #bb2d3b; color: #fff; }

.timetable-grid {
  display: grid;
  grid-template-columns: 80px repeat(5, 1fr);
  gap: 2px;
  font-size: .8rem;
}
.tt-cell {
  padding: .5rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  min-height: 60px;
}
.tt-cell.header { background: var(--utd-green); color: #fff; font-weight: 600; text-align: center; }
.tt-cell.class { background: var(--utd-beige); border-left: 3px solid var(--utd-orange); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 2rem;
  width: min(500px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}
.modal h2 { margin-bottom: 1rem; color: var(--utd-green); }

@media (max-width: 992px) {
  .portal-layout { grid-template-columns: 1fr; }
  .portal-sidebar {
    position: fixed;
    left: -280px;
    z-index: 1500;
    transition: left .3s;
    width: 260px;
  }
  .portal-sidebar.open { left: 0; }
  .portal-menu-btn { display: inline-flex !important; }
}

.portal-menu-btn {
  display: none;
  background: var(--utd-green);
  color: #fff;
  border: none;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
}

/* Section loading transition */
.portal-loader {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
[data-theme="dark"] .portal-loader { background: rgba(0,0,0,.5); }
.portal-loader.show { opacity: 1; pointer-events: all; }
.loader-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  color: var(--utd-green);
  font-weight: 600;
  font-size: .9rem;
}
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(199,91,18,.2);
  border-top-color: var(--utd-orange);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Active section entrance animation */
.portal-section.active { animation: fadeUp .35s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Login splash after authentication */
.login-splash {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--utd-green) 0%, var(--utd-green-dark) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 5000;
  opacity: 0;
  transition: opacity .3s;
  color: #fff;
}
.login-splash.show { opacity: 1; }
.login-splash img { width: 110px; height: 110px; background: #fff; border-radius: 50%; padding: 8px; }
.login-splash p { font-size: 1rem; letter-spacing: .02em; }
.login-splash .spinner { border-color: rgba(255,255,255,.3); border-top-color: #fff; }

/* Dashboard welcome banner */
.dash-banner {
  background: linear-gradient(120deg, var(--utd-green) 0%, var(--utd-green-dark) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.dash-banner-left { display: flex; align-items: center; gap: 1.25rem; }
.dash-banner-photo {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255,255,255,.6);
  flex-shrink: 0;
}
.dash-banner-photo img { width: 100%; height: 100%; object-fit: cover; }
.dash-banner-text h2 { font-family: var(--font-serif); font-size: 1.5rem; margin-bottom: .25rem; }
.dash-banner-text p { opacity: .9; margin-bottom: .75rem; }
.dash-meta { display: flex; flex-wrap: wrap; gap: .5rem; }
.dash-meta span {
  background: rgba(255,255,255,.15);
  padding: .3rem .75rem;
  border-radius: 20px;
  font-size: .8rem;
}
.dash-banner-term { text-align: center; background: rgba(255,255,255,.12); padding: 1rem 1.5rem; border-radius: var(--radius); }
.term-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; opacity: .85; }
.term-value { font-size: 1.25rem; font-weight: 700; }

.dash-card .sub { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }
.dash-card .value-due { color: #d32f2f; }
.dash-card .value-ok { color: var(--utd-green); }

/* Official profile header */
.profile-head {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--utd-orange);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  border: 3px solid var(--utd-beige);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.status-badge {
  display: inline-block;
  margin-top: .5rem;
  background: var(--utd-green);
  color: #fff;
  padding: .25rem .75rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.profile-group-title {
  color: var(--utd-orange);
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 1.5rem 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.form-group input[readonly] { background: var(--bg-alt); color: var(--text-muted); cursor: not-allowed; }

/* Fee summary */
.fee-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--utd-beige);
  border-left: 4px solid #d32f2f;
  border-radius: var(--radius);
  font-size: 1rem;
}
.fee-summary strong { font-size: 1.25rem; color: #d32f2f; }
.fee-summary em { font-style: normal; font-size: .75rem; background: #d32f2f; color: #fff; padding: .15rem .5rem; border-radius: 4px; margin-left: .5rem; vertical-align: middle; }
.fee-note { margin-top: 1rem; font-size: .82rem; color: var(--text-muted); }

/* Official Academic Transcript (on-screen preview, always light "paper") */
.transcript-doc {
  background: #fff;
  color: #000;
  font-family: "Times New Roman", Times, serif;
  font-size: 13px;
  line-height: 1.45;
  padding: 40px;
  max-width: 900px;
  margin: 0 auto;
  border: 1px solid #ccc;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .12);
  border-radius: 4px;
}
.transcript-doc .transcript-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #000;
  padding-bottom: 15px;
  margin-bottom: 20px;
}
.transcript-doc .institution-details h1 {
  font-size: 18px;
  margin: 0 0 5px 0;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: .5px;
  color: #000;
}
.transcript-doc .institution-details p { margin: 2px 0; color: #111; }
.transcript-doc .document-title { text-align: right; }
.transcript-doc .document-title h2 {
  font-size: 16px;
  margin: 0 0 5px 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #000;
}
.transcript-doc .document-title p { margin: 2px 0; color: #111; }
.transcript-doc .info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 25px;
  border: 1px solid #000;
  padding: 12px;
  background: #fafafa;
}
.transcript-doc .info-block p { margin: 4px 0; }
.transcript-doc .info-block strong { display: inline-block; width: 130px; }
.transcript-doc .section-heading {
  font-size: 13px;
  font-weight: bold;
  text-transform: uppercase;
  border-bottom: 1px solid #000;
  padding-bottom: 3px;
  margin: 20px 0 10px 0;
}
.transcript-doc table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  background: #fff;
}
.transcript-doc th {
  font-weight: bold;
  text-align: left;
  border-bottom: 2px solid #000;
  padding: 6px 4px;
  text-transform: uppercase;
  font-size: 11px;
  color: #000;
}
.transcript-doc td {
  padding: 5px 4px;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: top;
  color: #000;
}
.transcript-doc .text-center { text-align: center; }
.transcript-doc .text-right { text-align: right; }
.transcript-doc .term-row td {
  font-weight: bold;
  background: #f2f2f2;
  border-bottom: 1px solid #000;
  font-size: 11px;
  padding: 6px 4px;
}
.transcript-doc .gpa-summary {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 30px;
  font-weight: bold;
  margin-top: 10px;
  padding: 8px;
  border-top: 1px solid #000;
  background: #fafafa;
  border-bottom: 1px solid #000;
}
.transcript-doc .transcript-footer {
  margin-top: 40px;
  font-size: 10px;
  border-top: 1px solid #000;
  padding-top: 10px;
}
.transcript-doc .legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}
.transcript-doc .notice-box {
  border: 1px dashed #000;
  padding: 8px;
  text-align: center;
  font-weight: bold;
  background: #fcfcfc;
}
@media (max-width: 640px) {
  .transcript-doc { padding: 20px; }
  .transcript-doc .transcript-header,
  .transcript-doc .info-grid,
  .transcript-doc .legend-grid { grid-template-columns: 1fr; flex-direction: column; gap: 10px; }
  .transcript-doc .document-title { text-align: left; }
}
