/*
 * BCA Study Portal — Student auth + Student Portal shell (CASE 1)
 *
 * Uses the same dark academic design language as the reader/home pages:
 * navy gradients, cyan (#6fe5ff) accents, Arial stack, rounded cards.
 */

/* ============================================================
   Header account nav (injected into the portal headers)
   ============================================================ */

.auth-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.auth-nav-link {
  text-decoration: none;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #b9d8ff;
  padding: 0.42rem 0.95rem;
  border: 1px solid rgba(143, 171, 214, 0.28);
  border-radius: 999px;
  background: rgba(17, 26, 38, 0.55);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}

.auth-nav-link:hover,
.auth-nav-link:focus-visible {
  background: linear-gradient(135deg, rgba(111, 229, 255, 0.16), rgba(104, 160, 255, 0.12));
  color: #79edff;
}

.auth-nav-logout:hover {
  color: #f8a99b;
}

.auth-nav-link:focus-visible {
  outline: 2px solid rgba(111, 229, 255, 0.6);
  outline-offset: 2px;
}

/* ============================================================
   Auth pages (signup / login) shared layout
   ============================================================ */

body.auth-page {
  background:
    radial-gradient(circle at top left, rgba(99, 130, 255, 0.18), transparent 24%),
    radial-gradient(circle at bottom right, rgba(111, 229, 255, 0.1), transparent 26%),
    linear-gradient(180deg, #07111d 0%, #0d1725 100%);
  color: #eaf3ff;
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-shell {
  width: min(980px, calc(100% - 32px));
  margin: 28px auto 0;
  border: 1px solid rgba(143, 169, 206, 0.22);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(9, 16, 26, 0.94), rgba(10, 17, 27, 0.97));
  box-shadow: 0 24px 60px rgba(2, 7, 18, 0.3);
}

.auth-card {
  max-width: 520px;
  margin: 0 auto;
  padding: 34px 30px 38px;
  border: 1px solid rgba(143, 169, 206, 0.22);
  border-top: 3px solid rgba(111, 229, 255, 0.7);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(12, 20, 30, 0.97), rgba(12, 18, 28, 0.97));
  box-shadow: 0 18px 46px rgba(2, 7, 18, 0.45);
}

.auth-label {
  margin: 22px 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #7fb6ff;
  display: block;
}

.auth-input {
  width: 100%;
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.95rem;
  color: #eaf3ff;
  background: rgba(17, 26, 38, 0.9);
  border: 1px solid rgba(143, 169, 206, 0.26);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
}

.auth-input::placeholder {
  color: rgba(190, 208, 230, 0.42);
}

/* Study type radio cards */

.auth-study-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 6px 0 0;
}

.auth-study-option {
  position: relative;
  display: block;
  padding: 12px 10px;
  border: 1px solid rgba(143, 169, 206, 0.26);
  border-radius: 12px;
  background: rgba(17, 26, 38, 0.82);
  cursor: pointer;
  font-size: 0.86rem;
  color: #dfeeff;
}

.auth-study-option input[type="radio"] {
  margin-right: 6px;
  accent-color: #6fe5ff;
}

.auth-study-option:has(input:checked) {
  border-color: rgba(111, 229, 255, 0.55);
  background: linear-gradient(135deg, rgba(111, 229, 255, 0.12), rgba(104, 160, 255, 0.1));
}

.auth-study-hint {
  font-size: 0.7rem;
  color: rgba(190, 208, 230, 0.6);
  display: block;
  margin-top: 4px;
}

