/* Portal pages (login, my apps, admin, ...). Uses the colours and buttons from styles.css. */

.portal-body { min-height: 100vh; display: flex; flex-direction: column; }

/* Top bar (Portal pages, and the Privacy Notice / PAIA pages): logo | divider | P-I-A-C line over "Portal".
   The Portal navigation is the sidebar under it (see "Portal sidebar" below). */
.portal-bar { background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.portal-bar-inner {
  display: grid; grid-template-columns: auto auto 1fr; align-items: center;
  min-height: 104px; padding-top: 12px; padding-bottom: 12px;
}
.portal-logo { grid-column: 1; grid-row: 1 / 3; margin-right: 28px; }
.portal-bar .logo img { height: 76px; }
.portal-bar .acronym, .portal-name {   /* the divider runs down both lines */
  grid-column: 2; align-self: stretch; display: flex; align-items: center;
  padding-left: 28px; border-left: 2px solid var(--border);
}
.portal-bar .acronym { grid-row: 1; margin: 0; padding-bottom: 4px; flex-wrap: nowrap; white-space: nowrap; }   /* always one line */
.portal-name { grid-row: 2; padding-top: 4px; font-size: 1.6rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; color: var(--text); }
/* Privacy Notice / PAIA pages: Website, PAIA Manual and the theme switch on the right */
.portal-nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.portal-nav a { color: var(--text-muted); text-decoration: none; font-weight: 600; }
.portal-nav a:hover { color: var(--text); }
.inline { display: inline; margin: 0; }

/* ---------- Portal sidebar (user, 2026-10-12): the website's sidebar (styles.css, script.js) under the Portal header ----------
   Computers: the header stays at the top (sticky); the rail / open sidebar runs from under it to the bottom. */
:root { --head-h: 104px; }
.portal-head .portal-bar-inner { grid-template-columns: auto auto 1fr auto; padding: 12px 24px; }
.portal-head .menu-toggle { grid-column: 4; grid-row: 1 / 3; }
.portal-page { flex: 1; display: flex; flex-direction: column; }
.portal-side .sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.side-user { margin: 0; font-size: 0.9rem; color: var(--text-muted); }
.side-user b { color: var(--text); }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.side-form { display: contents; }
/* Log Out is a form button (POST with CSRF); it looks like the other sidebar links */
.side-nav .side-link {
  display: flex; align-items: center; gap: 14px;
  padding: clamp(6px, 1.2vh, 12px) 0 clamp(6px, 1.2vh, 12px) 16px;
  border: 0; border-left: 3px solid transparent; background: none;
  color: var(--text-muted); font: inherit; font-weight: 600; font-size: 1.05rem; text-align: left; cursor: pointer;
}
.side-nav .side-link:hover { color: var(--text); }
.side-nav a.side-call, .side-nav a.side-call:hover { color: var(--accent-strong); }
.side-call .nav-icon { stroke: var(--accent); }

@media (min-width: 1025px) {
  .portal-head { position: sticky; top: 0; z-index: 25; }
  .portal-head .portal-bar-inner { height: var(--head-h); padding-top: 0; padding-bottom: 0; }
  .portal-side { top: var(--head-h); }
  .nav-open .portal-side .rail-toggle { position: static; }   /* stays in the corner, not over the first link */
  :root:not(.nav-open) .portal-side .sidebar-top { justify-content: center; }
  :root:not(.nav-open) .side-user { display: none; }
  :root:not(.nav-open) .side-bottom { align-items: center; }
  :root:not(.nav-open) .side-nav .side-link { justify-content: center; width: 52px; min-height: 44px; padding: 0; }
  :root:not(.nav-open) .side-call:hover { background: var(--accent-soft); border-radius: 8px; }
  .nav-open .side-user { animation: nav-fade 0.25s ease; }
  .app-frame { min-height: calc(100vh - var(--head-h)); }
}
/* Short screens (e.g. 1366 x 768 laptops, ~650px inside the browser): tighter rail so every item fits */
@media (min-width: 1025px) and (max-height: 760px) {
  .portal-side { gap: 12px; padding-top: 14px; padding-bottom: 14px; }
  :root:not(.nav-open) .portal-side .side-nav a, :root:not(.nav-open) .side-nav .side-link { min-height: 38px; }
  .side-bottom { gap: 6px; }
  .nav-open .portal-side .side-nav a, .nav-open .side-nav .side-link { padding-top: 6px; padding-bottom: 6px; }
}
/* Tablets and phones: no rail; the ☰ in the header opens the sidebar menu under the header */
@media (max-width: 1024px) {
  .portal-side { position: static; }
  .portal-side:not(.open) { display: none; }
  .portal-side .sidebar-menu { padding-top: 16px; }
  .side-bottom { margin-top: 0; }
}

.portal-main { padding-top: 48px; padding-bottom: 64px; flex: 1; }
.portal-main h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); }

