/* GUIDE Institute portal — builds on ../styles.css */

body.portal { background: var(--bg); display: flex; flex-direction: column; min-height: 100vh; }
.portal-main { flex: 1; padding: 32px 0 64px; }
.portal-footer { background: var(--white); border-top: 1px solid var(--border); padding: 20px 0; font-size: 0.92rem; }
.portal-footer p { margin: 0; }

/* Header bits */
.portal .site-nav { margin-left: auto; }
.portal .brand { margin-right: 0; }
.portal-who {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--white);
  font-weight: 600;
  line-height: 1.2;
  font-size: 0.95rem;
}
.portal-who span { color: var(--yellow); font-size: 0.75rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.nav-logout { margin: 0; }
.nav-logout button {
  min-height: 44px;
  padding: 0 14px;
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--pill);
  color: var(--on-navy);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.nav-logout button:hover { border-color: var(--white); color: var(--white); }
.nav-logout--solo { margin-left: auto; }
@media (max-width: 1140px) {
  .portal .site-nav { margin-left: 0; }
  .portal-who { margin-left: auto; }
  .nav-logout button { width: 100%; text-align: left; border: 0; border-radius: var(--radius-sm); font-size: 1.1rem; min-height: 48px; padding: 0 16px; }
}
@media (max-width: 420px) { .portal-who { display: none; } }

/* Notices */
.notice {
  margin: 0 0 20px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--navy);
  font-weight: 500;
}
.notice--ok { border-color: #9FD3B0; background: #EAF7EF; color: #1E5631; }
.notice--info { border-color: var(--yellow); background: var(--pale); }
.notice--error { border-color: #E8A9A9; background: #FDEEEE; color: #8A1F1F; }

/* Layout pieces */
.p-title { font-size: clamp(1.8rem, 2vw + 1rem, 2.4rem); margin-bottom: 24px; }
.p-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.p-title-row .p-title { margin: 0; }
.p-lead { font-size: 1.1rem; }
.p-section { margin-top: 36px; }
.p-section > h2 { font-size: 1.45rem; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.p-sub { font-size: 1.1rem; margin-top: 22px; }
.p-narrow { max-width: 520px; margin: 24px auto 0; }
.p-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 30px);
  box-shadow: 0 4px 16px rgba(22, 33, 62, 0.05);
}
.p-card + .p-card { margin-top: 16px; }
.p-card h1 { font-size: 2rem; }
.p-empty { text-align: center; color: var(--text); }
.p-empty p:last-child { margin-bottom: 0; }
.p-muted { color: #6B7085; }
.p-meta { color: var(--text); margin: 0 0 6px; font-size: 0.95rem; }
.p-breadcrumb { font-size: 0.92rem; margin: 0 0 14px; }
.p-help { font-size: 0.92rem; margin: 18px 0 0; }
.p-form { display: grid; gap: 16px; }
.p-form.form-grid { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .p-form.form-grid { grid-template-columns: 1fr; } }
.p-form .field input[type="file"] { padding: 10px; min-height: 52px; }
.p-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.p-actions--split { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 22px; }
.p-actions form { margin: 0; }
.p-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
@media (max-width: 860px) { .p-two { grid-template-columns: 1fr; } }

/* Status chips */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: var(--pill);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}
.chip--neutral { background: var(--bg); color: var(--navy); border-color: var(--border); }
.chip--soon { background: var(--pale); color: #6B4E00; border-color: var(--yellow); }
.chip--late { background: #FDEEEE; color: #8A1F1F; border-color: #E8A9A9; }
.chip--done { background: #EAF7EF; color: #1E5631; border-color: #9FD3B0; }
.chip--graded { background: var(--navy); color: var(--white); }

/* Class cards */
.p-class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.p-class-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 6px solid var(--yellow);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
}
.p-class-card h3 { margin-bottom: 6px; }
.p-class-card h3 a { color: var(--navy); text-decoration: none; }
.p-class-card h3 a:hover { text-decoration: underline; }
.p-class-card .p-actions { margin-top: auto; padding-top: 12px; }
.p-class-subject { margin: 0 0 4px; font-size: 0.8rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text); }

/* Lists of work and grades */
.p-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.p-list li { display: flex; align-items: stretch; gap: 8px; }
.p-list li > a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  padding: 12px 18px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--navy);
  text-decoration: none;
  transition: border-color 0.15s ease;
}
.p-list li > a:hover { border-color: var(--yellow); }
.p-list-main { display: flex; flex-direction: column; min-width: 0; }
.p-list-main span { color: var(--text); font-size: 0.9rem; }
.p-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.p-grade { font-weight: 800; color: var(--navy); white-space: nowrap; }
.p-grade--big { font-size: 2rem; margin: 0 0 8px; }
@media (max-width: 520px) {
  .p-list li > a { flex-direction: column; align-items: flex-start; }
  .p-chips { justify-content: flex-start; }
}

.p-delete { display: flex; margin: 0; }
.p-delete button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: #8A1F1F;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.p-delete button:hover { border-color: #E8A9A9; background: #FDEEEE; }