/* Submit + helper actions */

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.auth-submit {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #08111c;
  background: linear-gradient(135deg, #6fe5ff, #68a0ff);
  border: 1px solid rgba(111, 229, 255, 0.8);
  border-radius: 999px;
  padding: 0.62rem 1.5rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(2, 7, 18, 0.4);
}

.auth-submit:active {
  transform: translateY(0);
}

.auth-link-alt {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
  color: #6fe5ff;
  background: transparent;
  border: 1px solid rgba(111, 229, 255, 0.35);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.auth-status {
  margin-top: 16px;
  font-size: 0.86rem;
  line-height: 1.55;
  border: 1px solid rgba(143, 169, 206, 0.22);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(17, 26, 38, 0.85);
}

.auth-status.ok {
  color: #9be8a8;
  border-color: rgba(111, 229, 255, 0.4);
}

.auth-status.error {
  color: #f8a99b;
  border-color: rgba(240, 128, 128, 0.4);
}

.auth-status.info {
  color: #b9d8ff;
}

/* Headings used by the auth pages (eyebrow matches the portal's style) */

.auth-card .eyebrow {
  color: #6fe5ff;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0 0 12px;
}

.auth-page-title {
  margin: 0 0 8px;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f4f8ff;
}

.auth-subcopy {
  margin: 0 0 20px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: rgba(233, 241, 253, 0.8);
}

/* ============================================================
   Student Dashboard shell
   ============================================================ */

body.dashboard-page {
  background:
    radial-gradient(circle at top left, rgba(99, 130, 255, 0.16), transparent 24%),
    linear-gradient(180deg, #07111d 0%, #0d1725 100%);
  color: #eaf3ff;
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.dashboard-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 28px auto 0;
  border: 1px solid rgba(143, 169, 206, 0.22);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(9, 16, 26, 0.95), rgba(10, 17, 27, 0.98));
  box-shadow: 0 26px 70px rgba(2, 7, 18, 0.3);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  padding: 26px 24px 34px;
}

.auth-dev-banner {
  grid-column: 1 / -1;
  border: 1px dashed rgba(111, 229, 255, 0.45);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #b9d8ff;
  background: rgba(17, 26, 38, 0.85);
}

.dash-welcome {
  grid-column: 1 / -1;
  border: 1px solid rgba(143, 169, 206, 0.24);
  border-radius: 18px;
  padding: 24px 24px 20px;
  background: linear-gradient(135deg, rgba(12, 20, 30, 0.96), rgba(18, 28, 42, 0.88));
}

.dash-welcome h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f4f8ff;
}

.dash-welcome p {
  margin: 8px 0 0;
  color: rgba(233, 241, 253, 0.78);
  font-size: 0.92rem;
}

.dash-card {
  border: 1px solid rgba(143, 169, 206, 0.2);
  border-radius: 14px;
  padding: 16px 16px 18px;
  background: rgba(14, 23, 34, 0.82);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-card h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #dfeeff;
}

.dash-card .dash-value {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #79edff;
}

.dash-card .dash-copy {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(190, 208, 230, 0.72);
}

.dash-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6fe5ff;
  border: 1px solid rgba(111, 229, 255, 0.35);
  border-radius: 999px;
  background: rgba(111, 229, 255, 0.08);
}

.dash-quick {
  border: 1px solid rgba(143, 169, 206, 0.2);
  border-radius: 14px;
  padding: 16px 16px 20px;
  background: rgba(14, 23, 34, 0.82);
}

.dash-quick h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #dfeeff;
}

.dash-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.dash-quick-btn {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  color: #79edff;
  padding: 0.62rem 0.9rem;
  border: 1px solid rgba(111, 229, 255, 0.4);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(111, 229, 255, 0.1), rgba(104, 160, 255, 0.08));
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, transform 0.12s ease;
}

.dash-quick-btn:hover:enabled {
  background: linear-gradient(135deg, rgba(111, 229, 255, 0.22), rgba(104, 160, 255, 0.16));
  transform: translateY(-1px);
}

.dash-quick-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- CASE 2: dashboard analytics lists (additive) ---- */
.dash-topic-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-topic-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: rgba(233, 241, 253, 0.85);
  border: 1px solid rgba(143, 169, 206, 0.18);
  border-radius: 10px;
  padding: 8px 10px;
}

.dash-topic-row strong {
  color: #ffffff;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.dash-topic-pill {
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid rgba(143, 169, 206, 0.3);
  color: rgba(190, 208, 230, 0.85);
  white-space: nowrap;
  text-decoration: none;
}

.dash-topic-pill--weak {
  color: #ffb4a8;
  border-color: rgba(255, 120, 100, 0.4);
}

.dash-topic-pill--strong {
  color: #9fe8b4;
  border-color: rgba(110, 220, 150, 0.4);
}

