/* ==========================================================================
   Federation University — Professional Experience Pay Claim Form
   Stylesheet aligned to FedUni Brand Identity Guidelines (August 2024)

   Key sources verified against the guidelines PDF:
     Colour palette  → p.9   (exact hex / RGB values)
     Accessibility   → p.10  (WCAG 2.0 tested pairings)
     Colour rules    → p.11, p.13
       • Blue MUST appear in all comms (in a supporting role)
       • Large areas of navy avoided
       • No gradients, no colour effects
     Typography      → p.14–15
       • h1 headlines  : Sora SemiBold, 1:1 leading, tracking 0
       • Section heads : Sora SemiBold, BLUE (p.11 + p.16 "do not use navy
                         for main headings")
       • Subhead L1    : Inter SemiBold, navy (p.15 rule 7)
       • Subhead L2    : Inter Medium, navy, sentence case (p.15 rule 8)
       • Body copy     : Inter Light, navy (p.15 rule 6)
       • Lead-in text  : Inter Regular, blue (p.15 rule 2)
     Typography DON'Ts → p.16: no uppercase; no navy for main headings;
                         no Sora for body; no blue for body; no Inter for h1
   ========================================================================== */

/* ---- Official FedUni Google Fonts ---------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Sora:wght@300;400;600;700&display=swap');

/* ---- Brand design tokens — exact values from guidelines p.9 --------------- */
:root {
  /* PRIMARY */
  --blue:        #0602FF;  /* R6 G2 B255   — primary; headings & interactive    */
  --navy:        #041243;  /* R4 G18 B67   — body copy & ceremonial ONLY        */
  --white:       #ffffff;
  --beige:       #F9E4D0;  /* R249 G228 B208 — page background (PDF p.5, p.9)  */

  /* LIGHTS tier (p.9) */
  --light-mint:  #B9EAD6;
  --light-green: #A7D7B0;
  --light-blue:  #9ECFFF;
  --light-grey:  #DBCCC8;
  --peach:       #FFCEAF;

  /* BRIGHTS tier (p.9) */
  --mint:        #14E399;
  --pink:        #F06BFF;
  --purple:      #7D127A;
  --red:         #FC4D1D;
  --mustard:     #F29912;
  --green:       #8F800D;
  --grey:        #4D4D4F;

  /* UI-only tokens (not brand colours) */
  --border:      #dce3ef;
  --input-bg:    #ffffff;
  --readonly-bg: #f4f5f8;
  --danger:      #c0392b;
  --success:     #1a6b3a;

  /* Focus ring — Blue on White = AAA (p.10) */
  --focus: 0 0 0 3px rgba(6, 2, 255, .22);

  /* TYPOGRAPHY (p.14) */
  --font-head: 'Sora', Arial, sans-serif;
  --font-body: 'Inter', Arial, sans-serif;

  /* GEOMETRY */
  --radius-sm: 4px;
  --radius:    6px;
  --radius-lg: 10px;

  /* ELEVATION */
  --shadow-sm: 0 2px 8px rgba(4, 18, 67, .10);
  --shadow-md: 0 5px 20px rgba(4, 18, 67, .14);

  /* MOTION */
  --transition: 160ms ease;
}

/* ---- Reset ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ---- Base ------------------------------------------------------------------ */
body {
  font-family: var(--font-body);
  font-weight: 300;          /* Inter Light — body copy (p.15 rule 6) */
  font-size: 15px;
  line-height: 1.6;          /* +3pt leading rule (p.14) ≈ 1.6 */
  color: var(--navy);        /* Body copy in navy (p.15 rule 6) */
  background: var(--light-mint);  /* Light Mint page bg — brand Lights (p.9); Navy on Light Mint = AAA (p.10) */
  min-height: 100vh;
}

/* ---- Typography hierarchy (p.14–15) --------------------------------------- */
/*
 * h1 — Sora SemiBold, white reversed out on blue header
 * h2 — Sora SemiBold, BLUE
 *      • p.11: "Blue should appear in all our communications … in typography,
 *        both in headlines and intro copy."
 *      • p.16 DON'T: "Do not use navy for main headings."
 *      • p.16 DON'T: "Do not use Inter for main headings."
 *      Conclusion: section headings (h2) must be Sora + blue.
 * h3 — Inter SemiBold, navy — Subheading Level 1 (p.15 rule 7)
 * h4 — Inter Medium, navy   — Subheading Level 2 (p.15 rule 8)
 *
 * ALL headings: sentence case, tracking 0 (p.14, p.16 DON'Ts)
 */
