/* Buttons, in one place (Nov 17, 2026). Every page loads this right after theme.css ({% theme_css %}),
   so a change here changes the buttons in the staff app, the student app and the rental website.
   Colors come from theme.css.

   The kinds (add a class next to "button"):
     .button              the main button (dark green, white text)
     .secondary           quieter: white with a thin line
     .soft                pale green, for a second choice next to a main button
     .highlight           gold, on dark backgrounds (the rental website's top)
     .ghost               see-through with a light outline, on dark backgrounds
     .link                looks like a link
     .danger              red text, for deleting or cancelling
     .small               a smaller size of any kind
     disabled / .disabled grey, can't be pressed

   Sizes: each part of the app sets these four in its own :root (the staff app uses the defaults
   below), so the student app's big phone buttons and the staff app's compact ones share everything
   else.

   Plain <button>s: on pages whose <body> has class "all-buttons" (the staff app and the rental
   website) every <button> is a main button unless it says otherwise. The student app styles only
   buttons that have a class.

   Weight: the shape and text color weigh the same as one tag or one class, and the background and
   border weigh nothing (:where). So a page's own button style always wins, on hover too. */

:root {
  --btn-pad: 8px 16px;
  --btn-radius: 999px;
  --btn-size: 14px;
  --btn-weight: 600;
}

/* The main button */
:where(.all-buttons) button, .button, button.primary {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: var(--btn-size); font-weight: var(--btn-weight);
  padding: var(--btn-pad);
  border-radius: var(--btn-radius);
  color: var(--on-button);
  cursor: pointer;
  text-decoration: none;
}
:where(.all-buttons button, .button, button.primary) { border: 1px solid var(--button); background: var(--button); }
:where(.all-buttons button, .button, button.primary):hover { background-color: var(--brand); border-color: var(--brand); }

/* Hover: one shade deeper of the button's own color, so its text stays readable. (Before Nov 17,
   2026 every button turned dark green on hover, and light buttons with dark text became unreadable.) */
:where(.all-buttons) button:hover, .button:hover, button.primary:hover {
  background-image: linear-gradient(color-mix(in srgb, var(--brand) 12%, transparent), color-mix(in srgb, var(--brand) 12%, transparent));
  text-decoration: none;
}

/* The other kinds */
button.secondary, .button.secondary { background: var(--card); color: var(--brand); border-color: var(--line); }
button.secondary:hover, .button.secondary:hover { border-color: var(--brand); background: var(--card); }
button.soft, .button.soft { background: var(--accent-soft); color: var(--brand); border-color: var(--accent-soft); }
button.highlight, .button.highlight { background: var(--highlight); color: var(--brand); border-color: var(--highlight); }
button.ghost, .button.ghost { background: transparent; color: var(--on-dark); border-color: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--on-dark) 60%, transparent); }
button.ghost:hover, .button.ghost:hover { background: color-mix(in srgb, var(--on-dark) 8%, transparent); }
button.link { background: none; border: none; padding: 0; color: var(--accent); font-weight: 500; border-radius: 0; }
button.link:hover { text-decoration: underline; background: none; }
button.danger { color: var(--expired-ink); }
.button.small, button.small { padding: 7px 14px; font-size: 13.5px; }

/* Can't be pressed */
:where(.all-buttons) button:disabled, button.primary:disabled, button.secondary:disabled, .button:disabled, .button.disabled, .button.off {
  background: var(--fill-4); color: var(--muted); border-color: var(--line-2); cursor: not-allowed; box-shadow: none;
}
:where(.all-buttons) button:disabled:hover, button.primary:disabled:hover, .button:disabled:hover { background: var(--fill-4); }
.button.disabled, .button.off { pointer-events: none; }

/* ✕: close a pop-up (.x), or remove one thing (.x.danger: red on hover). Grey, with a soft square
   behind it on hover. .x.small for one next to a line of text. (Nov 18, 2026: one look for the
   ✕ buttons, which had seven.) */
button.x, a.x {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 6px; margin: 0;
  border: 0; border-radius: 8px; background: none;
  color: var(--muted); font-size: 18px; font-weight: 400; line-height: 1; text-decoration: none; cursor: pointer;
}
button.x:hover, a.x:hover { background: var(--fill-3); color: var(--ink); text-decoration: none; }
button.x.danger:hover, a.x.danger:hover { background: var(--expired); color: var(--expired-ink); }
button.x.small, a.x.small { min-width: 22px; height: 22px; margin: -4px 0; padding: 0 4px; border-radius: 6px; font-size: 13px; vertical-align: middle; }   /* the minus margin: no taller than the text beside it */
.x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
