/* ═══════════════════════════════════════════════════════════════════
   OpenRoadMP Panel — style.css
   Palette: dark navy #0D1117, surface #161B22, accent #F97316 (orange)
   Font: Inter (UI) + JetBrains Mono (dati tecnici)
═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0D1117;
  --surface:     #161B22;
  --surface-2:   #1C2128;
  --border:      #30363D;
  --accent:      #F97316;
  --accent-dim:  rgba(249,115,22,.15);
  --text:        #E6EDF3;
  --text-muted:  #7D8590;
  --green:       #3FB950;
  --red:         #F85149;
  --yellow:      #D29922;
  --blue:        #58A6FF;
  --sidebar-w:   240px;
  --radius:      8px;
  --font:        'Inter', system-ui, sans-serif;
  --mono:        'JetBrains Mono', monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ── LAYOUT ──────────────────────────────────────────────────────── */
body { display: flex; }

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── SIDEBAR ─────────────────────────────────────────────────────── */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .05em;
  padding: 4px 8px;
  border-radius: 6px;
}

.logo-text {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.sidebar-section {
  padding: 16px 10px 4px;
}

.sidebar-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--text-muted);
  padding: 0 8px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}

.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  object-fit: cover;
  flex-shrink: 0;
}

.user-name {
  display: block;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  display: block;
  font-size: 11px;
  color: var(--accent);
}

.btn-logout {
  display: block;
  text-align: center;
  padding: 6px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.btn-logout:hover { background: var(--red); color: #fff; }

/* ── TOPBAR ──────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
}

.topbar-right { display: flex; align-items: center; gap: 16px; }

.server-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background .3s;
}

.status-dot.online  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.offline { background: var(--red); }

/* ── STATS CARDS ─────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 24px 28px 8px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.green  { background: rgba(63,185,80,.15);  color: var(--green); }
.stat-icon.red    { background: rgba(248,81,73,.15);  color: var(--red); }
.stat-icon.yellow { background: rgba(210,153,34,.15); color: var(--yellow); }
.stat-icon.blue   { background: rgba(88,166,255,.15); color: var(--blue); }

.stat-value {
  display: block;
  font-size: 26px;
  font-weight: 700;
  font-family: var(--mono);
  line-height: 1;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── PANEL SECTION ───────────────────────────────────────────────── */
.panel-section {
  margin: 20px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.section-header h2 {
  font-size: 14px;
  font-weight: 600;
}

.section-badge {
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
}

.link-sm {
  font-size: 12px;
  color: var(--accent);
  opacity: .8;
  transition: opacity .15s;
}
.link-sm:hover { opacity: 1; }

/* ── TABLE ───────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.data-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--surface-2); }

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 28px !important;
}

/* Role pills */
.role-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  font-family: var(--mono);
}

/* Action badges */
.action-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--mono);
  text-transform: uppercase;
}

.action-tag.ban   { background: rgba(248,81,73,.2);  color: var(--red); }
.action-tag.kick  { background: rgba(210,153,34,.2); color: var(--yellow); }
.action-tag.mute  { background: rgba(88,166,255,.2); color: var(--blue); }
.action-tag.unban { background: rgba(63,185,80,.2);  color: var(--green); }

/* ── BUTTONS ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, background .15s;
}

.btn:hover { opacity: .85; }
.btn-danger { background: var(--red);    color: #fff; }
.btn-warn   { background: var(--yellow); color: #000; }
.btn-ghost  { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

/* ── MODAL ───────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 100;
  place-items: center;
}

.modal-overlay.open { display: grid; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 440px;
  max-width: 95vw;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 15px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
  transition: color .15s;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── FORM ────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); }

.input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  transition: border-color .15s;
}

.input:focus { border-color: var(--accent); }
.input[readonly] { opacity: .6; cursor: default; }
