/* ════════════════════════════════════════════════════════════
   shared.css — ReportFlow design tokens & global styles
   Used by: index.html, report-comments.html, sanctions.html

   HOW TO USE THIS FILE
   ────────────────────
   - Change colours → edit the COLOURS section below
   - Change font size → edit the TYPOGRAPHY section
   - Change border radius (roundness) → edit the GEOMETRY section
   ════════════════════════════════════════════════════════════ */


/* ──────────────────────────────────────────────────────────
   COLOURS
   Change these hex values to retheme the whole app at once.
   ────────────────────────────────────────────────────────── */
:root {
  /* Page background — rich warm wallpaper so glass has real colour to refract */
  --bg:       #e8e2d9;
  --bg-mesh:  radial-gradient(ellipse at 18% 0%,   rgba(253,224,71,.38) 0%, transparent 42%),
              radial-gradient(ellipse at 82% 5%,   rgba(251,191,36,.22) 0%, transparent 36%),
              radial-gradient(ellipse at 70% 100%, rgba(217,119,6,.28)  0%, transparent 50%),
              radial-gradient(ellipse at 0%  85%,  rgba(253,224,71,.18) 0%, transparent 42%),
              radial-gradient(ellipse at 50% 55%,  rgba(245,158,11,.08) 0%, transparent 60%);

  /* Card / surface colours (lightest to darkest) */
  --surface:  #faf8f4;
  --s2:       #f4f1eb;
  --s3:       #ece8e0;
  --s4:       #e5e0d6;
  --glass:    rgba(250,248,244,.68);
  --glass-border: rgba(255,255,255,0.55);

  /* Borders (lightest to darkest) */
  --border:   #ddd7ce;
  --border2:  #c9c1b5;
  --border3:  #b5ab9d;

  /* Text colours (darkest to lightest) */
  --ink:      #1a1714;   /* primary text */
  --ink2:     #3d3731;
  --ink3:     #6e6560;
  --ink4:     #9d9590;   /* secondary/muted text */
  --ink5:     #beb7b0;   /* very muted / placeholder */

  /* Accent — Amber/Gold (the yellow highlight colour) */
  --hl:          #fde047;
  --hl-dim:      rgba(253,224,71,.15);
  --hl-mid:      rgba(253,224,71,.28);
  --hl-glow:     rgba(253,224,71,.40);
  --hl-bright:   #facc15;
  --hl-deep:     #eab308;

  /* Semantic colours */
  --green:    #16a34a; --green-bg: #f0fdf4; --green-b: rgba(22,163,74,.18);
  --amber:    #d97706; --amber-bg: #fffbeb; --amber-b: rgba(217,119,6,.20);
  --red:      #dc2626; --red-bg:   #fef2f2; --red-b:   rgba(220,38,38,.14);
  --blue:     #2563eb; --blue-bg:  #eff6ff;
}


/* ──────────────────────────────────────────────────────────
   TYPOGRAPHY
   --font         → body / UI copy (Figtree — friendly, geometric sans)
   --font-display → headings / wordmark (PT Serif — classic, readable serif)
   Change font-size on body to scale everything up/down.
   ────────────────────────────────────────────────────────── */
:root {
  --font:         'Figtree', system-ui, sans-serif;
  --font-display: 'PT Serif', Georgia, serif;
}


/* ──────────────────────────────────────────────────────────
   GEOMETRY — border radius (roundness of corners)
   ────────────────────────────────────────────────────────── */
:root {
  --r:    14px;   /* large cards */
  --r-sm: 8px;    /* buttons, inputs */
  --r-xs: 5px;    /* small badges */
}


/* ──────────────────────────────────────────────────────────
   SHADOWS
   (These are fine to leave as-is)
   ────────────────────────────────────────────────────────── */
:root {
  --sh-xs:    0 1px 2px rgba(26,23,20,.05);
  --sh-sm:    0 2px 6px rgba(26,23,20,.07), 0 1px 2px rgba(26,23,20,.04);
  --sh:       0 6px 20px rgba(26,23,20,.09), 0 2px 6px rgba(26,23,20,.04);
  --sh-lg:    0 24px 56px rgba(26,23,20,.14), 0 8px 20px rgba(26,23,20,.06);
  --sh-hl:    0 4px 18px rgba(253,224,71,.30);
  --sh-hl-lg: 0 8px 32px rgba(253,224,71,.45);
}


/* ──────────────────────────────────────────────────────────
   EASING CURVES — controls animation feel
   ────────────────────────────────────────────────────────── */
