/* =========================================================
   PPS+ Coursework (Exams/Quizzes/Homework) — Premium OS Theme
   ========================================================= */

:root{
  --bg: #0b0f17;
  --panel: rgba(255,255,255,.06);
  --panel-2: rgba(255,255,255,.08);
  --stroke: rgba(255,255,255,.10);
  --stroke-2: rgba(255,255,255,.14);

  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.68);
  --muted-2: rgba(255,255,255,.48);

  --accent: #7c5cff;
  --accent-2: rgba(124,92,255,.22);

  --shadow: 0 16px 50px rgba(0,0,0,.44);
  --shadow-soft: 0 10px 28px rgba(0,0,0,.26);

  --r12: 12px;
  --r16: 16px;
  --r18: 18px;

  --max: 1120px;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* Ambient background */
.bg{
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 800px at 15% 10%, rgba(124,92,255,.22), transparent 55%),
    radial-gradient(900px 700px at 85% 12%, rgba(124,92,255,.12), transparent 55%),
    radial-gradient(900px 700px at 50% 88%, rgba(124,92,255,.10), transparent 55%),
    linear-gradient(180deg, rgba(0,0,0,.20), transparent 35%);
}
.bg::after{
  content:"";
  position:absolute;
  inset:0;
  opacity:.12;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.16) 1px, transparent 0);
  background-size: 18px 18px;
  mix-blend-mode: overlay;
}

/* Topbar */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: linear-gradient(180deg, rgba(0,0,0,.28), rgba(0,0,0,.10));
  border-bottom: 1px solid var(--stroke);
}
.topbar-inner{
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  gap: 12px;
}
.brand{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.brand-mark{
  width: 14px;
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), rgba(255,255,255,.25));
  box-shadow: 0 0 0 4px rgba(124,92,255,.12);
}
.brand-name{
  font-weight: 750;
  letter-spacing: -0.02em;
  font-size: 14px;
  opacity: .92;
}
.topbar-title{
  justify-self: center;
  text-align: center;
}
.kicker{
  font-size: 11px;
  color: var(--muted-2);
  letter-spacing: .34px;
  text-transform: uppercase;
}
.headline{
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.topbar-actions{
  justify-self: end;
}
.icon-btn{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--panel);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0,0,0,.12);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.icon-btn:hover{
  transform: translateY(-1px);
  border-color: var(--stroke-2);
  box-shadow: var(--shadow-soft);
}
.icon-btn:active{ transform: translateY(0px) scale(.98); }
.icon-btn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-2), var(--shadow-soft);
}

/* Shell */
.shell{
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px 18px 56px;
}

/* Hero */
.hero{ padding-top: 16px; }
.hero-card{
  border-radius: var(--r18);
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
  padding: 20px 20px 16px;
  position: relative;
  overflow: hidden;
}
.hero-card::before{
  content:"";
  position:absolute;
  inset:-2px;
  background:
    radial-gradient(700px 420px at 20% 0%, rgba(124,92,255,.18), transparent 60%),
    radial-gradient(520px 340px at 90% 20%, rgba(124,92,255,.10), transparent 62%);
  pointer-events:none;
}
.hero-top{
  position: relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.status-pill{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.12);
  color: var(--muted);
  font-size: 12px;
}
.dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(124,92,255,.18);
}
.filters{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pill{
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.10);
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.pill:hover{ transform: translateY(-1px); border-color: var(--stroke-2); background: rgba(255,255,255,.06); }
.pill.active{
  color: var(--text);
  border-color: rgba(124,92,255,.35);
  background: rgba(124,92,255,.16);
}
.pill:focus-visible{
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-2);
}

.hero-title{
  position: relative;
  margin: 14px 0 8px;
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: -0.04em;
  line-height: 1.08;
  font-weight: 820;
}
.hero-sub{
  position: relative;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  max-width: 72ch;
}

/* Quick stats */
.quick{
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.quick-item{
  border-radius: var(--r16);
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.12);
  padding: 12px 12px 10px;
  min-height: 74px;
}
.quick-label{
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 700;
}
.quick-value{
  margin-top: 8px;
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -0.02em;
}

/* Content list area */
.content{ margin-top: 16px; }
.status-line{ margin: 10px 0 14px; }
.muted{ color: var(--muted); }

/* Styling hooks for exams.js output:
   - If your JS keeps using .exam-date-section/.exam-grid/.exam-card, we support those too.
*/
.list{ display: grid; gap: 18px; }