.dash-topic-pill--action {
  color: #bfe0ff;
  background: rgba(104, 160, 255, 0.14);
  border-color: rgba(143, 169, 206, 0.4);
}

.dash-topic-pill--action:hover {
  background: rgba(111, 229, 255, 0.22);
}

/* ---- CASE 2: take-quiz form (additive) ---- */
.take-question-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  counter-reset: takeq;
}

.take-question {
  border: 1px solid rgba(143, 169, 206, 0.2);
  border-radius: 12px;
  padding: 12px 14px;
}

.take-question-text {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #ffffff;
  overflow-wrap: anywhere;
}

.take-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.84rem;
  color: rgba(233, 241, 253, 0.85);
  padding: 5px 6px;
  border-radius: 8px;
  cursor: pointer;
}

.take-option:hover {
  background: rgba(104, 160, 255, 0.12);
}

.take-option input[type="radio"] {
  margin-top: 2px;
  accent-color: #68a0ff;
}

.take-option span {
  overflow-wrap: anywhere;
}

.take-error {
  margin: 12px 0 0;
  font-size: 0.82rem;
  color: #ffb4a8;
}

.take-submit {
  margin-top: 14px;
  width: auto;
  padding: 10px 18px;
  border: 1px solid rgba(143, 169, 206, 0.4);
  border-radius: 10px;
  background: rgba(104, 160, 255, 0.14);
  color: #bfe0ff;
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.84rem;
}

.take-submit:hover:enabled {
  background: rgba(111, 229, 255, 0.22);
}

.take-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ---- CASE 2: quiz-taking form (additive) ---- */
.take-question-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.take-question {
  border: 1px solid rgba(143, 169, 206, 0.2);
  border-radius: 12px;
  padding: 12px 14px;
}

.take-question-text {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #ffffff;
  overflow-wrap: anywhere;
}

.take-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 6px 0;
  font-size: 0.84rem;
  color: rgba(233, 241, 253, 0.85);
  cursor: pointer;
}

.take-option input[type="radio"] {
  margin-top: 2px;
  accent-color: #6fe5ff;
}

.take-error {
  margin: 12px 0 0;
  font-size: 0.82rem;
  color: #ffb4a8;
}

.take-submit {
  margin-top: 14px;
  border: 1px solid rgba(143, 169, 206, 0.4);
  border-radius: 10px;
  background: rgba(104, 160, 255, 0.14);
  color: #ffffff;
  padding: 10px 18px;
  cursor: pointer;
  width: 100%;
}

.take-submit:disabled {
  opacity: 0.55;
  cursor: wait;
}

.take-submit:hover:enabled {
  background: linear-gradient(135deg, rgba(111, 229, 255, 0.22), rgba(104, 160, 255, 0.16));
}