/* Books and recordings */
.p-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.p-file {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.p-file .p-list-main { flex: 1; }
.p-file-icon {
  flex-shrink: 0;
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--pale);
  border: 1px solid var(--yellow);
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.p-file-icon--play { background: var(--navy); border-color: var(--navy); color: var(--yellow); font-size: 1.1rem; }
@media (max-width: 520px) {
  .p-file { flex-wrap: wrap; }
  .p-file .p-list-main { flex-basis: calc(100% - 62px); }
}

/* Class page */
.p-class-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
  flex-wrap: wrap;
  padding: clamp(24px, 4vw, 36px);
  background: var(--navy);
  color: var(--on-navy);
  border-radius: var(--radius);
}
.p-class-hero h1 { color: var(--white); margin-bottom: 6px; font-size: clamp(1.8rem, 2vw + 1rem, 2.4rem); }
.p-class-hero .p-class-subject { color: var(--yellow); }
.p-class-hero .p-meta { color: var(--on-navy); }
.p-join .btn { white-space: normal; }

.p-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; }
.p-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--pill);
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
}
.p-tabs a:hover { border-color: var(--yellow); }
.p-tabs a[aria-current="page"] { background: var(--navy); border-color: var(--navy); color: var(--white); }
.p-tabs--pills { margin: 0 0 18px; }
.p-section[id] { scroll-margin-top: calc(var(--header-h) + 16px); }

.p-add {
  margin: 0 0 16px;
  background: var(--white);
  border: 2px dashed var(--yellow);
  border-radius: var(--radius);
}
.p-add[open] { border-style: solid; }
.p-add summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 20px;
  color: var(--navy);
  font-weight: 700;
}
.p-add summary::-webkit-details-marker { display: none; }
.p-add summary::before {
  content: "+";
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--yellow);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800;
}
.p-add[open] summary::before { content: "–"; }
.p-add form { padding: 4px 20px 22px; }
.p-check-inline { align-self: end; }

/* Assignment page */
.p-facts { display: grid; gap: 10px; margin: 16px 0; }
.p-facts > div { display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.p-facts dt { font-weight: 700; color: var(--text); }
.p-facts dd { margin: 0; color: var(--navy); font-weight: 600; overflow-wrap: anywhere; }
.p-facts--row { grid-template-columns: repeat(3, 1fr); }
.p-facts--row > div { display: block; padding: 12px 14px; background: var(--bg); border-radius: 14px; }
.p-facts--row dt { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; }
@media (max-width: 600px) {
  .p-facts--row { grid-template-columns: 1fr; }
  .p-facts > div { grid-template-columns: 1fr; gap: 2px; }
}
.p-instructions { white-space: normal; color: var(--navy); line-height: 1.7; }
.p-upload h3 { margin-bottom: 0; }
.p-result { border-color: var(--yellow); background: var(--pale); }
.p-note { font-style: italic; }

.p-grade-list { display: grid; gap: 14px; }
.p-grade-row { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; align-items: start; }
.p-grade-row h3 { margin-bottom: 6px; }
.p-grade-inputs { display: grid; gap: 10px; }
.p-grade-inputs .btn { justify-self: start; }
@media (max-width: 720px) { .p-grade-row { grid-template-columns: 1fr; } }

/* Tables */
.p-table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); }
.p-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.p-table th, .p-table td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.p-table thead th { background: var(--bg); color: var(--navy); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.p-table tbody tr:last-child > * { border-bottom: 0; }
.p-table tbody th { color: var(--navy); font-weight: 600; }
.p-table a { color: var(--navy); font-weight: 600; }
.p-gradebook th, .p-gradebook td { white-space: nowrap; }
.p-gradebook tbody th { position: sticky; left: 0; background: var(--white); }
.p-off { opacity: 0.6; }

/* Admin */
.p-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
@media (max-width: 720px) { .p-stats { grid-template-columns: 1fr 1fr; } }
.p-stat {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--navy);
  text-decoration: none;
}
.p-stat strong { font-size: 2rem; line-height: 1.1; }
.p-stat:hover { border-color: var(--yellow); }
.p-steps-card ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.p-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; max-height: 320px; overflow-y: auto; padding: 2px; }
.p-checks .check { min-height: 48px; }
.p-checks small { display: block; color: var(--text); font-weight: 400; font-size: 0.82rem; overflow-wrap: anywhere; }
.p-role-part { border: 0; padding: 0; margin: 0; }
.p-login-slip { border: 2px solid var(--yellow); background: var(--pale); margin-bottom: 20px; }
.p-login-slip code { font-size: 1.05rem; background: var(--white); padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); }
.p-danger { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.p-danger-btn { color: #8A1F1F; }

/* Parent view */
.p-child { margin-top: 28px; padding-top: 8px; }
.p-child + .p-child { border-top: 2px solid var(--border); margin-top: 40px; padding-top: 28px; }
.p-child-name { font-size: 1.8rem; }
.p-child-name::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--yellow); margin-right: 10px; vertical-align: middle; }
.portal .header-inner > a.btn { margin-left: auto; }

/* Grades table becomes cards on phones */
@media (max-width: 640px) {
  .p-table--stack thead { display: none; }
  .p-table--stack, .p-table--stack tbody, .p-table--stack tr, .p-table--stack th, .p-table--stack td { display: block; width: 100%; }
  .p-table--stack tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .p-table--stack tbody tr:last-child { border-bottom: 0; }
  .p-table--stack th, .p-table--stack td { border: 0 !important; padding: 3px 18px; }
  .p-table--stack td[data-label]::before { content: attr(data-label) ": "; font-weight: 700; color: var(--text); }
}
