/* Token names as in the owner's shadcn-style themes, plus the dashboard's own; the values can be pasted over. */
:root {
  --background: #121a24;
  --foreground: #f4f6f8;
  --card: #232b37;
  --card-raised: #2b3442;
  --sidebar: #263040;
  --muted: #19212c;
  --muted-foreground: #9fabb9;
  --border: #36414f;
  --radius: 0.45rem;
  --sidebar-width: 15rem;

  --green: #3a8c20;
  --green-bright: #6fd04a;
  --teal: #30c78d;
  --blue: #3f9ce8;
  --orange: #f0a23b;
  --red: #e56767;
  --purple: #a66bd4;
  --gold: #f2c94c;

  --primary: var(--teal);
  --primary-foreground: #0d1a14;
  --destructive: var(--red);
  --accent: var(--green);
  --accent-bright: var(--green-bright);
  color-scheme: dark;
}

/* Each part of the admin has its own colour: the page header, the card edges and the highlights follow it. */
body[data-section="content"] { --accent: #14876f; --accent-bright: #3fe0b5; }
body[data-section="scheduled"] { --accent: #2372c4; --accent-bright: #6db8ff; }
body[data-section="land"] { --accent: #b9691a; --accent-bright: #ffb866; }
body[data-section="players"] { --accent: #8544b8; --accent-bright: #cf9bf2; }
body[data-section="history"] { --accent: #a8820f; --accent-bright: #f7d560; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 85% -10%, #24456b 0%, transparent 55%),
    radial-gradient(ellipse at 0% 110%, #17403c 0%, transparent 50%),
    var(--background);
  background-attachment: fixed;
  color: var(--foreground);
  font-family: system-ui, sans-serif;
  font-weight: 500;
  line-height: 1.5;
}

nav {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1rem 0.75rem;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

nav strong {
  padding: 0.25rem 0.75rem 0.5rem;
  font-size: 1.25rem;
  font-weight: 900;
  background: linear-gradient(90deg, var(--gold), var(--orange));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

nav .group {
  padding: 0.9rem 0.75rem 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--foreground);
  text-decoration: none;
}

nav a:hover {
  background: var(--card);
  text-decoration: none;
}

nav a[aria-current] {
  background: var(--card-raised);
  box-shadow: inset 3px 0 0 var(--accent-bright);
  color: var(--accent-bright);
}

nav svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
  fill-opacity: 0.25;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

nav a[href="/"] svg { color: var(--green-bright); }
nav a[href="/Content"] svg { color: var(--teal); }
nav a[href="/Scheduled"] svg { color: var(--blue); }
nav a[href="/Land"] svg { color: var(--orange); }
nav a[href="/Players"] svg { color: var(--purple); }
nav a[href="/History"] svg { color: var(--gold); }

nav .session {
  margin-top: auto;
  padding: 0.5rem 0.75rem 0;
  font-size: 0.85rem;
  color: var(--muted-foreground);
}

nav form {
  margin: 0;
  padding: 0.5rem 0.75rem 0;
}

nav button {
  width: 100%;
  background: var(--orange);
  border-color: var(--orange);
}

main {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
}

nav + main {
  margin: 0 0 0 var(--sidebar-width);
}

h1 {
  margin: 0 -1.5rem 1.5rem;
  padding: 0.9rem 1.5rem;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
  border-bottom: 3px solid var(--accent-bright);
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 800;
}

h2 {
  margin: 1.75rem 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-bright);
}

h2::before {
  content: "";
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--accent-bright);
}

a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

table {
  width: 100%;
  margin: 0.5rem 0 1rem;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border-top: 3px solid var(--accent-bright);
  border-radius: var(--radius);
  overflow: hidden;
}

th,
td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: color-mix(in srgb, var(--accent) 35%, var(--card));
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--card-raised);
}

/* A table shown as a grid of tiles. The markup stays a table, so each cell's label comes from here. */
table.tiles {
  display: block;
  background: none;
  border-top: 0;
  overflow: visible;
}

table.tiles thead {
  display: none;
}

table.tiles tbody {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
}

table.tiles tr {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem;
  background: var(--card);
  border-top: 3px solid var(--accent-bright);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s;
}

table.tiles tr:hover {
  transform: translateY(-2px);
}

table.tiles td {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0;
  border: 0;
  font-weight: 700;
}

table.tiles td::before {
  flex: none;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted-foreground);
}

table.tiles td:first-child {
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
}

table.tiles td:first-child a {
  color: var(--accent-bright);
}

table.packs td:nth-child(2) {
  justify-content: center;
  margin-bottom: 0.5rem;
  color: var(--muted-foreground);
}

table.packs td:nth-child(3)::before { content: "State"; }
table.packs td:nth-child(4)::before { content: "Live version"; }
table.packs td:nth-child(5)::before { content: "Pending version"; }
table.packs td:nth-child(6)::before { content: "Previous version"; }
table.packs td:nth-child(7)::before { content: "Things"; }

table.packs td:nth-child(3) { color: var(--green-bright); }
table.packs td:nth-child(4) { color: var(--blue); }
table.packs td:nth-child(5) { color: var(--orange); }
table.packs td:nth-child(6) { color: var(--purple); }
table.packs td:nth-child(7) { color: var(--gold); }

table.worlds tbody {
  grid-template-columns: repeat(auto-fill, minmax(24rem, 1fr));
}

table.worlds td {
  display: block;
  font-weight: 500;
}

table.worlds td::before {
  display: block;
}

table.worlds td:first-child {
  text-align: center;
  color: var(--accent-bright);
}

table.worlds td:nth-child(2)::before { content: "Database"; color: var(--teal); }
table.worlds td:nth-child(3)::before { content: "Players online"; color: var(--purple); }
table.worlds td:nth-child(4)::before { content: "Container"; color: var(--blue); }
table.worlds td:nth-child(5)::before { content: "Ticks"; color: var(--gold); }

table.worlds td:last-child {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

table.worlds td:last-child a {
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  background: var(--card-raised);
  color: #ffffff;
  font-weight: 700;
}

table.worlds td:last-child a:hover {
  filter: brightness(1.15);
  text-decoration: none;
}

table.worlds td:last-child a:nth-of-type(1) { background: var(--orange); color: #1f1300; }
table.worlds td:last-child a:nth-of-type(2) { background: var(--blue); color: #04121f; }

/* The Overview's plain lines read as coloured readouts. */
body[data-section="index"] main > p:not(.note):not(.problem) {
  display: inline-block;
  margin: 0.25rem 0.5rem 0.25rem 0;
  padding: 0.45rem 0.9rem;
  background: var(--card);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
}

body[data-section="index"] main > p:nth-of-type(3n + 1):not(.note):not(.problem) { border-left-color: var(--teal); }
body[data-section="index"] main > p:nth-of-type(3n + 2):not(.note):not(.problem) { border-left-color: var(--purple); }

code,
pre {
  background: var(--muted);
  border-radius: var(--radius);
  color: var(--gold);
}

code {
  padding: 0.1rem 0.3rem;
}

pre {
  padding: 1rem;
  overflow-x: auto;
}

input,
select,
button {
  font: inherit;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

input,
select {
  background: var(--muted);
  color: var(--foreground);
}

input:focus,
select:focus {
  outline: 2px solid var(--accent-bright);
  outline-offset: 1px;
}

button {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.1);
}

button.destructive {
  background: var(--destructive);
  border-color: var(--destructive);
  color: #240606;
}

fieldset {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--card);
  border: 0;
  border-top: 3px solid var(--accent-bright);
  border-radius: var(--radius);
}

legend {
  padding: 0 0.5rem;
  font-weight: 700;
  color: var(--accent-bright);
}

form.inline {
  display: inline;
}

.note {
  color: var(--muted-foreground);
}

.problem,
.result {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--teal) 16%, var(--card));
  border-top: 3px solid var(--teal);
  border-radius: var(--radius);
}

.result p:first-child {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--teal);
}

.problem,
.result.refused,
.result.failed,
.result.started {
  background: color-mix(in srgb, var(--red) 16%, var(--card));
  border-top-color: var(--red);
}

.result.refused p:first-child,
.result.failed p:first-child,
.result.started p:first-child {
  color: var(--red);
}

/* The sign-in page has no menu: one card in the middle. */
body[data-section="signin"] main {
  max-width: 22rem;
  margin: 16vh auto 0;
  padding: 0 1.5rem 1.5rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

body[data-section="signin"] form {
  display: grid;
  gap: 0.9rem;
}

body[data-section="signin"] label {
  display: grid;
  gap: 0.3rem;
  font-weight: 700;
  color: var(--muted-foreground);
}

@media (max-width: 50rem) {
  nav {
    position: static;
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    border-right: 0;
  }

  nav strong {
    padding: 0.25rem 0.75rem;
  }

  nav .group {
    display: none;
  }

  nav .session {
    margin: 0 0 0 auto;
    padding: 0 0.75rem;
  }

  nav form {
    padding: 0;
  }

  nav button {
    width: auto;
  }

  nav + main {
    margin: 0;
  }
}
