/* ==========================================================================
   css/admin.css — the Admin page (js/ui/admin.js, DECISIONS 220-222).
   A work screen, not a showcase: dense tables with a sticky head, numbers right-aligned in
   tabular figures, a tab row and a period switch. Tokens from css/base.css.
   ========================================================================== */

/* The toolbar card (DECISIONS 507, after MASTER LY-07): the tabs, and on a trainer page the back row and
   Lock / Unlock, all on ONE dark .panel-like card. Before, only the tab row had the panel colour and the
   two rows under it sat white-on-pale-green on the wallpaper. Like .panel but without its blur and shadow:
   this is a tool strip, not a card that floats. */
.admin-toolbar { display: grid; gap: 8px; margin: 0 0 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--panel); border: var(--panel-border); }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
/* "Schema behind: run db/install.php" (MASTER SV-01): red, above the tabs, only when it is true. */
.admin-schema-warn { margin: 0 0 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(229, 72, 77, 0.18); border: 1px solid rgba(229, 72, 77, 0.6); color: #ff9a9d; font-weight: 700; }
.admin-tab {
  padding: 5px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--panel-2); color: var(--text); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer;
}
.admin-tab:hover { background: var(--panel-3); }
.admin-tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-light); }
.admin-periods { display: flex; gap: 4px; }
.admin-body { display: grid; gap: 10px; }
.admin-back { display: flex; gap: 6px; flex-wrap: wrap; }
/* Lock / Unlock on the trainer page (docs/BOTS.md, DECISIONS 413): the reason field grows, the buttons stay small. */
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.admin-actions input[type="text"] {
  flex: 1; min-width: 220px; padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid rgba(255, 255, 255, 0.14);
  background: var(--panel-2); color: var(--text); font: inherit; font-size: 0.85rem;
}
/* Firefox dims placeholders by default; muted at full opacity reads on the dark field (DECISIONS 507). */
.admin-actions input[type="text"]::placeholder { color: var(--muted); opacity: 1; }
/* "Battle hours (max/day)" in Trainers: 18+ hours with battles on one day is worth a look, 21+ is round the clock. */
.admin-table td.hours-warn, .admin-facts dd.hours-warn { color: #f0b429; font-weight: 600; }
.admin-table td.hours-alert, .admin-facts dd.hours-alert { color: #ff7b7b; font-weight: 700; }

/* One-row reports (the trainer's summary and bot check) as a label/value grid instead of an eleven-column
   table (DECISIONS 507): every value right under its own label, the long ones (lock reason, agent) wrap. */
.admin-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; margin: 0; }
.admin-fact { min-width: 0; padding: 6px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.03); }
.admin-fact dt { font-size: 0.72rem; font-weight: 650; color: var(--muted); }
.admin-fact dd { margin: 2px 0 0; font-size: 0.92rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.admin-fact dd .dot { vertical-align: 1px; }

/* Sessions strip (DECISIONS 507): a 24-hour track per UTC day, a red bar per play session, the hour scale once
   on top. The rhythm of a trainer in one glance; the table under it keeps the exact minutes. */
.admin-days { display: grid; gap: 3px; font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.admin-day-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; align-items: center; }
.admin-day-label { color: var(--muted); white-space: nowrap; }
.admin-day-track {
  position: relative; height: 14px; border-radius: 4px; background: var(--panel-2);
  /* faint lines every 6 hours so a bar can be read against the scale */
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.10) 1px, transparent 1px); background-size: 25% 100%;
}
.admin-day-bar { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }
.admin-day-scale { color: var(--muted); font-size: 0.68rem; }
.admin-day-scale > div { position: relative; height: 1em; }
.admin-day-scale > div > span { position: absolute; transform: translateX(-50%); }
.admin-day-scale > div > span:first-child { transform: none; }
.admin-day-scale > div > span:last-child { transform: translateX(-100%); }