h1 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1;       /* 1:1 leading for headings (p.14) */
  color: var(--white);  /* Reversed out on blue header */
  letter-spacing: 0;
}

h2 {
  font-family: var(--font-head); /* Sora — mandatory for headlines (p.14, p.16) */
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--blue);            /* Blue — mandatory for main headings (p.11, p.16) */
  letter-spacing: 0;
}

/* Subheading Level 1 — Inter SemiBold, navy (p.15 rule 7) */
h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .88rem;
  line-height: 1.2;
  color: var(--navy);
  letter-spacing: 0;
}

/* Subheading Level 2 — Inter Medium, sentence case, navy (p.15 rule 8) */
h4 {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: .84rem;
  line-height: 1.25;
  color: var(--navy);
  letter-spacing: 0;
}

small, .help {
  font-size: .77rem;
  color: var(--grey);
  font-weight: 300;
  line-height: 1.4;
}

/* Links: blue (p.13 brand text colour rule) */
a { color: var(--blue); text-decoration: underline; }
a:hover { text-decoration: none; }

/* Focus ring — AAA (p.10) */
:where(button, input, select, textarea):focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

/* ---- Header --------------------------------------------------------------- */
/*
 * Blue bg — brand primary (p.6, p.40, p.43).
 * "Large areas of navy should be avoided" (p.13) → blue used here.
 * Sticky so the FedUni brandmark stays visible while scrolling the form.
 * NO gradient (p.13 DO NOT create a gradient).
 */
.main-header {
  background: var(--blue);
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 36px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo img {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.header-title h1 {
  color: var(--white); /* Reversed out on blue (p.15 rule 1) */
  font-size: 1.15rem;
}

/* ---- Main layout ---------------------------------------------------------- */
main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1.5rem 1.75rem 2rem;
}

/* ---- Footer --------------------------------------------------------------- */
/*
 * Navy — minimal height to honour "avoid large areas of navy" (p.13).
 * Light Grey on Navy = AAA (p.10 accessibility table).
 */
footer.page-footer {
  background: var(--navy);
  color: var(--light-grey);
  padding: 16px 28px;
  font-size: .74rem;
  line-height: 1.85;
  font-weight: 300;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 1.5rem;
}

.footer-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  white-space: nowrap;
  flex-shrink: 0;
}

.footer-center {
  flex: 1;
  text-align: center;
}

/* ---- Sections / cards ----------------------------------------------------- */
/*
 * White card on beige — consistent with brand applications (p.40 website,
 * p.48 LMS landing page, p.50 presentations).
 * h2 gets a solid blue bottom rule: controlled "blue in all comms" (p.11).
 */
.section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px 32px;
  margin: 1.1rem 0;
  box-shadow: var(--shadow-sm);
}

.section h2 {
  padding-bottom: 12px;
  margin-bottom: 22px;
  border-bottom: 2.5px solid var(--blue); /* Blue accent rule (p.11) */
}

.section h3 { margin: 20px 0 8px; }

/* ---- Form grid & labels --------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: .85rem;
}

.grid .full, label.full { grid-column: 1 / -1; }

label { display: flex; flex-direction: column; gap: .3rem; }

/*
 * Field labels: Inter SemiBold, navy, sentence case (NOT uppercase — p.16).
 * Maps to "Subheading Level 2" in the brand hierarchy (p.15 rule 8).
 */
label > span {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .75rem;
  color: var(--navy);
  letter-spacing: 0;
}

label.checkbox {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  grid-column: 1 / -1;
}

label.checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  flex-shrink: 0;
  margin-top: 3px;
  cursor: pointer;
}

label.checkbox span {
  font-size: .87rem;
  font-weight: 300;
  color: var(--navy);
  letter-spacing: 0;
}

/* ---- Inputs / selects / textareas ----------------------------------------- */
/*
 * White inputs, navy text (Inter Light), blue focus ring — AAA (p.10).
 * NO gradients (p.13 DO NOT apply effects to colours).
 */
