/* Peakcord admin console.
 *
 * Deliberately written against Discord's own design tokens rather than a
 * palette of its own: `--background-base-*`, `--background-surface-*`,
 * `--text-normal`, `--brand-500` and friends. That means the page follows the
 * active Flashcord theme and the light/dark switch for free, and it looks like
 * a settings page in this app rather than like an admin tool bolted onto one.
 *
 * Everything is scoped under `.pka` and prefixed `pka-`, so this sheet and the
 * theme never reach into each other.
 */
.pka {
  padding: 40px 40px 80px;
  max-width: 860px;
  color: var(--text-default, var(--text-normal, #dbdee1));
  font-family: var(--font-primary, "gg sans", sans-serif);
}

.pka-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 24px;
  margin: 0 0 8px;
  color: var(--header-primary, #f2f3f5);
}

.pka-sub {
  margin: 0 0 24px;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-muted, var(--header-secondary, #b5bac1));
}

.pka-h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 32px 0 12px;
  color: var(--header-secondary, #b5bac1);
}

/* --- tabs ---------------------------------------------------------------- */
.pka-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle, var(--background-modifier-accent, #3f4147));
}

.pka-tab {
  appearance: none;
  border: 0;
  background: none;
  padding: 8px 4px 12px;
  margin-bottom: -1px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted, #b5bac1);
  border-bottom: 2px solid transparent;
}

.pka-tab:hover {
  color: var(--text-default, #dbdee1);
}

.pka-tab-on {
  color: var(--text-default, #f2f3f5);
  border-bottom-color: var(--brand-500, #5865f2);
}

/* --- cards --------------------------------------------------------------- */
.pka-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pka-card {
  background: var(--background-surface-higher, var(--background-secondary, #2b2d31));
  border: 1px solid var(--border-subtle, transparent);
  border-radius: var(--radius-md, 8px);
  padding: 16px;
}

.pka-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle, var(--background-modifier-accent, #3f4147));
}

.pka-avatar,
.pka-guild-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: 0 0 auto;
  object-fit: cover;
}

.pka-guild-icon {
  display: grid;
  place-items: center;
  background: var(--background-surface-high, #313338);
  border-radius: var(--radius-round, 50%);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
}

.pka-who {
  min-width: 0;
}

.pka-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--header-primary, #f2f3f5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pka-hint {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-muted, #949ba4);
}

.pka-error {
  padding: 12px 16px;
  border-radius: var(--radius-md, 8px);
  background: color-mix(in srgb, var(--status-danger, #da373c) 14%, transparent);
  color: var(--status-danger-text, #fbb);
  font-size: 14px;
}

/* --- fields -------------------------------------------------------------- */
/* Label left, control right, wrapping to stacked below 520px of *container*
 * width — the settings modal is narrower than the viewport, so a media query
 * would flip at the wrong moment. */
.pka-card {
  container-type: inline-size;
}

.pka-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.pka-field + .pka-field {
  border-top: 1px solid color-mix(in srgb, var(--border-subtle, #3f4147) 60%, transparent);
}

.pka-field-label {
  min-width: 0;
  flex: 1 1 auto;
}

.pka-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-default, #dbdee1);
  margin-bottom: 2px;
}

@container (max-width: 520px) {
  .pka-field {
    flex-direction: column;
    align-items: stretch;
  }
}

/* --- controls ------------------------------------------------------------ */
.pka-select,
.pka-text,
.pka-number,
.pka-search {
  appearance: none;
  font: inherit;
  font-size: 14px;
  color: var(--text-default, #dbdee1);
  background: var(--input-background, var(--background-base-lowest, #1e1f22));
  border: 1px solid var(--border-strong, transparent);
  border-radius: var(--radius-sm, 4px);
  padding: 8px 10px;
  min-width: 180px;
  flex: 0 0 auto;
}

.pka-select {
  /* Discord's own chevron, so the control does not read as a stock <select>. */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'><path fill='%23b5bac1' d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
  cursor: pointer;
}

.pka-number {
  min-width: 90px;
  text-align: right;
}

.pka-text {
  min-width: 120px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pka-search {
  width: 100%;
  min-width: 0;
  margin-bottom: 16px;
  text-transform: none;
}

.pka-select:focus,
.pka-text:focus,
.pka-number:focus,
.pka-search:focus {
  outline: none;
  border-color: var(--brand-500, #5865f2);
}

.pka-perks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 16px;
  flex: 1 1 260px;
}

.pka-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-default, #dbdee1);
  cursor: pointer;
}

.pka-check input {
  accent-color: var(--brand-500, #5865f2);
  cursor: pointer;
}

.pka-check input:disabled {
  cursor: default;
}

.pka-check input:disabled + span {
  color: var(--text-muted, #949ba4);
}

/* --- catalogue ----------------------------------------------------------- */
.pka-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 12px;
}

.pka-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  border-radius: var(--radius-md, 8px);
  background: var(--background-surface-higher, #2b2d31);
}

.pka-badge {
  width: 40px;
  height: 40px;
}

.pka-frame {
  width: 56px;
  height: 56px;
}

.pka-cell-label {
  font-size: 11px;
  line-height: 14px;
  text-align: center;
  color: var(--text-muted, #949ba4);
}

.pka-plates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.pka-plate {
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  background: var(--background-surface-higher, #2b2d31);
}

.pka-plate img {
  display: block;
  width: 100%;
  height: 44px;
  object-fit: cover;
}

.pka-plate .pka-cell-label {
  padding: 6px 8px 8px;
}