.admin-block { display: grid; gap: 8px; min-width: 0; }
.admin-block-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.admin-block-head h3 { margin: 0; font-size: 1.08rem; }
.admin-block-head .btn { margin-left: auto; }
.admin-block-head .btn ~ .btn { margin-left: 0; }   /* two buttons (Clear list + Refresh on Errors): only the first takes the free space */
/* The Errors tab (DECISIONS 494): one card per distinct error. */
.admin-errors { display: grid; gap: 8px; margin-top: 10px; }
.admin-error { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid rgba(255, 255, 255, 0.08); border-left: 3px solid #f0b429; min-width: 0; }
.admin-error.kind-server { border-left-color: #ff7b7b; }
.admin-error-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.admin-error-kind.js { background: rgba(240, 180, 41, 0.18); color: #f0b429; }
.admin-error-kind.server { background: rgba(255, 123, 123, 0.18); color: #ff7b7b; }
.admin-error-count { font-variant-numeric: tabular-nums; }
.admin-error-msg { margin: 4px 0 2px; font-weight: 700; word-break: break-word; }
.admin-error-where, .admin-error-who { word-break: break-all; }
.admin-error-stack { margin: 6px 0 0; padding: 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.3); font-size: 0.72rem; white-space: pre-wrap; word-break: break-all; }

.admin-scroll { overflow: auto; max-height: 70vh; border-radius: var(--radius-sm); border: var(--panel-border); }
/* A notch bigger and airier, the head in text colour, a firmer zebra (owner, 29 September: "hard to read", DECISIONS 507). */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.admin-table th, .admin-table td { padding: 6px 9px; text-align: left; white-space: nowrap; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.admin-table thead th {
  position: sticky; top: 0; z-index: 1; background: #1a2338; color: var(--text);
  font-weight: 650; font-size: 0.76rem; cursor: pointer; user-select: none;
}
.admin-table thead th:hover { color: var(--accent-light); }
.admin-table thead th.sorted { color: var(--accent-light); }
.admin-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.035); }
.admin-table tbody tr:hover { background: rgba(255, 255, 255, 0.06); }
.admin-table td.num { text-align: right; }
/* "What happened" can be long: that column may wrap. */
.admin-table td:last-child { white-space: normal; min-width: 200px; }
.admin-link {
  padding: 0; border: 0; background: none; color: var(--accent-light); font: inherit; font-weight: 650;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}

@media (max-width: 600px) {
  .admin-periods { width: 100%; }
  .admin-scroll { max-height: none; }
  /* Phone (DECISIONS 507): the toolbar rows wrap by themselves; two facts per row; a shorter day label. */
  .admin-toolbar { padding: 8px; }
  .admin-facts { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .admin-day-row { grid-template-columns: 74px minmax(0, 1fr); }
}

/* --------------------------------------------------------------------------
   Give Eggs (DECISIONS 300): the form on the left, a sticky preview with the Send button on the
   right. On a phone the preview comes first, so the button is at the top.
   -------------------------------------------------------------------------- */
.admin-eggs { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 10px; align-items: start; }
.admin-egg-side { position: sticky; top: 8px; justify-items: center; text-align: center; }
.admin-field { margin-bottom: 4px; }
.admin-egg-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.admin-egg-row input[type="text"] { flex: 1; min-width: 160px; }
.admin-egg-row .admin-look-select { flex: 1; min-width: 200px; }   /* a Trainer Shop look to give (DECISIONS 489) */
.admin-egg-who { padding: 6px 8px; border-radius: var(--radius-sm); background: var(--panel-2); line-height: 1.6; }
.admin-egg-who .btn { margin-left: 6px; }
.admin-egg-missed { color: #ffd166; font-weight: 700; }
.admin-egg-pools { display: grid; gap: 4px; font-size: 0.85rem; }
.admin-egg-radio { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.admin-egg-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.admin-egg-grid input, .admin-egg-grid select { width: 100%; }
.admin-egg-looks { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-egg-look {
  display: grid; place-items: center; width: 44px; height: 52px; padding: 0; cursor: pointer;
  border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.14); background: var(--panel-2);
}
.admin-egg-look:hover { background: var(--panel-3); }
.admin-egg-look.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); background: var(--accent-soft); }
.admin-egg-mini { width: 30px; height: 36px; image-rendering: pixelated; }
.admin-egg-q { font-size: 1.3rem; font-weight: 800; color: var(--muted); }
.admin-egg-own { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.admin-egg-own input[type="color"] { width: 100%; height: 36px; padding: 2px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid rgba(255, 255, 255, 0.14); cursor: pointer; }
.admin-egg-stage {
  display: grid; place-items: center; width: 100%; padding: 14px 0;
  border-radius: var(--radius-sm); background: radial-gradient(circle at 50% 60%, rgba(255, 255, 255, 0.12), transparent 70%);
}
.admin-egg-preview { width: 160px; height: 192px; image-rendering: pixelated; }
.admin-egg-preview.is-random { opacity: 0.55; filter: grayscale(0.6); }
.admin-egg-summary { display: grid; gap: 3px; font-size: 0.85rem; }
.admin-egg-notep { font-style: italic; color: #d8dce8; }
.admin-egg-side .btn-lg { width: 100%; }
.admin-egg-result { word-break: break-word; }
@media (max-width: 900px) {
  .admin-eggs { grid-template-columns: 1fr; }
  .admin-egg-side { position: static; order: -1; }
  .admin-egg-grid, .admin-egg-own { grid-template-columns: 1fr 1fr; }
}

/* ---- Give Money (DECISIONS 331): the admin tab and the pop-up the trainer gets ---- */
.admin-money { max-width: 640px; display: flex; flex-direction: column; gap: 10px; }
.admin-money textarea { width: 100%; resize: vertical; }
.admin-money-amount { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.admin-money-amount input[type="number"] { width: 150px; font-variant-numeric: tabular-nums; }
.admin-money-quick { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-money-history .label { font-size: 0.78rem; color: var(--muted); margin-bottom: 2px; }
.admin-money-list { margin: 0; padding-left: 18px; font-size: 0.85rem; display: grid; gap: 3px; }
.admin-money-send { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
/* The pop-up: a gold coin that drops in, the amount big, the admin's message like the gift Eggs'. */
.money-gift { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.money-gift-coin {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  color: #7a4e00; background: radial-gradient(circle at 35% 30%, #fff4c2, #ffd24a 55%, #d89b10);
  box-shadow: 0 0 0 3px rgba(255, 210, 74, 0.35), 0 6px 18px rgba(0, 0, 0, 0.35);
  animation: money-gift-drop 700ms cubic-bezier(.3, 1.4, .5, 1) both;
}
.money-gift-amount { margin: 0; font-size: 1.9rem; font-weight: 800; color: #ffd24a; font-variant-numeric: tabular-nums; }
.money-gift-lead { margin: 0; font-weight: 700; }
.money-gift-note { margin: 0 auto; max-width: 34em; padding: 6px 10px; border-left: 3px solid #ffe28a; border-radius: 4px; background: rgba(255, 226, 138, 0.1); font-style: italic; color: #ffe9a8; text-align: left; }
@keyframes money-gift-drop { from { transform: translateY(-24px) scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .money-gift-coin { animation: none; } }

/* Give Pokémon (DECISIONS 348): six places - a sprite in its form, the name (with the species list),
   the 🎲, the form and "empty"; the quick buttons above, level / IVs below. */
.admin-poke-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.admin-poke-slots { display: flex; flex-direction: column; gap: 6px; }
.admin-poke-slot { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto auto; gap: 6px; align-items: center; }
.admin-poke-pic { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 8px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.admin-poke-pic img { max-width: 52px; max-height: 52px; image-rendering: pixelated; }
.admin-poke-slot input.invalid { border-color: #d64545; box-shadow: 0 0 0 1px #d64545 inset; }
.admin-poke-foot { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 16px; margin: 10px 0; }
.admin-poke-foot .admin-field { max-width: 120px; }
.admin-poke-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.admin-warn { color: #ffb347; }
@media (max-width: 480px) {
  /* Phones: the sprite and the name on the first line, the buttons under them. */
  .admin-poke-slot { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .admin-poke-pic { width: 44px; height: 44px; grid-row: span 2; }
  .admin-poke-slot select { grid-column: 2; }
}

/* The player's pop-up (js/ui/pokemongift.js): the given Pokémon in a row, each dropping in. */
.poke-gift { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.poke-gift-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.poke-gift-mon { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 92px; animation: money-gift-drop 600ms cubic-bezier(.3, 1.4, .5, 1) both; }
.poke-gift-sprite { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; }
.poke-gift-name { font-weight: 700; font-size: 0.9rem; overflow-wrap: anywhere; }
.poke-gift-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--muted, #b8c0d4); }
.poke-gift-lead { margin: 0; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .poke-gift-mon { animation: none; } }
.poke-gift-form { padding: 0 6px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: rgba(255, 255, 255, 0.1); color: var(--text, #eef2fb); }
.poke-gift-form.v-golden { background: rgba(247, 209, 84, 0.2); color: #f7d154; }
.poke-gift-form.v-dark { background: rgba(120, 90, 200, 0.25); color: #c9b6ff; }
.poke-gift-form.v-shiny { background: rgba(120, 200, 255, 0.2); color: #9fd8ff; }

/* Give Items (DECISIONS 387): the item cards to pick from, and the art tile of the gift pop-up
   (the pop-up itself reuses the money-gift layout above). */
.admin-item-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.admin-item-pick { display: flex; gap: 10px; align-items: center; text-align: left; padding: 10px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 10px; background: rgba(255, 255, 255, 0.05); color: inherit; cursor: pointer; }
.admin-item-pick:hover { background: rgba(255, 255, 255, 0.09); }
.admin-item-pick.active { border-color: #ffd24a; box-shadow: 0 0 0 1px rgba(255, 210, 74, 0.5); background: rgba(255, 210, 74, 0.10); }
.admin-item-pick-art { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, 0.08); }
.admin-item-pick-art .item-icon img, .admin-item-pick-art .item-icon svg { width: 34px; height: 34px; }
.admin-item-pick-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.admin-items input[type="number"] { width: 90px; }
.item-gift-art { width: 76px; height: 76px; border-radius: 18px; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #fff4c2, #ffd24a 55%, #d89b10); box-shadow: 0 0 0 3px rgba(255, 210, 74, 0.35), 0 6px 18px rgba(0, 0, 0, 0.35); animation: money-gift-drop 700ms cubic-bezier(.3, 1.4, .5, 1) both; }
.item-gift-art .item-icon img, .item-gift-art .item-icon svg { width: 48px; height: 48px; }
.item-gift-lines { margin: 0; font-size: 1.25rem; font-weight: 800; color: #ffd24a; display: flex; flex-direction: column; gap: 2px; }
@media (prefers-reduced-motion: reduce) { .item-gift-art { animation: none; } }
.admin-item-matches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }   /* the names that contain the typed text (DECISIONS 387) */

/* The Performance tab (DECISIONS 540): the reading guide as a plain list, and the slowest statement on one line
   (its full text is the tooltip) so the table stays readable. */
.admin-guide { margin: 0; padding-left: 18px; display: grid; gap: 6px; line-height: 1.45; }
.admin-table td.admin-sql { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Consolas, monospace; font-size: 0.82rem; }

/* ---- Mods tab + trainer ids behind names (DECISIONS 594). ---- */
.admin-id { opacity: .55; font-weight: 400; font-size: .85em; }
.admin-mod-card h3 { margin-bottom: 8px; }
.admin-mod-row { padding: 5px 0; border-top: 1px solid rgba(127, 127, 127, .25); }
.admin-mod-tab { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.admin-mod-sections { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 2px 24px; }
.admin-mod-sec { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-size: .92em; opacity: .9; }
.admin-mod-save { margin-top: 10px; }

/* ---- Popup maker (DECISIONS 595). ---- */
.admin-popup-body { max-width: 560px; width: 100%; }
.admin-popup-opts { flex-wrap: wrap; gap: 8px 16px; }
.admin-popup-opts .admin-popup-repeat { width: 70px; }
.admin-popup-opts .admin-popup-until { width: 150px; }
.admin-popup-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid rgba(127, 127, 127, .25); }

/* ---- Kick length + walk-bot columns (DECISIONS 597). ---- */
.admin-kick-hours { width: 64px; }
/* The ban list (banronde 16-10): the paste box above the Trainers report. */
.admin-banlist-names { width: 100%; min-height: 120px; resize: vertical; }
.admin-kick-for { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

/* ---- God view (DECISIONS 597): the live walking box. ---- */
.admin-watch-head { margin: 4px 0 8px; }
.admin-watch-box { position: relative; width: 100%; aspect-ratio: 1000 / 600; background: #1d2b23; border: 1px solid rgba(127, 127, 127, .35); border-radius: 8px; overflow: hidden; background-image: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px); background-size: 10% 16.6667%; }
.admin-watch-geo, .admin-watch-trail, .admin-watch-dots { position: absolute; inset: 0; }
.admin-watch-blocked { position: absolute; background: rgba(0, 0, 0, .35); border: 1px solid rgba(0, 0, 0, .4); border-radius: 2px; }
.admin-watch-exit { position: absolute; transform: translate(-50%, -50%); color: #9ec7ff; font-size: 11px; opacity: .8; }
.admin-watch-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #c7c7c7; box-shadow: 0 0 3px rgba(0, 0, 0, .6); }
.admin-watch-dot.is-target { width: 12px; height: 12px; margin: -6px 0 0 -6px; background: #e05555; z-index: 3; }
.admin-watch-dot.is-trail { width: 4px; height: 4px; margin: -2px 0 0 -2px; background: #e0a055; box-shadow: none; }
.admin-watch-name { position: absolute; left: 12px; top: -4px; color: #ffd9d9; font-size: 11px; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
