/*
 * The bots' pages (dashboard, and the Valheim pages): the look comes from
 * resorted-ui (shared/ui/ui.css, loaded first - colours, fonts, buttons, the top
 * bar and sidebar, toasts, dialogs ...). This file keeps only the bots' own parts,
 * and maps the names they use onto it. The same file is in all three bots.
 */
:root {
  --card-hover: var(--card2);
  --line-strong: var(--line3);
  --radius: 16px;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3 {
  line-height: 1.2;
}
h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}
h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
}
.small {
  font-size: 0.85rem;
}
code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--field);
}

/* ---- Buttons: resorted-ui's .btn, plus the bots' own kinds ---- */
.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.btn.disabled {
  opacity: 0.5;
  pointer-events: none;
}
.btn.ok {
  border-color: transparent;
  background: #1f8a5c;
  color: #fff;
}
.btn.danger.solid {
  border-color: transparent;
  background: #d94848;
  color: #fff;
}
.btn.discord,
.btn.twitch,
.btn.steam {
  border-color: transparent;
  color: #fff;
}
.btn.discord {
  background: #5865f2;
}
.btn.twitch {
  background: #9147ff;
}
.btn.steam {
  border-color: #66c0f4;
  background: #1b2838;
}
.btn.ok:hover:not(:disabled),
.btn.danger.solid:hover:not(:disabled),
.btn.discord:hover:not(:disabled),
.btn.twitch:hover:not(:disabled),
.btn.steam:hover:not(:disabled) {
  color: #fff;
  border-color: transparent;
  background-image: radial-gradient(110px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.25), transparent 70%);
}

/* ---- Cards and layout bits ---- */
.card + .card {
  margin-top: 14px;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.row.between {
  justify-content: space-between;
}
.grow {
  flex: 1;
  min-width: 0;
}
.stack > * + * {
  margin-top: 12px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--field);
  flex: none;
}
.avatar.lg {
  width: 56px;
  height: 56px;
}
.avatar.sm {
  width: 24px;
  height: 24px;
}
.avatar.square {
  border-radius: 12px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 40%, transparent);
}
.badge.warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
}
.badge.bad {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 40%, transparent);
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent);
}
.dot.bad {
  background: var(--bad);
}
.empty {
  align-items: center;
  text-align: center;
}
/* As many in a row as fit (resorted-ui's .stats has a fixed number of columns). */
.stats {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

/* ---- Forms ---- */
/* Here a label.field wraps its text and input (resorted-ui's .field is the input itself). */
label.field {
  display: grid;
  gap: 6px;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-weight: 600;
  font-size: 0.9rem;
}
label.field > small,
.hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.84rem;
}
input[type='text'],
input[type='url'],
input[type='search'],
input[type='number'],
input[type='password'],
input:not([type]),
textarea,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line2);
  border-radius: 11px;
  background: var(--field);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover,
textarea:hover {
  border-color: var(--line3);
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--c2);
  box-shadow: 0 0 0 3px rgba(61, 139, 255, 0.28);
}
input::placeholder,
textarea::placeholder {
  color: #66758a;
}
textarea {
  resize: vertical;
  min-height: 80px;
}
input[type='color'] {
  width: 46px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line2);
  border-radius: 10px;
  background: var(--field);
  cursor: pointer;
}
label.check {
  font-size: 0.92rem;
}
.counter {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted);
  justify-self: end;
}
/* Segmented buttons: <div class="seg"><button class="on"> */
.seg button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}
.seg button:hover {
  color: var(--text);
}
.seg button.on {
  background: var(--card2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line2);
}