input, select, textarea {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: .87rem;
  color: var(--navy);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input, select {
  height: 2.15rem;
  padding: 0 .65rem;
  min-width: 0;
  width: 100%;
  line-height: 2.15rem;
}

textarea {
  padding: .55rem .65rem;
  min-height: 4.2rem;
  line-height: 1.55;
  resize: vertical;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: var(--focus);
}

input[readonly] {
  background: var(--readonly-bg);
  color: var(--grey);
  cursor: default;
  border-color: #cdd6e8;
}

/*
 * Auto-calculated fields: Light Blue tint — brand "Lights" palette (p.9).
 * Navy text on Light Blue = AAA (p.10). Tabular nums for financial alignment.
 */
input[name="coordinator_days"][readonly],
input[name="coordinator_amount"][readonly],
input[name="coordinator_subtotal"][readonly],
input[name="coordinator_grand_total"][readonly],
input[name="coordinator_gst_component"][readonly],
input[name="amount"][readonly] {
  background: #eef4ff;
  color: var(--navy);
  border-color: var(--light-blue);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.help {
  font-size: .74rem;
  color: var(--grey);
  margin-top: 2px;
  font-weight: 300;
}

.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Validation states ---------------------------------------------------- */
input:user-invalid,
textarea:user-invalid { border-color: var(--danger); }

input:user-valid,
textarea:user-valid   { border-color: var(--success); }

@supports not selector(:user-invalid) {
  input:invalid:not(:placeholder-shown),
  textarea:invalid:not(:placeholder-shown) { border-color: var(--danger); }
  input:valid:not(:placeholder-shown)      { border-color: var(--success); }
}

/* ---- Buttons -------------------------------------------------------------- */
/*
 * Primary: Blue bg, white text — AAA (p.10).
 * Secondary: White bg, blue border/text.
 * NO navy buttons (navy = body copy only).
 * NO gradient (p.13). Sentence case (p.16).
 */
.actions {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.row-actions { margin-top: .6rem; }

button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .87rem;
  cursor: pointer;
  letter-spacing: 0;
  transition: filter var(--transition), transform var(--transition), box-shadow var(--transition);
}

button.primary {
  background: var(--blue);
  color: var(--white);
}
button.primary:hover {
  filter: brightness(.88);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
button.primary:active { transform: none; filter: brightness(.82); }

button.secondary {
  background: var(--white);
  color: var(--blue);
  border: 1.5px solid var(--blue);
}
button.secondary:hover {
  background: var(--light-blue);
  transform: translateY(-1px);
}
button.secondary:active { transform: none; }

button.danger {
  background: #fdecea;
  color: var(--danger);
  border: 1.5px solid #f5c6c2;
  padding: 5px 12px;
  font-size: .8rem;
}
button.danger:hover { background: #fad2ce; }

/* Icon-only remove-row button */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--navy);
  cursor: pointer;
  transition: background var(--transition);
}
.icon-btn:hover { background: var(--light-mint); }
.icon-btn img.remove-icon { width: 18px; height: 18px; object-fit: contain; display: block; }

/* ---- Payment schedule panel ----------------------------------------------- */
/*
 * Light Mint bg — brand "Lights" palette (p.9, p.12 pairing rules).
 * Navy on Peach = AAA (p.10). Warm contrast against the Light Mint page bg and blue
 */
.ps-panel {
  grid-column: 1 / -1;
  background: var(--light-grey);  /* Light Grey (#DBCCC8) — brand Lights (p.9); Navy on Light Grey = AAA (p.10) */
  border: 1px solid #bfaaa5;
  border-radius: var(--radius);
  padding: 16px 20px;
}

.ps-panel h3 { margin-top: 0; }

.schedule-table-host { margin: .6rem 0 .3rem; }

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  font-size: .87rem;
}

.schedule-table caption {
  caption-side: top;
  text-align: left;
  padding: 7px 10px;
  font-size: .76rem;
  color: var(--grey);
  font-weight: 300;
  border-bottom: 1px solid var(--border);
}

.schedule-table thead th {
  background: var(--blue);
  color: var(--white);
  font-weight: 600;
  font-family: var(--font-body);
  padding: 8px 10px;
  text-align: left;
  letter-spacing: 0;
}

.schedule-table th, .schedule-table td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
}

.schedule-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Note panel ----------------------------------------------------------- */
/*
 * Light Blue bg tint (brand palette p.9) + blue left-border accent (p.11).
 * Navy on Light Blue = AAA (p.10).
 */
.note-panel {
  grid-column: 1 / -1;
  background: #EBF4FF;
  border: 1px solid var(--light-blue);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}

.note-panel h3 { margin-top: 0; }

.note-panel ul { padding-left: 18px; margin-top: 6px; }