:root {
  --spring: cubic-bezier(.34,1.56,.64,1);
  --out:    cubic-bezier(.22,1,.36,1);
  --in-out: cubic-bezier(.4,0,.2,1);
  --snap:   cubic-bezier(.2,0,0,1);
}


/* ──────────────────────────────────────────────────────────
   RESET & BASE
   ────────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-mesh);
  color: var(--ink);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}


/* ──────────────────────────────────────────────────────────
   TOPBAR — the sticky header bar at the top of every page
   ────────────────────────────────────────────────────────── */
.topbar {
  height: 56px;
  background: var(--glass);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: .75rem;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--sh-xs), inset 0 1px 0 rgba(255,255,255,0.6);
}

/* ReportFlow wordmark / logo in the topbar */
.logo {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  transition: opacity .2s var(--out);
  text-decoration: none;
}
.logo:hover { opacity: .72; }

/* The yellow RF square badge next to the wordmark */
.logo-mark {
  width: 30px;
  height: 30px;
  background: var(--hl);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: .62rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: .02em;
  box-shadow: var(--sh-hl), var(--sh-xs);
  flex-shrink: 0;
  transition: transform .35s var(--spring), box-shadow .25s;
}
.logo:hover .logo-mark {
  transform: rotate(-8deg) scale(1.1);
  box-shadow: var(--sh-hl-lg), var(--sh-sm);
}

/* Divider line between logo and breadcrumb */
.topbar-sep { width: 1px; height: 18px; background: var(--border); margin: 0 .1rem; }

/* Tool name that fades in when you open a tool */
.tool-crumb {
  font-size: .78rem;
  font-weight: 500;
  color: var(--ink3);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .3s var(--out), transform .3s var(--out);
}
.tool-crumb.on { opacity: 1; transform: none; }

/* Flexible space pusher */
.spacer { flex: 1; }

/* "All Tools" back button in the topbar */
.topbar-back {
  display: none;
  align-items: center;
  gap: .4rem;
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 500;
  color: var(--ink3);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: .38rem .875rem;
  cursor: pointer;
  transition: all .22s var(--out);
}
.topbar-back:hover {
  border-color: var(--border2);
  color: var(--ink);
  background: var(--s2);
  transform: translateX(-2px);
}
.topbar-back:active { transform: translateX(0) scale(.95); border-radius: calc(var(--r-sm) + 3px); transition-duration: .08s; }
.topbar-back.on { display: flex; }

/* "View Comments" button in the topbar (Report Comments only) */
.btn-view {
  display: none;
  align-items: center;
  gap: .45rem;
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--hl);
  border: none;
  border-radius: var(--r-sm);
  padding: .48rem 1.05rem;
  cursor: pointer;
  box-shadow: var(--sh-hl);
  transition: all .25s var(--spring);
}
.btn-view:hover {
  background: var(--hl-bright);
  transform: translateY(-2px);
  box-shadow: var(--sh-hl-lg);
}
.btn-view:active { transform: translateY(0) scale(.95); border-radius: calc(var(--r-sm) + 3px); transition-duration: .08s; }
.btn-view.on { display: flex; animation: popIn .4s var(--spring); }
@keyframes popIn {
  from { opacity: 0; transform: scale(.75) translateY(-4px); }
  to   { opacity: 1; transform: none; }
}


/* ──────────────────────────────────────────────────────────
   GENERAL BUTTONS (.btn)
   Used in modals and dialogs.
   .ghost = outlined style  |  .hl-btn = yellow filled style
   ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 600;
  border: 1.5px solid;
  border-radius: var(--r-sm);
  padding: .5rem .9rem;
  cursor: pointer;
  transition: all .2s var(--out);
  will-change: transform;
}
.btn:hover { transform: translateY(-1px); }
/* Squish on click: compress slightly and round more, feels like liquid */
.btn:active { transform: scale(.95); border-radius: calc(var(--r-sm) + 3px); transition-duration: .08s; }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.btn.ghost { color: var(--ink2); background: var(--surface); border-color: var(--border); }
.btn.ghost:hover { background: var(--s2); border-color: var(--border2); }
.btn.hl-btn { color: var(--ink); background: var(--hl); border-color: transparent; box-shadow: var(--sh-hl); }
.btn.hl-btn:hover { background: var(--hl-bright); box-shadow: var(--sh-hl-lg); }


/* ──────────────────────────────────────────────────────────
   GRADE PILLS — coloured inline badges for grades
   .pg = green (good)  .pa = amber (ok)  .pr = red (concern)  .pp = grey (neutral)
   ────────────────────────────────────────────────────────── */
