/*##############################################################################
# Script:        admin.css           (stylesheet, loaded by frontend/pages/login.html, password.html, system.html, forge.html, notes.html, about.html)
# Created by:    Matthew Boucher
# Start date:    2026-09-10
# Location:      <project root>/frontend/css/admin.css   (main script: <project root>/aiacolyte.py; subscripts: <project root>/subscripts/aiacolyte/)
# Description:   The look of the login, password, System, Forge and Notes pages, in the site's palette on top of
#                styles.css (its colour tokens, fonts and buttons): the admin bar with the brand and
#                the logged-in links, cards and forms, the System page tabs, the log and user tables,
#                the Server stats cards with meters, the web stats frame, and the Forge's spell cards and
#                answer panel, and the archmage's note cards. Works with the main
#                script, which serves it as /static/css/admin.css; aiacolyte.py --checkup confirms it is in place.
# Reads:         the tokens and classes of styles.css and fonts.css
# Writes:        nothing
# Sensitive:     none needed
# Arguments:     none (a stylesheet cannot take flags)
##############################################################################*/

[hidden] { display: none !important; }

.admin-body {
  min-height: 100vh;
  background: radial-gradient(60% 40% at 50% 0%, rgba(43, 39, 102, 0.3), transparent 70%), var(--ink-1);
}

/* ---------- Admin bar ---------- */

.admin-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 16px var(--gutter);
  background: rgba(12, 10, 8, 0.9);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.admin-bar__links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* two rows: the ordinary links, and under them the admin and archmage links (System, Notes, Password) on a line of their own */
.admin-bar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 22px;
}

.admin-bar__row--staff {
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.admin-bar__label {
  font-size: 0.6rem;
  letter-spacing: 0.24em;
  color: var(--gold);
}

.server-rows .mono {
  white-space: normal;   /* a long folder path wraps inside its card */
}

.admin-chip.is-warn {
  color: #f0a08a;
  border-color: rgba(240, 160, 138, 0.45);
}

.admin-bar__links a:not(.btn) {
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-decoration: none;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.3s;
}

.admin-bar__links a:not(.btn):hover,
.admin-bar__links a:not(.btn)[aria-current="page"] {
  color: var(--gold-bright);
}

/* the Log out button is a form posting to /logout (in the bar and on error pages) */
.admin-bar__form,
.admin-inline {
  display: inline-flex;
  margin: 0;
}

.admin-bar__who {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5em;
  min-width: 0;
  max-width: 100%;
  color: var(--text-faint);
}

.admin-bar__who b,
.admin-who b {
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--gold-bright);
}

.admin-bar__who b {
  max-width: 28ch;
}

/* ---------- Page body, cards, forms ---------- */

.admin-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) var(--gutter) 72px;
}

.admin-narrow {
  max-width: 600px;
}

.admin-head {
  margin-bottom: 24px;
}

.admin-head h1,
.admin-card h1 {
  margin-top: 12px;
  font-size: clamp(2rem, 4vw, 2.8rem);
  color: var(--parchment);
}

.admin-head p:not(.eyebrow),
.admin-card > p {
  margin-top: 10px;
  color: var(--text-dim);
}

.admin-card {
  padding: clamp(24px, 4vw, 40px);
  background: linear-gradient(180deg, rgba(43, 39, 102, 0.22), transparent 55%), linear-gradient(180deg, #1b1612, #120f0c);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.admin-card + .admin-card,
.admin-section + .admin-section {
  margin-top: 22px;
}

.admin-section h2 {
  font-size: 1.3rem;
  color: var(--parchment);
}

.admin-form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.admin-field label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.admin-field input,
.admin-field select,
.admin-field textarea {
  display: block;
  width: 100%;
  padding: 0.55em 0.8em;
  font: inherit;
  font-size: 1.1rem;
  color: var(--text);
  background: rgba(22, 20, 58, 0.35);
  border: 1px solid rgba(140, 200, 255, 0.25);
  border-radius: 6px;
}

.admin-field select option {
  background: #16143a;
}

.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus {
  outline: none;
  border-color: var(--arcane);
  box-shadow: 0 0 0 3px rgba(140, 200, 255, 0.18);
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.admin-row .grow {
  flex: 1 1 260px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.opt {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-faint);
}

.admin-error {
  font-style: italic;
  color: #f0a08a;
}

.admin-note {
  font-style: italic;
  color: var(--text-dim);
}

.empty {
  padding: 18px 4px;
  font-style: italic;
  color: var(--text-dim);
}

.btn-small {
  padding: 0.55em 1em;
  font-size: 0.66rem;
}

/* ---------- Tabs and chips ---------- */

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.admin-tab {
  padding: 0.75em 1.15em;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: none;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
}

.admin-tab:hover,
.admin-tab.is-active {
  color: var(--gold-bright);
}

.admin-tab.is-active {
  background: rgba(227, 176, 75, 0.07);
  border-color: var(--line);
}

.admin-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.35em 0.85em;
  font: italic 500 1rem/1.2 var(--font-body);
  color: var(--text-dim);
  text-decoration: none;
  background: rgba(227, 176, 75, 0.06);
  border: 1px solid rgba(227, 176, 75, 0.22);
  border-radius: 999px;
}

button.admin-chip {
  cursor: pointer;
}

.admin-chip:hover,
.admin-chip.is-active {
  color: var(--gold-bright);
  border-color: rgba(246, 216, 139, 0.6);
}

.admin-chip .count {
  font-style: normal;
  color: var(--text-faint);
}

.admin-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-search input[type="search"] {
  min-width: 200px;
  padding: 0.45em 0.8em;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: rgba(22, 20, 58, 0.35);
  border: 1px solid rgba(140, 200, 255, 0.25);
  border-radius: 6px;
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.02rem;
}

.admin-table th {
  padding: 0.7em 0.8em;
  font-family: var(--font-display);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--gold);
  background: #15110d;
  border-bottom: 1px solid var(--line);
}

.admin-table td {
  padding: 0.6em 0.8em;
  vertical-align: top;
  border-bottom: 1px solid rgba(227, 176, 75, 0.08);
}

.admin-table tr:hover td {
  background: rgba(227, 176, 75, 0.04);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: nowrap;
  color: var(--text-dim);
}

.kind {
  display: inline-block;
  padding: 0.12em 0.6em;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--gold-bright);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.kind-auth { color: var(--arcane); border-color: rgba(140, 200, 255, 0.35); }
.kind-system { color: #d6a8ff; border-color: rgba(214, 168, 255, 0.35); }
.kind-email { color: #9fe0a8; border-color: rgba(159, 224, 168, 0.35); }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- Server stats ---------- */

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 16px;
}

.server-card {
  padding: 18px 20px;
  background: linear-gradient(180deg, #1b1612, #120f0c);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.server-card h3 {
  margin-bottom: 12px;
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-bright);
}

.server-rows {
  display: grid;
  grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
  gap: 6px 12px;
  margin: 0;
  font-size: 1.02rem;
}

.server-rows dt {
  color: var(--text-faint);
}

.server-rows dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
}

.meter {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
}

.meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright));
}