.dash-upgrade {
  display: inline-block;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #08111c;
  background: linear-gradient(135deg, #6fe5ff, #68a0ff);
  border: 1px solid rgba(111, 229, 255, 0.8);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  text-decoration: none;
}

.auth-footer {
  text-align: center;
  padding: 28px 0 34px;
  color: rgba(190, 208, 230, 0.65);
  font-size: 0.82rem;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 620px) {
  .auth-shell,
  .dashboard-shell {
    width: calc(100% - 20px);
    margin: 14px auto 0;
  }

  .auth-card {
    padding: 24px 20px 28px;
  }

  .auth-study-group {
    grid-template-columns: 1fr;
  }

  .auth-nav {
    width: 100%;
    justify-content: center;
  }

  .dashboard-grid {
    padding: 18px 14px 26px;
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   CASE 2A — Student Portal hub (additive)
   ============================================================ */

.portal-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: min(1180px, calc(100% - 32px));
  margin: 16px auto 0;
}

.portal-nav-link {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #b9d8ff;
  padding: 0.42rem 0.95rem;
  border: 1px solid rgba(143, 171, 214, 0.28);
  border-radius: 999px;
  background: rgba(17, 26, 38, 0.55);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.portal-nav-link:hover,
.portal-nav-link:focus-visible {
  background: linear-gradient(135deg, rgba(111, 229, 255, 0.16), rgba(104, 160, 255, 0.12));
  color: #79edff;
}

.portal-nav-link--logout:hover,
.portal-nav-link--logout:focus-visible {
  color: #f8a99b;
}

.portal-study-grid {
  display: grid;
  gap: 18px;
  margin-top: 14px;
}

.portal-study-subject {
  border: 1px solid rgba(143, 169, 206, 0.22);
  border-left: 3px solid var(--portal-accent, #1f7a63);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(12, 20, 30, 0.6);
}

.portal-study-subject-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.portal-study-subject-head h3 {
  margin: 0;
  font-size: 1.02rem;
  color: #ffffff;
}

.portal-study-open {
  font-size: 0.8rem;
  color: #79edff;
  text-decoration: none;
}

.portal-study-open:hover,
.portal-study-open:focus-visible {
  text-decoration: underline;
}

.portal-module {
  border-top: 1px solid rgba(143, 169, 206, 0.16);
  padding: 10px 2px 12px;
}

.portal-module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.portal-module-head strong {
  font-size: 0.88rem;
  color: #d9e7fb;
}

.portal-module-actions {
  display: inline-flex;
  gap: 6px;
}

.portal-module-btn {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: #bfe0ff;
  padding: 0.24rem 0.7rem;
  border: 1px solid rgba(143, 171, 214, 0.3);
  border-radius: 999px;
  background: rgba(17, 26, 38, 0.7);
  cursor: pointer;
  text-decoration: none;
}

.portal-module-btn:hover,
.portal-module-btn:focus-visible {
  background: linear-gradient(135deg, rgba(111, 229, 255, 0.2), rgba(104, 160, 255, 0.14));
  color: #79edff;
}

.portal-topic-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  columns: 2;
  column-gap: 22px;
}

.portal-topic-list li {
  margin: 3px 0;
}

.portal-topic-list a {
  font-size: 0.8rem;
  color: rgba(196, 216, 242, 0.85);
  text-decoration: none;
}

.portal-topic-list a:hover,
.portal-topic-list a:focus-visible {
  color: #79edff;
  text-decoration: underline;
}

.portal-quiz-list {
  display: grid;
  gap: 14px;
  margin: 12px 0 4px;
}

.portal-quiz-card {
  border: 1px solid rgba(143, 169, 206, 0.22);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(12, 20, 30, 0.6);
}

.portal-quiz-card h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: #ffffff;
}

.portal-quiz-meta,
.portal-quiz-topics {
  margin: 4px 0;
  font-size: 0.8rem;
  color: rgba(190, 208, 230, 0.78);
  overflow-wrap: anywhere;
}

.portal-quiz-actions {
  margin-top: 10px;
}

.portal-logout-btn {
  margin-top: 14px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #f8a99b;
  padding: 0.45rem 1.1rem;
  border: 1px solid rgba(248, 169, 155, 0.4);
  border-radius: 999px;
  background: rgba(40, 18, 18, 0.4);
  cursor: pointer;
}

.portal-logout-btn:hover,
.portal-logout-btn:focus-visible {
  background: rgba(248, 169, 155, 0.16);
}

@media (max-width: 620px) {
  .portal-nav {
    width: calc(100% - 20px);
    justify-content: center;
  }

  .portal-topic-list {
    columns: 1;
  }
}

/* ============================================================
   CASE 2B — Compact Study section
   Subject cards start collapsed; modules are accordion rows.
   ============================================================ */

.portal-study-meta {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #9fd0ff;
  padding: 0.2rem 0.6rem;
  border: 1px solid rgba(143, 171, 214, 0.3);
  border-radius: 999px;
  background: rgba(17, 26, 38, 0.7);
  white-space: nowrap;
}

.portal-study-toggle {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #79edff;
  padding: 0.3rem 0.8rem;
  border: 1px solid rgba(111, 229, 255, 0.35);
  border-radius: 999px;
  background: rgba(17, 26, 38, 0.6);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.portal-study-toggle:hover,
.portal-study-toggle:focus-visible {
  background: linear-gradient(135deg, rgba(111, 229, 255, 0.2), rgba(104, 160, 255, 0.14));
  color: #aef3ff;
}

.portal-study-subject-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.portal-study-subject-head h3 {
  margin: 0;
  flex: 1 1 auto;
}

.portal-study-modules {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.portal-module-head--accordion {
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease;
  border-radius: 8px;
}

.portal-module-head--accordion:hover {
  background: rgba(111, 229, 255, 0.06);
}

.portal-module-head--accordion:focus-visible {
  outline: 2px solid rgba(111, 229, 255, 0.6);
  outline-offset: 1px;
}

.portal-module-indicator {
  font-size: 0.8rem;
  color: #7fe8c7;
  flex: 0 0 auto;
}

.portal-module-title {
  flex: 1 1 auto;
}

.portal-module-btn--notes {
  cursor: pointer;
}

/* ============================================================
   CASE 2B — Dashboard height reduction
   Tighten the first viewport so key cards come first.
   ============================================================ */

.dash-welcome {
  padding: 0.5rem 0 0.25rem;
}

.dash-welcome p {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.dash-card {
  padding: 14px 16px;
}

.dash-card h2 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.dash-copy {
  font-size: 0.78rem;
  margin: 4px 0;
}

.dash-value {
  margin: 4px 0;
}

.portal-study {
  padding: 12px 14px;
}

@media (max-width: 620px) {
  .portal-study-subject-head {
    flex-wrap: wrap;
  }
}

/* ============================================================
   CASE 2C.1 — Portal reader shell (additive)
   The portal reuses the reader layout (.app-shell grid, .sidebar,
   .content-area). The reader shell keeps its own light theme so the
   sidebar and notes look exactly like the public reader.
   ============================================================ */

.portal-view[hidden] {
  display: none !important;
}

body.dashboard-page .app-shell {
  width: min(1460px, 100%);
  margin: 16px auto 28px;
  min-height: calc(100vh - 230px);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 26px 70px rgba(2, 7, 18, 0.35);
}

body.dashboard-page #portalDashboardView {
  width: auto;
  margin: 24px;
}

body.dashboard-page .subject-nav {
  border-bottom: 0;
}

@media (max-width: 620px) {
  body.dashboard-page #portalDashboardView {
    margin: 12px;
  }
}

/* ============================================================
   CASE 3A - Study navigation: topic actions + study overview
   (additive; reuses existing dash-card / dash-quick-btn styling)
   ============================================================ */

.portal-topic-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid rgba(143, 169, 206, 0.22);
  border-radius: 12px;
  background: rgba(14, 23, 34, 0.9);
}

.portal-topic-actions[hidden] {
  display: none !important;
}

.portal-topic-context {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #9fd8ff;
}

.portal-topic-action-btns {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-study-overview-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.portal-overview-card--active {
  border-color: rgba(111, 229, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(111, 229, 255, 0.35);
}

.portal-overview-meta {
  margin-top: -2px;
  color: rgba(190, 208, 230, 0.6);
  font-size: 0.78rem;
}

.portal-overview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}
/* ============================================================
   Student Dashboard UI polish (additive — CASE: dashboard polish)
   Purely presentational: reuses the existing dark academic design
   language (navy panels, cyan #6fe5ff accents, Arial stack).
   No markup contracts change; all IDs stay the same.
   ============================================================ */

/* ---- 1. Welcome hero ------------------------------------------------- */

.dash-welcome {
  position: relative;
  overflow: hidden;
  border-top: 3px solid rgba(111, 229, 255, 0.55);
}

.dash-welcome::after {
  content: "";
  position: absolute;
  top: -110px;
  right: -80px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(104, 160, 255, 0.16), transparent 70%);
  pointer-events: none;
}

.dash-welcome-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6fe5ff;
}

.dash-welcome-kicker::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #6fe5ff, rgba(104, 160, 255, 0.35));
}