/* Modern default structure (recommended for exams.js):
   .date-section > .date-head + .card-grid > .item-card
*/
.date-section{
  border-radius: var(--r18);
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.04));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.date-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.date-title{
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .26px;
  text-transform: uppercase;
  color: rgba(255,255,255,.82);
}
.date-meta{
  font-size: 12px;
  color: var(--muted);
}
.card-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px 16px;
}
.item-card{
  border-radius: var(--r16);
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
  padding: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.item-card:hover{
  transform: translateY(-2px);
  border-color: rgba(255,255,255,.14);
  box-shadow: 0 16px 40px rgba(0,0,0,.28);
}
.item-title{
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: -0.01em;
}
.item-meta{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.item-desc{
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255,255,255,.82);
  line-height: 1.5;
}
.attachments{
  margin-top: 12px;
  display: grid;
  gap: 8px;
}
.attachments a{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  text-decoration: none;
  color: rgba(255,255,255,.90);
  font-weight: 650;
  font-size: 12px;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.attachments a:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.14);
}

/* Compatibility with your current exams.html structure */
.exam-list{ display:block; margin-top: 8px; }
.exam-date-section{
  margin-top: 14px;
  border-radius: var(--r18);
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.04));
  box-shadow: var(--shadow-soft);
  overflow:hidden;
}
.exam-dateheader{
  text-align:left;
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .26px;
  text-transform: uppercase;
  color: rgba(255,255,255,.82);
  opacity: 1;
}
.exam-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px 16px;
  justify-items: stretch;
}
.exam-card{
  width: 100%;
  max-width: none;
  margin: 0;
  border-radius: var(--r16);
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
  padding: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.exam-card:hover{
  transform: translateY(-2px);
  border-color: rgba(255,255,255,.14);
  box-shadow: 0 16px 40px rgba(0,0,0,.28);
}
.exam-title{ margin: 0 0 6px 0; font-size: 14px; font-weight: 850; letter-spacing:-.01em; }
.exam-meta{ opacity: 1; font-size: 12px; color: var(--muted); line-height: 1.45; }
.exam-desc{ margin-top: 10px; font-size: 12px; color: rgba(255,255,255,.82); line-height: 1.5; opacity: 1; }
.attachments{ margin-top: 12px; display: grid; gap: 8px; }
.exam-card a{ text-decoration:none; color: rgba(255,255,255,.90); }

/* Footer */
.footnote{ margin-top: 18px; }
.footnote-inner{
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  color: var(--muted-2);
  font-size: 12px;
  padding: 16px 0 0;
}
.footnote-dot{ opacity: .6; }

/* Responsive */
@media (max-width: 900px){
  .topbar-inner{ grid-template-columns: 1fr auto 1fr; }
  .topbar-title{ justify-self: center; }
  .quick{ grid-template-columns: 1fr; }
  .card-grid{ grid-template-columns: 1fr; }
  .exam-grid{ grid-template-columns: 1fr; }
}
@media (max-width: 520px){
  .shell{ padding: 16px 14px 48px; }
  .topbar-inner{ padding: 12px 14px; }
  .hero-card{ padding: 18px 16px 14px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  *{ transition:none !important; animation:none !important; scroll-behavior:auto !important; }
}

/* =========================================================
   Detail modal
   ========================================================= */
.modal{
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}
.modal.show{ display:block; }
.modal-backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
}
.modal-card{
  position: relative;
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  margin: 12px auto;
  border-radius: var(--r18);
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.05));
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
}
.modal-close{
  position: sticky;
  top: 0;
  float: right;
  border: 1px solid var(--stroke);
  background: rgba(0,0,0,.18);
  color: rgba(255,255,255,.92);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  cursor: pointer;
}
.modal-close:hover{ background: rgba(255,255,255,.06); }
.modal-head{ padding-top: 6px; }
.modal-kicker{
  font-size: 11px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: .34px;
}
.modal-title{
  margin-top: 6px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.modal-meta{
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.modal-body{ margin-top: 12px; }
.modal-text{
  white-space: pre-wrap;
  color: rgba(255,255,255,.88);
  line-height: 1.55;
  font-size: 13px;
}
.modal-attachments{
  margin-top: 14px;
  display: grid;
  gap: 8px;
}
.modal-attachments a{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  text-decoration: none;
  color: rgba(255,255,255,.92);
  font-weight: 750;
  font-size: 12px;
}
.modal-attachments a:hover{
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.14);
  transform: translateY(-1px);
}
.item-card{ cursor: pointer; }
.item-card a{ color: inherit; text-decoration: none; }
.item-card a:visited{ color: inherit; }

/* Attachments inside cards */
.attachments-inline{
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.attachments-inline a{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  text-decoration: none;
  color: rgba(255,255,255,.92);
  font-weight: 750;
  font-size: 12px;
  max-width: 100%;
}
.attachments-inline a:hover{
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.14);
}
.attach-ico{ opacity:.9; }
.attach-name{
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}
@media (max-width: 520px){
  .attach-name{ max-width: 160px; }
}
