/* ====================================================================
   OneStar Panel — custom styles on top of PicoCSS (dark theme default).
   Mobile is not a target; desktop >=1024px is the primary viewport.
   ==================================================================== */

:root {
  --onestar-bg-deep: #0e1116;
  --onestar-bg-soft: #161b22;
  --onestar-border:  #2a313a;
  --onestar-muted:   #8b95a5;
  --onestar-accent:  #6aa9ff;
  --onestar-good:    #2e8b57;
  --onestar-bad:     #c0392b;
  --onestar-warn:    #d4a017;
  --onestar-rcon:    #6aa9ff;
}

html, body { min-height: 100%; }
body { background: var(--onestar-bg-deep); }

/* ---------- Login ---------- */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card { width: min(420px, 100%); }
.login-card hgroup h2 { margin-bottom: 0; }
.login-card hgroup p  { color: var(--onestar-muted); margin-top: .2rem; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--onestar-bg-soft);
  border-bottom: 1px solid var(--onestar-border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .5rem 1rem;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: .8rem;
  font-size: 1.05rem;
}
.brand strong { letter-spacing: .04em; }
.uptime { color: var(--onestar-muted); font-size: .85rem; }

.tabs {
  list-style: none;
  display: flex;
  gap: .15rem;
  margin: 0;
  padding: 0;
  align-items: center;
}
.tabs li { margin: 0; padding: 0; }
.tabs a {
  display: inline-block;
  padding: .45rem .85rem;
  border-radius: .4rem;
  text-decoration: none;
  color: var(--onestar-muted);
  font-size: .92rem;
  transition: background .12s, color .12s;
}
.tabs a:hover { background: rgba(255,255,255,.05); color: #fff; }
.tabs a[aria-selected="true"] {
  background: rgba(106,169,255,.12);
  color: var(--onestar-accent);
}
.tabs a.logout { color: #ddd; }
.tabs a.logout:hover { color: var(--onestar-bad); }

.panel-main { padding-top: 1.25rem; padding-bottom: 2rem; }

/* ---------- Status badge ---------- */
.badge {
  padding: .18rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .05em;
  background: #3a3f48;
  color: #ddd;
  text-transform: uppercase;
}
.badge.online  { background: var(--onestar-good); color: #fff; }
.badge.offline { background: var(--onestar-bad);  color: #fff; }
.badge.pending { background: var(--onestar-warn); color: #1c1c1c; }

/* ---------- Overview: control buttons + metrics ---------- */
.control-row {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}
.control-row button { margin: 0; }
.control-result {
  margin-top: .6rem;
  color: var(--onestar-muted);
  font-size: .9rem;
  min-height: 1.2em;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.metric-card {
  background: var(--onestar-bg-soft);
  border: 1px solid var(--onestar-border);
  border-radius: .5rem;
  padding: .8rem;
}
.metric-card .metric-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .85rem;
  color: var(--onestar-muted);
  margin-bottom: .4rem;
}
.metric-card .metric-value {
  color: #eee;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.metric-card canvas {
  width: 100% !important;
  height: 160px !important;
}

/* ---------- Players ---------- */
.player-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .5rem;
}
.player-list {
  columns: 2;
  column-gap: 1.5rem;
  max-height: 28rem;
  overflow-y: auto;
}
.player-list .player {
  break-inside: avoid;
  padding: .15rem 0;
  font-size: .92rem;
  display: flex;
  justify-content: space-between;
  gap: .5rem;
}
.player .ping { color: var(--onestar-muted); font-size: .8rem; }
.empty {
  color: var(--onestar-muted);
  font-style: italic;
  padding: .5rem 0;
}

/* ---------- Console ---------- */
.log-stream {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem;
  line-height: 1.35;
  height: 60vh;
  min-height: 24rem;
  overflow-y: auto;
  background: #0a0d12;
  color: #d6dbe2;
  padding: .55rem .75rem;
  border: 1px solid var(--onestar-border);
  border-radius: .4rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-line { padding: 0; margin: 0; }
.log-line.ERROR   { color: #ff8a8a; }
.log-line.WARNING { color: #ffd87a; }
.log-line.RCON    { color: var(--onestar-rcon); }
.log-line .ts     { color: #5a6473; margin-right: .4rem; }
.log-line .lvl    { color: #7a8493; margin-right: .4rem; }
.log-paused-hint {
  font-size: .8rem;
  color: var(--onestar-warn);
  margin-top: .25rem;
  min-height: 1.1em;
}
.cmd-input {
  display: flex;
  gap: .5rem;
  margin-top: .6rem;
}
.cmd-input input {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin: 0;
}
.cmd-input button { margin: 0; }

/* ---------- Schedule ---------- */
.schedule-list { display: flex; flex-direction: column; gap: .35rem; }
.schedule-row {
  display: grid;
  grid-template-columns: 7rem 1fr 8rem 6rem;
  gap: .55rem;
  align-items: center;
  padding: .4rem .5rem;
  border: 1px solid var(--onestar-border);
  border-radius: .4rem;
  background: var(--onestar-bg-soft);
}
.schedule-row input,
.schedule-row label,
.schedule-row button { margin: 0; }
.schedule-row .toggle {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .88rem;
}
.schedule-add {
  display: grid;
  grid-template-columns: 7rem 1fr auto;
  gap: .55rem;
  align-items: center;
  margin-top: .8rem;
}
.schedule-add input, .schedule-add button { margin: 0; }

/* ---------- Settings ---------- */
.settings-form details { margin: .75rem 0; }
.settings-form details summary { cursor: pointer; }
.settings-result, .pw-result {
  font-size: .9rem;
  min-height: 1.2em;
  margin-top: .3rem;
}
.settings-result.ok, .pw-result.ok { color: var(--onestar-good); }
.settings-result.err, .pw-result.err { color: var(--onestar-bad); }

/* ---------- Events ---------- */
.ev-table {
  width: 100%;
  font-size: .9rem;
}
.ev-table th, .ev-table td {
  padding: .35rem .5rem;
  border-bottom: 1px solid var(--onestar-border);
  vertical-align: top;
}
.ev-table td.kind {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--onestar-accent);
  white-space: nowrap;
}
.ev-table td.time {
  color: var(--onestar-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- Misc ---------- */
.error { color: var(--onestar-bad); margin-top: .4rem; min-height: 1.2em; }
button[disabled] { opacity: .55; cursor: not-allowed; }
article header { font-weight: 600; }
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 1100px) {
  .section-grid    { grid-template-columns: 1fr; }
  .metric-grid     { grid-template-columns: 1fr; }
  .player-list     { columns: 1; }
  .schedule-row    { grid-template-columns: 6rem 1fr 7rem 5rem; }
}