.dash-welcome h1 {
  font-size: clamp(1.5rem, 3.2vw, 2.05rem);
  letter-spacing: -0.03em;
}

.dash-welcome-email {
  display: inline-block;
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: rgba(190, 208, 230, 0.75);
  padding: 3px 12px;
  border: 1px solid rgba(143, 169, 206, 0.26);
  border-radius: 999px;
  background: rgba(17, 26, 38, 0.55);
  overflow-wrap: anywhere;
}

.dash-welcome-email:empty {
  display: none;
}

.dash-welcome-date {
  font-size: 0.78rem;
  color: rgba(190, 208, 230, 0.55);
}

/* ---- 2. Summary cards ------------------------------------------------ */

.dash-card {
  position: relative;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.dash-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(111, 229, 255, 0.5), rgba(104, 160, 255, 0.08));
  opacity: 0.75;
}

.dash-card:hover {
  border-color: rgba(143, 169, 206, 0.34);
  box-shadow: 0 12px 28px rgba(2, 7, 18, 0.28);
}

.dash-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-card .dash-value {
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}

/* Overall Performance stat rows become compact tiles */
#dashPerfStats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#dashPerfStats .dash-topic-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 12px;
  background: rgba(17, 26, 38, 0.6);
}

#dashPerfStats .dash-topic-row > span:first-child {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(190, 208, 230, 0.62);
}

