/* ============================================================
   Student Portal (LMS)
   ============================================================ */
.portal-body { background: var(--bg-section); min-height: 100vh; }

/* ---- Login screen ---- */
.portal-login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.portal-login-card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-md);
  padding: 44px 38px; width: 100%; max-width: 400px;
}
.portal-login-card img.portal-logo { height: 48px; margin: 0 auto 18px; display: block; }
.portal-login-card h2 { text-align: center; font-size: 1.5rem; margin-bottom: 6px; }
.portal-login-card p.sub { text-align: center; color: var(--text-muted); margin-bottom: 26px; font-size: .92rem; }
.portal-form-group { margin-bottom: 18px; }
.portal-form-group label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.portal-form-group input {
  width: 100%; padding: 12px 14px; border: 2px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: .95rem; transition: border-color var(--t);
}
.portal-form-group input:focus { outline: none; border-color: var(--primary-light); }
.portal-login-card .btn { width: 100%; text-align: center; margin-top: 6px; }
.portal-error {
  background: #fde8e8; color: #b91c1c; padding: 10px 14px; border-radius: 8px;
  font-size: .85rem; margin-bottom: 16px; display: none;
}
.portal-error.show { display: block; }
.portal-login-note {
  text-align: center; margin-top: 22px; font-size: .8rem; color: var(--text-muted);
}

/* ---- App shell (sidebar + content) ---- */
.portal-shell { display: flex; min-height: 100vh; }
.portal-sidebar {
  width: 250px; flex-shrink: 0; background: var(--primary);
  color: var(--white); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.portal-sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,.12);
}
.portal-sidebar-brand img { height: 32px; }
.portal-sidebar-brand span { font-weight: 700; font-size: 1.02rem; }
.portal-nav { flex: 1; padding: 18px 12px; }
.portal-nav a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 8px;
  color: rgba(255,255,255,.82); font-size: .92rem; font-weight: 500; margin-bottom: 4px; transition: background var(--t);
}
.portal-nav a i { width: 18px; text-align: center; }
.portal-nav a:hover { background: rgba(255,255,255,.08); color: var(--white); }
.portal-nav a.active { background: var(--accent); color: var(--primary-dark); font-weight: 700; }
.portal-sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.12); }
.portal-logout-btn {
  width: 100%; background: transparent; border: 1px solid rgba(255,255,255,.3); color: var(--white);
  padding: 10px; border-radius: 8px; cursor: pointer; font-size: .88rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: background var(--t);
}
.portal-logout-btn:hover { background: rgba(255,255,255,.12); }

.portal-main { flex: 1; min-width: 0; }
.portal-topbar {
  background: var(--white); padding: 18px 32px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow); position: sticky; top: 0; z-index: 5;
}
.portal-topbar h1 { font-size: 1.3rem; margin: 0; }
.portal-topbar .student-chip { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--text-muted); }
.portal-topbar .student-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.portal-content { padding: 32px; }

.portal-hamburger {
  display: none; background: none; border: none; font-size: 1.4rem; color: var(--primary); cursor: pointer;
}

/* ---- Cards / widgets ---- */
.portal-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.portal-stat-card {
  background: var(--white); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
}
.portal-stat-icon {
  width: 48px; height: 48px; border-radius: 12px; background: rgba(74,32,128,.1); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0;
}
.portal-stat-card h3 { font-size: 1.5rem; margin: 0; }
.portal-stat-card p { font-size: .82rem; color: var(--text-muted); margin: 0; }

.portal-welcome-banner {
  background: linear-gradient(120deg, var(--primary), var(--primary-light));
  color: var(--white); border-radius: var(--radius); padding: 32px; margin-bottom: 28px;
}
.portal-welcome-banner h2 { color: var(--white); margin-bottom: 6px; }
.portal-welcome-banner p { color: rgba(255,255,255,.85); margin: 0; }

.portal-section-title { font-size: 1.1rem; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }

.portal-empty-state {
  background: var(--white); border-radius: var(--radius); padding: 48px 24px; text-align: center;
  box-shadow: var(--shadow); color: var(--text-muted);
}
.portal-empty-state i { font-size: 2.2rem; color: var(--border); margin-bottom: 14px; display: block; }

/* ---- Courses ---- */
.portal-course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.portal-course-card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.portal-course-card img { width: 100%; height: 140px; object-fit: cover; }
.portal-course-card-body { padding: 18px 20px; }
.portal-course-card-body h3 { font-size: 1.05rem; }
.portal-course-card-body p { font-size: .85rem; color: var(--text-muted); margin-bottom: 14px; }
.portal-progress-bar { height: 8px; background: var(--border); border-radius: 50px; overflow: hidden; margin-bottom: 8px; }
.portal-progress-fill { height: 100%; background: var(--accent); }
.portal-module-list { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.portal-module-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: .85rem; color: var(--text);
}
.portal-module-item i { color: var(--primary); width: 16px; }
.portal-module-item .placeholder-tag {
  margin-left: auto; font-size: .68rem; background: rgba(240,180,41,.18); color: var(--accent-dark);
  padding: 2px 8px; border-radius: 50px; font-weight: 700;
}

/* ---- Downloads / Certificates list ---- */
.portal-list-item {
  background: var(--white); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px; margin-bottom: 14px;
}
.portal-list-icon {
  width: 44px; height: 44px; border-radius: 10px; background: rgba(74,32,128,.1); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0;
}
.portal-list-item-body { flex: 1; min-width: 0; }
.portal-list-item-body h4 { font-size: .95rem; margin-bottom: 2px; }
.portal-list-item-body p { font-size: .8rem; color: var(--text-muted); margin: 0; }
.portal-list-action .btn { padding: 8px 18px; font-size: .82rem; }

/* ---- Profile ---- */
.portal-profile-card { background: var(--white); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); max-width: 520px; }
.portal-profile-avatar {
  width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 700; margin-bottom: 18px;
}
.portal-save-msg { font-size: .85rem; margin-top: 10px; display: none; }
.portal-save-msg.show { display: block; }
.portal-save-msg.ok { color: #15803d; }
.portal-save-msg.err { color: #b91c1c; }

@media (max-width: 900px) {
  .portal-stats-row { grid-template-columns: repeat(2, 1fr); }
  .portal-sidebar {
    position: fixed; left: -260px; top: 0; z-index: 50; transition: left var(--t); box-shadow: var(--shadow-md);
  }
  .portal-sidebar.open { left: 0; }
  .portal-hamburger { display: block; }
  .portal-content { padding: 20px; }
  .portal-topbar { padding: 14px 18px; }
}
