/* Painel Minecraft — tema escuro, responsivo, sem dependências externas. */

:root {
  --bg: #11161c;
  --panel: #19202a;
  --panel-2: #212b37;
  --line: #2d3947;
  --text: #e4eaf1;
  --muted: #8b9aad;
  --accent: #4f9ae0;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --radius: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3 { line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.error { color: var(--err); }

/* ----- Login ----- */
.login { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 360px;
  display: grid;
  gap: .5rem;
}
.login-card h1 { margin: 0 0 1rem; font-size: 1.2rem; text-align: center; }
.login-card label { font-size: .82rem; color: var(--muted); }
.login-card button { margin-top: 1rem; }

/* ----- Top bar ----- */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 1rem; margin: 0; white-space: nowrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* ----- Tabs ----- */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; }
.tabs.sub { margin: 1rem 0 0; border-bottom: 1px solid var(--line); }
.tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: .5rem .85rem;
  cursor: pointer;
  font: inherit;
  border-radius: 4px 4px 0 0;
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ----- Buttons ----- */
.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: .45rem .9rem;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b1016; font-weight: 600; }
.btn.danger { border-color: #5c2b2b; color: #ff9d96; }
.btn.danger:hover:not(:disabled) { border-color: var(--err); background: #2a1a1a; }
.btn.ghost { background: none; }

/* ----- Layout ----- */
.view { padding: 1.25rem; max-width: 1400px; margin: 0 auto; }
.section-head { display: flex; align-items: center; gap: 1rem; }
.section-head h2 { margin-right: auto; }

.banner {
  margin: 0;
  padding: .7rem 1.25rem;
  font-size: .9rem;
  border-bottom: 1px solid var(--line);
}
.banner.error { background: #2a1517; color: #ff9d96; }
.banner.notice { background: #152433; color: #9ecbff; }

/* ----- Host summary / stat tiles ----- */
.host-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .75rem;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .8rem 1rem;
}
.tile .label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tile .value { font-size: 1.25rem; font-weight: 600; margin-top: .2rem; }
.tile .sub { font-size: .8rem; color: var(--muted); }
.tile.warn { border-color: var(--warn); }
.tile.bad { border-color: var(--err); }

/* ----- Instance cards ----- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 1rem;
  margin-top: .5rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: border-color .15s;
}
.card:hover { border-color: var(--accent); }
.card-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.card-top h3 { margin: 0; font-size: 1.05rem; }

.badge {
  font-size: .72rem;
  padding: .18rem .5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge.online { background: #10281a; color: var(--ok); border-color: #1f5130; }
.badge.offline { background: #20262e; color: var(--muted); }
.badge.pending { background: #2a2411; color: var(--warn); border-color: #58481a; }
.badge.failed { background: #2a1517; color: var(--err); border-color: #5c2b2b; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem .8rem; font-size: .86rem; }
.kv dt, .kv .k { color: var(--muted); }
.kv dd, .kv .v { margin: 0; overflow-wrap: anywhere; }

/* ----- Detail ----- */
.detail { padding: 1.25rem; max-width: 1400px; margin: 0 auto; }
.detail-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.detail-head h2 { margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.pane { padding-top: 1rem; }
.pane-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }

/* ----- Console ----- */
.console {
  background: #0c1116;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .8rem;
  height: 440px;
  overflow: auto;
  margin: 0;
  font: 12.5px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.console-form { display: flex; gap: .5rem; margin-top: .6rem; }
.console-form input { flex: 1; }

/* ----- Forms ----- */
input[type=text], input[type=password], input[type=number], input[type=time], select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: .45rem .6rem;
  border-radius: 6px;
  font: inherit;
  width: 100%;
}
input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
label { display: block; font-size: .85rem; }
label.inline { display: inline-flex; align-items: center; gap: .35rem; width: auto; }
input[type=checkbox] { width: auto; accent-color: var(--accent); }

.card-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  display: grid;
  gap: .7rem;
  max-width: 540px;
  margin-bottom: 1rem;
}
.card-form h3 { margin: 0; }
.inline-form { display: flex; gap: .5rem; max-width: 420px; margin-bottom: .75rem; }
.days { border: 1px solid var(--line); border-radius: 6px; padding: .5rem .7rem; }
.days legend { font-size: .78rem; color: var(--muted); padding: 0 .3rem; }

/* ----- Tables ----- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th, .table td { padding: .5rem .7rem; text-align: left; border-bottom: 1px solid var(--line); }
.table th { background: var(--panel-2); color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.res-success { color: var(--ok); }
.res-failure { color: var(--err); }
.res-denied { color: var(--warn); }

/* ----- Modal ----- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .66);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 100;
}
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 520px;
  width: 100%;
}
.modal-card h3 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }
#modal-extra { display: grid; gap: .5rem; }

.empty { color: var(--muted); padding: 1rem; text-align: center; }

@media (max-width: 640px) {
  .topbar { padding: .6rem .8rem; }
  .view, .detail { padding: .8rem; }
  .cards { grid-template-columns: 1fr; }
  .console { height: 320px; }
}

/* Mods e modpacks */
.stack { display: flex; flex-direction: column; gap: .5rem; max-width: 520px; margin-bottom: .75rem; }
.stack label:not(.inline) { display: flex; flex-direction: column; gap: .25rem; }
.inline-form.wide { max-width: 720px; }
.inline-form.wide input { flex: 1; min-width: 0; }
progress { width: 100%; max-width: 520px; }
.badge-off { color: var(--muted, #888); }