#dashPerfStats .dash-topic-pill {
  font-size: 1.05rem;
  font-weight: 700;
  color: #79edff;
  border: 0;
  padding: 0;
  background: none;
  white-space: normal;
}

/* ---- 3. Quiz cards --------------------------------------------------- */

.portal-quiz-list {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.portal-quiz-card {
  position: relative;
  border-left: 3px solid rgba(111, 229, 255, 0.5);
  background: linear-gradient(135deg, rgba(12, 20, 30, 0.92), rgba(15, 24, 36, 0.7));
  display: flex;
  flex-direction: column;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.portal-quiz-card:hover {
  border-color: rgba(111, 229, 255, 0.42);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(2, 7, 18, 0.3);
}

.portal-quiz-card h3 {
  overflow-wrap: anywhere;
}

.portal-quiz-topics {
  font-size: 0.74rem;
  color: rgba(190, 208, 230, 0.6);
}

.portal-quiz-actions {
  margin-top: auto;
  padding-top: 8px;
}

.portal-quiz-card--attempted {
  border-left-color: rgba(127, 232, 199, 0.55);
}

/* ---- 4. Loading / error states --------------------------------------- */

/* Elements that set an explicit `display` defeat the UA `[hidden]` rule
   (same pitfall `.portal-view[hidden]` already solves above). Without this,
   "Loading…" spinners and empty pills stay visible after JS hides them. */
body.dashboard-page .dash-card [hidden],
body.dashboard-page .dash-quick [hidden] {
  display: none !important;
}

.dash-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: rgba(190, 208, 230, 0.75);
}

.dash-loading::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(111, 229, 255, 0.25);
  border-top-color: #6fe5ff;
  animation: dash-spin 0.9s linear infinite;
}

@keyframes dash-spin {
  to { transform: rotate(360deg); }
}

.dash-error {
  font-size: 0.78rem;
  color: #ffb4a8;
}

/* ---- 5. Focus visibility --------------------------------------------- */

.dash-quick-btn:focus-visible,
.dash-topic-pill--action:focus-visible {
  outline: 2px solid rgba(111, 229, 255, 0.6);
  outline-offset: 2px;
}

/* ---- 6. Responsive ---------------------------------------------------- */

@media (max-width: 620px) {
  .dash-welcome {
    padding: 18px 16px 16px;
  }

  /* Pre-existing fix (QA 320px): nowrap pills made min-content wider than
     the viewport, so the 1fr grid track overflowed and got clipped. */
  .dash-topic-pill {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .dash-topic-row {
    flex-wrap: wrap;
  }

  #dashPerfStats {
    grid-template-columns: 1fr 1fr;
  }

  .dash-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-quick-btn {
    width: 100%;
  }

  .portal-logout-btn {
    width: 100%;
  }

  .portal-quiz-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .dashboard-grid {
    gap: 12px;
    padding: 16px 12px 24px;
  }

  .dash-welcome h1 {
    font-size: 1.3rem;
  }

  .dash-card {
    padding: 12px 12px 14px;
  }

  .dash-card .dash-value {
    font-size: 1.4rem;
  }

  #dashPerfStats {
    grid-template-columns: 1fr;
  }

  .dash-quick-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dash-loading::before {
    animation: none;
  }

  .dash-card,
  .portal-quiz-card,
  .dash-card:hover,
  .portal-quiz-card:hover {
    transform: none;
    transition: none;
  }
}