.note-panel ul li {
  font-size: .84rem;
  color: var(--navy);
  font-weight: 300;
  margin-bottom: 4px;
  line-height: 1.55;
}

/* ---- Tables --------------------------------------------------------------- */
/* Blue headers — White on Blue = AAA (p.10). No uppercase (p.16). */
.table-wrapper { overflow-x: auto; margin-top: 12px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  font-size: .87rem;
}

caption {
  caption-side: top;
  text-align: left;
  padding: .5rem .75rem;
  color: var(--grey);
  font-weight: 500;
  background: transparent;
  border-bottom: 1px solid var(--border);
}

thead tr { background: var(--blue); color: var(--white); }

thead th {
  padding: 10px 12px;
  text-align: left;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: 0;
  color: var(--white);
  white-space: nowrap;
}

th, td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

tbody tr:nth-child(even) { background: #f5fbf8; } /* Light Mint tint */
tbody tr:hover           { background: #dff5ec; }
tbody td                 { border-bottom: 1px solid var(--border); }

/* ---- Mentor table --------------------------------------------------------- */
#mentorTable { table-layout: fixed; }
#mentorTable .mt-col-name { width: 18%; }
#mentorTable .mt-col-pst  { width: 18%; }
#mentorTable .mt-col-from { width: 14%; }
#mentorTable .mt-col-to   { width: 14%; }
#mentorTable .mt-col-days { width:  9%; }
#mentorTable .mt-col-rate { width: 11%; }
#mentorTable .mt-col-amt  { width: 11%; }
#mentorTable .mt-col-act  { width:  5%; }

#mentorTable th, #mentorTable td { overflow: hidden; }
#mentorTable td > * { box-sizing: border-box; max-width: 100%; }

#mentorTable input, #mentorTable select,
#coordTable  input, #coordTable  select {
  width: 100%;
  min-width: 0;
  height: 2.1rem;
  line-height: 2.1rem;
  padding: 0 .5rem;
  font-size: .82rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

#mentorTable input[name="days_claiming"],
#mentorTable input[name="amount"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#mentorTable input[name="mentor_name"],
#mentorTable input[name="pst_name"],
#coordTable  input[name="coordinator_name"] {
  cursor: text;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Tooltip (injected by JS) --------------------------------------------- */
/* Navy bg, white text — reversed-out pattern (p.15 rule 1). */
.input-tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--navy);
  color: var(--white);
  font-family: var(--font-body);
  font-size: .79rem;
  font-weight: 300;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 120ms ease;
}
.input-tooltip.visible { opacity: 1; }

#mentorTable input[type="date"] { width: 100%; min-width: 0; }

#mentorTable th.mt-col-act,
#mentorTable td:last-child { padding: 6px 8px; text-align: center; }

/* ---- Coordinator table ---------------------------------------------------- */
#coordTable { table-layout: fixed; }
#coordTable .ct-col-name  { width: 20%; }
#coordTable .ct-col-days  { width: 10%; }
#coordTable .ct-col-rate  { width: 16%; }
#coordTable .ct-col-amt   { width: 13%; }
#coordTable .ct-col-sub   { width: 15%; }
#coordTable .ct-col-total { width: 14%; }
#coordTable .ct-col-gst   { width: 12%; }

#coordTable input[name="coordinator_amount"],
#coordTable input[name="coordinator_subtotal"],
#coordTable input[name="coordinator_grand_total"],
#coordTable input[name="coordinator_gst_component"],
#coordTable input[name="coordinator_days"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#mentorTable tbody tr.empty-state td {
  text-align: center;
  color: var(--grey);
  font-style: italic;
  padding: 20px;
}

/* ---- Agency Authorisation fieldset --------------------------------------- */
/*
 */
fieldset.auth {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-top: 26px;
}

fieldset.auth legend h3 { margin: 0; padding: 0 6px; }

/* ---- Submit section ------------------------------------------------------- */
section.submit {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 32px;
  margin: 1.1rem 0;
  box-shadow: var(--shadow-sm);
}

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  main  { padding: .75rem 1rem 1.5rem; }
}

@media (max-width: 760px) {
  #mentorTable { table-layout: auto; }
  .icon-btn    { width: 28px; height: 28px; }
}

@media (max-width: 700px) {
  .main-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 20px;
    position: static;
  }
  .header-title h1 { font-size: .95rem; }
  .section          { padding: 18px 16px; }
}