.pill { display: inline-block; padding: .15rem .5rem; font-size: .65rem; font-weight: 600; border-radius: 4px; }
.pg { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-b); }
.pa { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-b); }
.pr { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-b); }
.pp { background: var(--s3); color: var(--ink3); border: 1px solid var(--border); }


/* ──────────────────────────────────────────────────────────
   STATUS DOTS — small coloured circles used in the review dialog
   .di = grey (idle)  .ds = amber pulsing (streaming)
   .dd = green (done)  .de = red (error)
   ────────────────────────────────────────────────────────── */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.di { background: var(--border2); }
.ds { background: var(--amber); animation: pdot 1.4s ease-in-out infinite; }
.dd { background: var(--green); }
.de { background: var(--red); }
@keyframes pdot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .3; transform: scale(.55); }
}


/* ──────────────────────────────────────────────────────────
   MODAL — the overlay dialog box
   ────────────────────────────────────────────────────────── */
.mback {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(26,23,20,.38);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s;
}
.mback.on { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  width: min(640px, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  transform: translateY(22px) scale(.95);
  transition: transform .38s var(--spring);
  box-shadow: var(--sh-lg), inset 0 1px 0 rgba(255,255,255,0.7);
  will-change: transform;
}
.mback.on .modal { transform: none; }

.mhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.125rem 1.375rem;
  border-bottom: 1px solid var(--border);
}
.mhead-title { font-family: var(--font); font-size: .96rem; font-weight: 600; letter-spacing: -.02em; }

/* X close button in modals */
.mclose {
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--ink3);
  cursor: pointer;
  transition: all .25s var(--spring);
}
.mclose:hover {
  color: var(--red);
  background: var(--red-bg);
  border-color: var(--red-b);
  transform: rotate(90deg) scale(1.1);
}

.mbody { padding: 1.25rem; overflow-y: auto; flex: 1; }
.mdesc { font-size: .76rem; color: var(--ink3); line-height: 1.75; margin-bottom: .875rem; }

/* Textarea inside modals */
textarea {
  font-family: var(--font);
  font-size: .82rem;
  color: var(--ink);
  background: var(--s2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: .8rem .9rem;
  outline: none;
  width: 100%;
  resize: vertical;
  line-height: 1.78;
  transition: border-color .18s, box-shadow .18s;
}
textarea:focus {
  border-color: var(--hl-deep);
  box-shadow: 0 0 0 3px var(--hl-mid);
  background: var(--surface);
}

.mfoot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  padding: .875rem 1.375rem;
  border-top: 1px solid var(--border);
  background: var(--s2);
  border-radius: 0 0 var(--r) var(--r);
}


/* ──────────────────────────────────────────────────────────
   TOAST — the small notification that pops up at the bottom
   ────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--ink);
  color: #fff;
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 500;
  padding: .6rem 1.25rem;
  border-radius: 100px;
  box-shadow: var(--sh-lg);
  opacity: 0;
  pointer-events: none;
  transition: all .3s var(--spring);
  white-space: nowrap;
  z-index: 9999;
}
.toast.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ──────────────────────────────────────────────────────────
   PAGE TRANSITION ANIMATION
   ────────────────────────────────────────────────────────── */
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ──────────────────────────────────────────────────────────
   SPOTLIGHT GLOW PULSE — used on Needs Attention / Most Improved cards
   ────────────────────────────────────────────────────────── */
@keyframes glowBreathRed {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.10); border-top-color: var(--red); }
  50%      { box-shadow: 0 0 12px 2px rgba(220,38,38,.18); border-top-color: rgba(220,38,38,.65); }
}
@keyframes glowBreathGreen {
  0%,100% { box-shadow: 0 0 0 0 rgba(22,163,74,.10); border-top-color: var(--green); }
  50%      { box-shadow: 0 0 12px 2px rgba(22,163,74,.18); border-top-color: rgba(22,163,74,.65); }
}

/* ──────────────────────────────────────────────────────────
   PERFORMANCE — respect user preference for reduced motion.
   School laptops are often underpowered; this kills all
   transitions and animations for users who opt out, or
   on devices that signal they prefer reduced motion.
   ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* Keep backdrop-filter but skip animation entirely */
  .topbar, .modal, .sidebar, .rdialog {
    transition: none !important;
  }
}

/* GPU layer hints — only on elements that actually animate.
   Avoid blanket will-change: transform which wastes VRAM. */
.logo-mark,
.topbar-back,
.btn-view,
.btn,
.btn-gen { will-change: transform; }

/* Contain paint for large panels — limits repaint area on scroll */
.si-panel,
.sidebar,
.main,
.tool-card { contain: paint; }
