/* ============================================================
   MAW Intranet — Shared Styles v17
   Mulberry Academy Woodside
   Clean light-mode · professional school design
   ============================================================ */

:root {
  /* ── Brand ── */
  --navy:          #0D1E33;
  --navy-mid:      #1A3050;
  --purple:        #59527B;
  --purple-hover:  #4A4468;
  --purple-light:  #F1F0F8;
  --purple-mid:    #C7C3DA;
  --maintenance:        #4F4A78;
  --maintenance-hover:  #433E68;
  --maintenance-light:  #ECEAF6;
  --maintenance-border: #B4AED1;

  /* ── Page surfaces — neutral white-grey ── */
  --bg:            #EDF1F5;
  --surface:       #F7F9FC;
  --surface2:      #EEF2F7;
  --surface3:      #E2E8F0;
  --panel:         rgba(247, 249, 252, .96);
  --panel-strong:  #FFFFFF;
  --header-bg:     #59527B;
  --header-border: #746D9A;

  /* ── Borders ── */
  --border:        #D8E0EA;
  --border2:       #C7D2E0;

  /* ── Text ── */
  --text:          #1A2735;
  --muted:         #4C6275;
  --muted2:        #7F93A8;

  /* ── Accent aliases (maps to purple) ── */
  --accent:        var(--purple);
  --accent-hover:  var(--purple-hover);
  --accent-light:  var(--purple-light);
  --accent-border: var(--purple-mid);
  --accent-text:   var(--purple);

  /* ── Mulberry Trust Purple ── */
  --mulberry-purple:        #6B2F8A;
  --mulberry-accent:        #9B59C0;
  --mulberry-purple-light:  #F5EDF9;
  --mulberry-purple-border: #CFACE0;
  --mulberry-purple-text:   #6B2F8A;

  /* ── Semantic colours ── */
  --blue:          #1D6FAF;
  --blue-light:    #EFF6FF;
  --blue-border:   #BAD7F4;

  --green:         #0E7A5A;
  --green-light:   #EDFAF4;
  --green-border:  #9EE1C8;

  --orange:        #C46200;
  --orange-light:  #FFF7ED;
  --orange-border: #F5C990;

  --red:           #C52A2A;
  --red-light:     #FEF2F2;
  --red-border:    #F5BABA;

  --cyan:          #0284A4;
  --cyan-light:    #ECFCFF;
  --cyan-border:   #9ADCEE;

  /* Handy aliases used in asset-loans */
  --stroke:        var(--border);
  --r:             var(--red);
  --y:             var(--orange);

  /* ── Gradients (smooth, no glow) ── */
  --grad:       linear-gradient(135deg, #241848 0%, #6B2F8A 58%, #C26D4B 100%);
  --grad-hover: linear-gradient(135deg, #1C1239 0%, #59267A 58%, #AF5D3D 100%);

  /* ── Shape & depth ── */
  --radius:    6px;
  --max:       1140px;
  --shadow:    0 6px 20px rgba(30, 41, 59, .06), 0 1px 4px rgba(30, 41, 59, .04);
  --shadow-sm: 0 2px 10px rgba(30, 41, 59, .05);
  --shadow-md: 0 12px 28px rgba(30, 41, 59, .08);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  font-family: "Aptos", "Segoe UI Variable", "Segoe UI", "Trebuchet MS",
               Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before,
body::after {
  display: none;
}

.bg, .gradient-orb, .noise { display: none !important; }

/* ── Layout ── */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px 52px;
}

@supports (overflow: overlay) {
  .table-container,
  .sheet-wrap,
  .student-list {
    overflow: overlay;
  }
}

/* ─────────────────────────────────────────────────────────
   HEADER — floating, rounded, deep navy
───────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  background: var(--header-bg);
  margin: 12px 0 20px;
  min-height: 66px;
  position: sticky;
  top: 12px;
  z-index: 100;
  border-radius: 8px;
  border: 1px solid var(--header-border);
  box-shadow: 0 5px 18px rgba(32, 41, 58, .12);
}

/* Logo / brand block */
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand h1 { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: .1px; }
.brand p  { font-size: 11.5px; color: rgba(255,255,255,.62); margin-top: 2px; }
.brand img {
  height: 44px; width: auto;
  filter: brightness(0) invert(1);
  opacity: .92;
}

.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }

/* Status pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.88);
  font-size: 12px; white-space: nowrap; height: 36px;
}
.dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: #34d399; flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────────── */

/* Ghost nav button (on dark header) */
.btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.92);
  padding: 0 16px; border-radius: 6px;
  font-size: 12.5px; font-family: inherit; font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap; height: 36px; text-decoration: none;
}
.btn:hover  { background: rgba(255,255,255,.17); color: #fff; border-color: rgba(255,255,255,.28); }
.btn:active { opacity: .85; }

/* Buttons inside content panels (light mode context) */
.card .btn, .pw-topbar .btn, .upl-btns .btn,
.copy-btn, .detail-actions .btn, .card-header .btn,
.search-row .btn, .pw-search-wrap .btn {
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--muted);
  height: 32px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.card .btn:hover, .pw-topbar .btn:hover, .upl-btns .btn:hover,
.copy-btn:hover, .card-header .btn:hover,
.search-row .btn:hover, .pw-search-wrap .btn:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--purple-mid);
}