.meter span.warm { background: linear-gradient(90deg, #b98433, #f0a060); }
.meter span.hot { background: linear-gradient(90deg, #9b2c1c, #e0604a); }

.ok { color: #9fe0a8 !important; }
.bad { color: #f0a08a !important; }

.stats-frame {
  width: 100%;
  min-height: 75vh;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

@media (max-width: 640px) {
  .admin-bar {
    position: static;
  }

  .admin-bar__links {
    align-items: flex-start;
  }

  .admin-bar__row {
    justify-content: flex-start;
  }

  .server-rows {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- The Arcane Forge ---------- */

.forge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.forge-card {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 18px 18px 16px;
  text-align: left;
  color: var(--text);
  background: linear-gradient(180deg, rgba(43, 39, 102, 0.22), transparent 60%), linear-gradient(180deg, #1b1612, #120f0c);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
}

.forge-card:hover,
.forge-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(246, 216, 139, 0.5);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.45), 0 0 24px rgba(227, 176, 75, 0.12);
  outline: none;
}

.forge-card__glyph {
  font-size: 1.4rem;
  color: var(--gold-bright);
  text-shadow: 0 0 14px rgba(227, 176, 75, 0.6);
}

.forge-card__name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--parchment);
}

.forge-card__blurb {
  font-size: 1rem;
  color: var(--text-dim);
}

.forge-card__price {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--arcane);
}

.forge-result-head {
  margin: 4px 0 10px;
  font-size: 1.1rem;
  color: var(--parchment);
}

.forge-answer {
  margin: 0;
  padding: 16px 18px;
  max-height: 420px;
  overflow: auto;
  font-family: var(--font-body);
  font-size: 1.12rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  background: rgba(22, 20, 58, 0.35);
  border: 1px solid rgba(140, 200, 255, 0.25);
  border-radius: 8px;
}

/* ---------- The archmage's notes ---------- */

.admin-field textarea {
  min-height: 120px;
  line-height: 1.5;
  resize: vertical;
}

.notes-list {
  display: grid;
  gap: 14px;
}

.note-card {
  padding: 18px 20px 16px;
  background: linear-gradient(180deg, rgba(43, 39, 102, 0.18), transparent 60%), linear-gradient(180deg, #1b1612, #120f0c);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.3s, opacity 0.3s;
}

.note-card:hover {
  border-color: rgba(246, 216, 139, 0.4);
}

.note-card.is-done {
  opacity: 0.6;
}

.note-card__head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.note-card__check {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 4px 0 0;
  accent-color: var(--gold);
  cursor: pointer;
}

.note-card__title {
  min-width: 0;
  font-size: 1.15rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  color: var(--parchment);
}

.note-card.is-done .note-card__title {
  text-decoration: line-through;
  text-decoration-color: rgba(227, 176, 75, 0.55);
}

.note-card__body {
  margin: 10px 0 0 34px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
}

.note-card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 14px 0 0 34px;
}

.note-edit {
  margin-top: 0;
}

@media (max-width: 640px) {
  .note-card__body,
  .note-card__foot {
    margin-left: 0;
  }
}

/* the Wallet page (wallet.js) */
.wallet-owed { font-size: 2rem; font-family: var(--font-display); color: var(--gold-bright); margin: 6px 0; }
.wallet-due { color: var(--gold-bright); font-weight: 600; }
.wallet-pay-line { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.wallet-pay { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wallet-pay input { width: 7.5em; }
.wallet-pay input[type="text"] { width: 11em; }

/*##############################################################################
# End of admin.css
##############################################################################*/