/* Cards */
.portal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  margin-bottom: 24px;
}
.portal-card.narrow { max-width: 480px; margin: 24px auto; }
.portal-card h2 { font-size: 1.4rem; display: flex; align-items: center; gap: 10px; }
.count {
  font-size: 0.85rem; font-weight: 700; color: var(--on-accent); background: var(--accent);
  border-radius: 999px; padding: 2px 10px;
}
.muted-text { color: var(--text-muted); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.95rem; }
.form small { font-weight: 400; color: var(--text-muted); }
.form input, .form select, .form textarea {
  font: inherit; font-weight: 400;
  padding: 10px 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.form .btn { align-self: flex-start; cursor: pointer; font: inherit; font-weight: 600; }
.form-inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); align-items: end; }
.form-grid .wide { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.form label.check { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
.field-hint { font-weight: 400; font-size: 0.85rem; }
.field-warn { color: var(--accent-strong); font-weight: 600; font-size: 0.9rem; }
.trap { position: absolute; left: -9999px; }   /* hidden spam trap */
.btn { cursor: pointer; font: inherit; font-weight: 600; }
.btn-ghost { background: transparent; }   /* <button> elements otherwise get the browser's grey/white background */
.btn-danger:hover { border-color: #DC2626; color: #DC2626; }

/* Messages */
.notice { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border-left: 4px solid; }
.notice-ok    { border-color: #16A34A; background: rgba(22, 163, 74, 0.12); }
.notice-error { border-color: #DC2626; background: rgba(220, 38, 38, 0.12); }
.notice-warn  { border-color: var(--accent); background: var(--accent-soft); }
.temp-pass { font-size: 1.15rem; font-weight: 700; padding: 2px 8px; background: var(--bg); border-radius: 6px; user-select: all; }

/* My apps */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 24px; }
.app-card {
  display: flex; flex-direction: column;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s;
}
.app-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.app-card p { color: var(--text-muted); flex: 1; margin-bottom: 0; }   /* the whole card is the link */

/* Placeholder pages (Project Docs) */
.placeholder { max-width: 720px; margin-top: 24px; border-top: 3px solid var(--accent); }

/* Training: course page (hero, info strip, module list) */
.course-hero { max-width: 52em; margin-bottom: 32px; }
.course-points { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 6px; }
.course-points li { padding-left: 22px; position: relative; }
.course-points li::before { content: "✓"; position: absolute; left: 0; color: var(--accent-strong); font-weight: 700; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; transform: none; }

.course-info {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  margin: 0 0 40px;
  background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.course-info div { background: var(--surface); padding: 16px 20px; }
.course-info dt { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent-strong); }
.course-info dd { margin: 4px 0 0; font-weight: 600; }

.module-list { list-style: none; padding: 0; margin: 16px 0 0; counter-reset: module; display: grid; gap: 12px; }
.module-list li {
  counter-increment: module;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 22px 18px 72px; position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.module-list li::before {
  content: counter(module, decimal-leading-zero);
  position: absolute; left: 22px; top: 50%; transform: translateY(-50%);
  font-size: 1.3rem; font-weight: 700; color: var(--accent-strong);
}
.module-list h3 { margin: 0 0 2px; }
.module-list p { margin: 0; color: var(--text-muted); }
.lesson-count { white-space: nowrap; font-size: 0.9rem; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 12px; }

/* An open app (app.php): fills the screen below the header */
.portal-main.app-page { max-width: none; padding: 0; display: flex; }
.app-frame { flex: 1; width: 100%; min-height: 70vh; border: 0; display: block; }

/* Reports & Analytics, Remote Dashboard: empty placeholder rows/cards */
.empty-list { display: grid; gap: 12px; margin-top: 16px; }
.empty-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border: 1px dashed var(--border); border-radius: 10px; color: var(--text-muted);
}

.placeholder-card { border-style: dashed; border-top-style: solid; }
.placeholder-card:hover { transform: none; border-color: var(--border); border-top-color: var(--accent); }

/* Admin lists */
.request, .user-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 2fr auto;
  gap: 16px 24px;
  align-items: center;
  padding: 18px 0;
  border-top: 1px solid var(--border);
}
.reason { margin: 8px 0 0; color: var(--text-muted); }
.user-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-admin {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent-strong); border: 1px solid var(--accent); border-radius: 999px; padding: 1px 8px;
}

/* Up to 1180px: lower top bar (Privacy Notice / PAIA pages too) */
@media (max-width: 1180px) {
  .portal-bar-inner { grid-template-columns: auto auto 1fr auto; min-height: 0; }
}
/* Phones: smaller logo, no P-I-A-C line; "Portal" next to the logo */
@media (max-width: 700px) {
  .portal-bar .logo img { height: 52px; }
  .portal-logo { margin-right: 16px; }
  .portal-bar .acronym { display: none; }
  .portal-name { grid-row: 1 / 3; padding: 0 0 0 16px; font-size: 1.3rem; }
}
@media (max-width: 900px) {
  .request, .user-row { grid-template-columns: 1fr; }
  .course-info { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .portal-card { padding: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .module-list li { flex-direction: column; align-items: flex-start; padding-left: 60px; }
  .module-list li::before { top: 18px; transform: none; left: 18px; }
}

/* Privacy Notice and PAIA Manual pages (privacy.html, paia.html) */
.legal { max-width: 860px; }
.legal h2 { font-size: 1.3rem; margin-top: 32px; }
.legal ul { padding-left: 1.2em; }
.legal li { margin-bottom: 6px; }
.legal-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 10px 12px; border: 1px solid var(--border); }
.legal-table th { width: 30%; background: var(--bg-alt); font-weight: 600; }
.form-privacy { font-size: 0.85rem; }
