/*
 * Admin Control Room.
 *
 * The room uses the Creator Studio shell (sidebar + main column), so this file only adds
 * the pieces that shell does not already have: a filter row, the app cards, the IGDB cover
 * grid and the reset panel. Colours come from the studio variables so the room matches the
 * rest of the platform.
 */
.admin-main { display: flex !important; flex-direction: column; gap: 18px; }
.admin-heading { margin-bottom: 4px !important; }
.admin-heading h1 { margin: 6px 0 8px; }

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.admin-gate-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

/* One row of fields, wrapping instead of overflowing. */
.admin-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; width: 100%; }
.admin-row-tight { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-row > label { display: flex; flex-direction: column; gap: 6px; min-width: 180px; font-size: 12px; font-weight: 650; }
.admin-row > label.admin-check { flex-direction: row; align-items: center; min-width: 0; }
.admin-row .admin-grow { flex: 1 1 240px; min-width: 200px; }
.admin-row label > input,
.admin-row label > select { min-height: 40px; }
.admin-check input { width: 16px; height: 16px; }
.admin-fieldset { border: 1px solid var(--studio-border, #3b3157); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.admin-fieldset legend { padding: 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--studio-muted, #a79bc7); }
.admin-fieldset label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; width: 110px; }
.admin-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.admin-split h3 { font-size: 13px; margin: 0 0 8px; }

.admin-search { min-width: 220px; max-width: 320px; min-height: 38px; padding: 8px 11px; }

/* A file picker that looks like the other buttons. */
.admin-file { position: relative; overflow: hidden; cursor: pointer; min-height: 38px; display: inline-flex; align-items: center; padding: 0 14px; }
.admin-file input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

/* Links to every page, so the room explains itself. */
.admin-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.admin-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--studio-border, #3b3157);
  border-radius: 12px;
  background: rgba(168, 85, 247, .05);
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}
.admin-tile:hover { border-color: #7a5cc4; background: rgba(168, 85, 247, .12); }
.admin-tile strong { color: #f4f1fb; font-size: 13.5px; }
.admin-tile span { color: var(--studio-muted, #a79bc7); font-size: 12px; line-height: 1.45; }

/* One app per card: name, owner, client id, scopes, and the switches. */
.admin-app {
  border: 1px solid var(--studio-border, #3b3157);
  border-radius: 12px;
  background: #120c1e;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-app-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-app-head strong { font-size: 14px; }
.admin-app .muted { font-size: 11.5px; }
.admin-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-chip { border: 1px solid #3b3157; border-radius: 999px; padding: 2px 9px; font-size: 11px; color: #cdbdf5; }

/* IGDB results: a cover grid, not a long line of names. */
.igdb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.igdb-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--studio-border, #3b3157);
  border-radius: 12px;
  background: #120c1e;
  min-width: 0;
}
.igdb-card strong { font-size: 12.5px; line-height: 1.3; overflow-wrap: anywhere; }
.igdb-card small { font-size: 11px; }
.igdb-cover { aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; background: #1a1229; display: grid; place-items: center; }
.igdb-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.igdb-card .button { width: 100%; justify-content: center; }
.igdb-more { margin-top: 12px; display: flex; justify-content: center; }

/* Staff & access: one card per holder, so the badge, name and role line up. */
.admin-staff-list { display: grid; gap: 8px; margin-top: 4px; }
.admin-staff-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--studio-border, #3b3157);
  border-radius: 10px;
  background: #120c1e;
  min-width: 0;
}
.admin-staff-who { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.admin-staff-who strong { font-size: 13px; color: #f4f1fb; overflow-wrap: anywhere; }
.admin-staff-who .muted { font-size: 11.5px; }
.admin-staff-row .button { flex: 0 0 auto; }

/* The room hides links and tiles with the `hidden` attribute, but the sidebar and tile
   layouts set display with !important, which beats the browser's own [hidden] rule. This
   makes hiding reliable, so a staff-only or owner-only item really is not on screen. */
.admin-shell [hidden] { display: none !important; }

/* Changelog & Discord: the webhook, the update form and what was posted. */
.changelog-form { display: flex; flex-direction: column; gap: 12px; }
.changelog-form > label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 650; }
.changelog-form input,
.changelog-form textarea { min-height: 40px; padding: 9px 11px; border-radius: 8px; border: 1px solid #3b3157; background: #0c0914; color: var(--text); font: inherit; font-size: 13px; }
.changelog-form textarea { resize: vertical; line-height: 1.55; }
#changelogEntries { display: grid; gap: 8px; }
#changelogEntries .admin-staff-row { align-items: flex-start; }
.admin-staff-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.admin-staff-copy strong { font-size: 13px; color: #f4f1fb; }
.admin-staff-copy .muted,
.admin-staff-copy .admin-fail { font-size: 11.5px; }
.admin-fail { color: #ff9aa6; }

/* Reset platform. */
.admin-danger-panel { border-color: #7d2233 !important; }
.admin-warning { border: 1px solid #7d2233; border-radius: 10px; background: rgba(255, 90, 110, .08); color: #ffd7dd; padding: 12px 14px; font-size: 12.5px; line-height: 1.6; }

@media (max-width: 640px) {
  .admin-row > label { min-width: 0; width: 100%; }
  .admin-search { max-width: none; width: 100%; }
  .igdb-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 9px; }
}