/* ---- Chips (pickers) ---- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 0;
  padding: 3px 4px 3px 10px;
  border: 1px solid var(--line2);
  border-radius: 999px;
  background: var(--field);
  color: var(--text);
  font-size: 0.85rem;
}
.chip img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
.chip button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.chip button:hover {
  background: var(--card2);
  color: var(--text);
}
.role-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #99aab5;
  flex: none;
}
.picker {
  position: relative;
}
.picker-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line2);
  border-radius: 13px;
  background: #131a24;
  box-shadow: 0 22px 44px -16px rgba(0, 0, 0, 0.85), 0 0 30px -16px rgba(79, 220, 255, 0.5);
}
.picker-list button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.picker-list button:hover,
.picker-list button:focus-visible {
  background: var(--card2);
  outline: none;
}

/* ---- Tables / lists ---- */
.list {
  display: grid;
  gap: 8px;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  min-width: 0;
}
.list-item .grow > .name-line,
.list-item .grow > .sub-line {
  overflow: hidden;
  text-overflow: ellipsis;
}
.name-line {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sub-line {
  color: var(--muted);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

/* ---- "← Back" over the band of light on end-user pages ---- */
.page-nav {
  position: absolute;
  top: 16px;
  left: max(16px, calc(50% - 540px));
  z-index: 4;
  display: flex;
  gap: 8px;
}
.page-nav .btn,
.nav-btn {
  background: rgba(20, 27, 37, 0.7);
  border-color: var(--line2);
  color: var(--text);
  backdrop-filter: blur(10px);
}
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--line2);
  border-top-color: var(--c1);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 30px auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Dropdowns (select.js): the <select> stays, hidden; a button and a searchable menu show ----
   The same look as resorted-ui's dropdown (the pages set <html data-native-selects>, so its
   own script leaves the bots' selects to select.js). */
.dd {
  position: relative;
  width: 100%;
  min-width: 0;
}
select.dd-native {
  display: none;
}
.dd-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--line2);
  border-radius: 11px;
  background: var(--field);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dd-button:hover:not(:disabled) {
  border-color: var(--line3);
  background: radial-gradient(170px circle at var(--mx) var(--my), rgba(79, 220, 255, 0.12), transparent 70%), var(--field);
}
.dd-button:focus-visible,
.dd.open .dd-button {
  outline: none;
  border-color: var(--c2);
  box-shadow: 0 0 0 3px rgba(61, 139, 255, 0.25);
}
.dd-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.dd-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dd-label.placeholder {
  color: var(--muted);
}
.dd-chevron {
  display: flex;
  color: var(--muted);
  transition: transform 0.2s;
}
.dd-chevron svg {
  width: 16px;
  height: 16px;
}
.dd.open .dd-chevron {
  transform: rotate(180deg);
}
.dd-menu {
  position: fixed;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  padding: 6px;
  border: 1px solid var(--line2);
  border-radius: 13px;
  background: #131a24;
  box-shadow: 0 22px 44px -16px rgba(0, 0, 0, 0.85), 0 0 30px -16px rgba(79, 220, 255, 0.5);
  outline: none;
  animation: rui-drop 0.16s ease-out;
}
.dd-search {
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.dd-list {
  overflow-y: auto;
  overscroll-behavior: contain;
}
.dd-group {
  padding: 10px 10px 4px;
  color: var(--faint);
  font: 600 11px var(--font-display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.dd-option {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 10px;
  border-radius: 9px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.dd-option.active {
  background: radial-gradient(150px circle at var(--mx) var(--my), rgba(79, 220, 255, 0.16), transparent 70%), var(--card2);
}
.dd-option.selected {
  background: rgba(61, 139, 255, 0.12);
  font-weight: 600;
}
.dd-option.selected::after {
  content: '';
  flex: none;
  width: 10px;
  height: 6px;
  margin: -3px 2px 0 auto;
  border: 2px solid var(--c1);
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg);
}
.dd-option.none {
  color: var(--muted);
}
.dd-option.disabled {
  opacity: 0.45;
  cursor: default;
}
.dd-sign {
  color: var(--muted);
  font-weight: 400;
}
.dd-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}
.dd-note {
  margin-top: 6px;
  padding: 8px 10px 3px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}

/* ---- The page menu in the top bar (topnav.js): Dashboard · Moderators · Admin ---- */
.topnav {
  display: flex;
  gap: 4px;
  min-width: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav:empty {
  display: none;
}
.topnav a {
  padding: 6px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.topnav a:hover {
  color: var(--text);
  background: radial-gradient(80px circle at var(--mx) var(--my), var(--glow), transparent 70%);
}
.topnav a.on {
  color: var(--text);
  background: var(--card2);
  box-shadow: inset 0 0 0 1px var(--line2);
}
/* Wide screens: the menu in the middle of the bar, in the same place on every page. */
@media (min-width: 900px) {
  .rui-top-in {
    position: relative;
  }
  .topnav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* ---- The account menu's extras ---- */
.rui-account .badge {
  margin-left: 2px;
}
.rui-menu form {
  margin: 0;
}

/* ---- Phones ---- */
@media (max-width: 899px) {
  /* The page menu gets its own row under the bar's name and account. */
  .rui-top-in {
    flex-wrap: wrap;
    row-gap: 8px;
    padding-bottom: 8px;
  }
  .topnav {
    order: 10;
    flex-basis: 100%;
  }
}
@media (max-width: 640px) {
  .row {
    flex-wrap: wrap;
  }
  .account .grow,
  .list-item .grow {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .name-line {
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .card {
    padding-left: 14px;
    padding-right: 14px;
  }
}