/* Nav button */
.btn.nav-btn {
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.18);
  color: rgba(255,255,255,.85);
}
.btn.nav-btn.is-current {
  background: rgba(255,255,255,.18);
  color: #fff;
  border-color: rgba(255,255,255,.3);
  pointer-events: none;
}
.btn.nav-btn:hover {
  background: rgba(255,255,255,.16);
  color: #fff;
  border-color: rgba(255,255,255,.28);
}

/* Admin button */
.btn.admin-btn {
  background: rgba(255,255,255,.09);
  border-color: rgba(255,255,255,.18);
  color: rgba(255,255,255,.85);
}
.btn.admin-btn:hover {
  background: rgba(255,255,255,.16);
  color: #fff;
  border-color: rgba(255,255,255,.28);
}

/* Primary CTA */
.btn-primary {
  background: var(--purple) !important;
  border-color: transparent !important;
  color: #fff !important;
  font-weight: 600;
  height: 32px !important;
  letter-spacing: .1px;
  box-shadow: 0 1px 4px rgba(91,75,181,.25) !important;
}
.btn-primary:hover {
  background: var(--purple-hover) !important;
  box-shadow: 0 2px 8px rgba(91,75,181,.35) !important;
  opacity: 1;
}

/* Danger */
.btn-danger {
  background: var(--red-light) !important;
  border-color: var(--red-border) !important;
  color: var(--red) !important;
  box-shadow: none !important;
}
.btn-danger:hover { background: #fde8e8 !important; }

/* Logout */
.logout-btn { color: rgba(255,255,255,.6) !important; }
.logout-btn:hover {
  background: rgba(200,40,40,.2) !important;
  border-color: rgba(200,80,80,.3) !important;
  color: #fca5a5 !important;
}

/* ─────────────────────────────────────────────────────────
   CARDS
───────────────────────────────────────────────────────── */
.card {
  margin-top: 16px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px 12px;
  border-bottom: 2px solid var(--border2);
  background: #DDE4EE;
  display: flex; align-items: center;
  justify-content: space-between; gap: 10px;
}
.card-header h2, .card-header > div h2 {
  font-size: 13px; font-weight: 700;
  color: var(--navy); margin-bottom: 2px;
}
.card-header p, .card-header > div p {
  font-size: 11px; color: var(--muted);
}
.card-body { padding: 16px 18px; }
.inner { padding: 18px 20px; }

main > .card,
.stats-grid,
.stats-strip,
.table-container,
.sheet-wrap,
.student-list {
  content-visibility: auto;
  contain-intrinsic-size: 360px;
}

.title {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px; margin-bottom: 14px;
}
.title h2    { font-size: 13px; font-weight: 700; color: var(--text); }
.title small { color: var(--muted2); font-size: 11px; }

/* ─────────────────────────────────────────────────────────
   FOOTER
───────────────────────────────────────────────────────── */
footer {
  margin-top: 32px; padding: 14px 0;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted2); gap: 12px;
}
footer a { color: var(--muted); text-decoration: none; margin-left: 12px; }
footer a:hover { color: var(--purple); text-decoration: underline; }

/* ─────────────────────────────────────────────────────────
   LINKS
───────────────────────────────────────────────────────── */
a { color: var(--purple); }
a:hover { color: var(--purple-hover); }

/* ─────────────────────────────────────────────────────────
   ALERTS
───────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 13px; line-height: 1.6;
  margin-top: 14px; border: 1px solid;
}
.alert-info    { background: var(--purple-light);   border-color: var(--purple-mid);      color: var(--purple); }
.alert-success { background: var(--green-light);  border-color: var(--green-border);  color: var(--green); }
.alert-warning { background: var(--orange-light); border-color: var(--orange-border); color: var(--orange); }
.alert-danger  { background: var(--red-light);    border-color: var(--red-border);    color: var(--red); }

/* ─────────────────────────────────────────────────────────
   FORM INPUTS
───────────────────────────────────────────────────────── */
input[type="text"], input[type="password"], input[type="email"],
input[type="search"], input[type="date"], select, textarea {
  appearance: none; width: 100%;
  padding: 8px 12px; border: 1px solid var(--border2); border-radius: 6px;
  background: var(--panel-strong); color: var(--text);
  font-size: 13px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-light);
}
input::placeholder, textarea::placeholder { color: var(--muted2); }
input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: .55;
}
select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234C6275' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px;
  padding-right: 32px !important;
}
select option { background: var(--surface); color: var(--text); }

/* ─────────────────────────────────────────────────────────
   TOAST
───────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--navy);
  color: #fff;
  border: 1px solid rgba(255,255,255,.12);
  padding: 10px 18px; border-radius: var(--radius); font-size: 13px;
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  z-index: 1000; pointer-events: none;
  max-width: calc(100vw - 40px);
  box-shadow: 0 8px 28px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }

::selection {
  background: rgba(107, 47, 138, .22);
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .wrap   { padding: 0 14px 36px; }
  header  { min-height: 54px; padding: 8px 14px; flex-wrap: wrap; position: relative; }
  .top-actions { flex-wrap: wrap; width: 100%; }
  .pill   { height: 30px; font-size: 11px; padding: 4px 10px; }
  .btn    { height: 30px; font-size: 11px; padding: 0 10px; }
  .card   { margin-top: 12px; }
  .inner  { padding: 14px 16px; }
  .card-header { padding: 10px 16px 9px; }
  .card-body   { padding: 12px 16px; }
  footer  { flex-direction: column; text-align: center; }
  .toast  { bottom: 12px; right: 12px; left: 12px; }
}
@media (max-width: 480px) {
  .wrap  { padding: 0 10px 32px; }
  .inner { padding: 12px; }
}
