
/* ==========================================================================
   SBMMC Admin Panel — common.css (cleaned & organized)
   ========================================================================== */

/* 1) THEME TOKENS & RESETS
   -------------------------------------------------------------------------- */
:root {
  --bg: #0f1115;
  --bg-2: #141821;
  --bg-3: #0b0e13;
  --panel: #171b24;
  --muted: #6b7280;
  --text: #e5e7eb;
  --text-2: #cbd5e1;
  --brand: #7dd3fc;
  --ok: #34d399;
  --warn: #f59e0b;
  --danger: #ef4444;
  --chip: #1f2430;
  --border: #202636;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg), var(--bg-3));
  color: var(--text);
  font: 14px/1.35 system-ui, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

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

/* 2) APP LAYOUT (header / sidebar / main)
   -------------------------------------------------------------------------- */
.app {
  display: grid;
  grid-template-rows: 56px 1fr;
  grid-template-columns: 260px 1fr;
  grid-template-areas: "top top" "side main";
  height: 100%;
}

header[role="banner"] {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(23,27,36,.7);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Brand & header bits */
.brand { display:flex; align-items:center; gap:8px; font-weight:700; letter-spacing:.2px; }
.brand .cube { width:18px; height:18px; display:inline-grid; grid-template-columns:repeat(3,6px); gap:2px; }
.brand .cube span { background: var(--brand); opacity:.9; }

/* Header widgets */
.nav-toggle { display:none; }
#globalSearch { min-width: 340px; }

/* Sidebar */
aside#sidebar {
  grid-area: side;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 10px;
  overflow: auto;
}
.nav { display:grid; gap:4px; }
.nav a {
  display:flex; gap:10px; align-items:center; justify-content:flex-start;
  border-radius:10px; padding:10px; border:1px solid transparent;
  background:transparent; color:inherit; font-size: 1.4rem;
}
.nav a:hover { background: rgba(255,255,255,.03); }
.nav a.active { background: linear-gradient(180deg, #1c2230, #151b27); border-color: var(--border); }
.nav svg { opacity:.8; }

/* Main area */
main { grid-area: main; padding:16px; overflow:auto; position:relative; }
.view { display:block; animation: fade .18s ease-in; }
@keyframes fade { from { opacity:.6; transform: translateY(2px); } to { opacity:1; transform:none; } }

/* Responsive nav */
@media (max-width:1080px) {
  .app { grid-template-columns: 0 1fr; }
  aside#sidebar { position:fixed; left:-260px; top:56px; height:calc(100% - 56px); z-index:40; }
  aside#sidebar.open { left:0; }
  .nav-toggle { display:inline-flex; }
}

.nav-icon {
  width: 1.1rem;
  height: 1.1rem;
  margin-right: 0.5rem;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}


/* 3) UI PRIMITIVES (inputs / buttons / chips / badges / hints)
   -------------------------------------------------------------------------- */
select, input, button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
button { cursor: pointer; }
.btn {
  background: #1b2130;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  color: inherit;
}
.btn.primary { background: linear-gradient(180deg, #1e293b, #172033); border-color:#263248; }
.btn.danger  { background: linear-gradient(180deg, #311c1c, #241516); border-color:#3b2021; color:#fecaca; }
.btn-small   { padding: 6px 10px; border-radius: 8px; font-size: 13px; }

.pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
}

/* Pills: shared */
.status-pills { display: inline-flex; gap: 6px; }

/* Pill variants for status */
.pill.warn {
  background: #2a1f11;
  border-color: rgba(245, 158, 11, .35);
  color: #fde68a;
}

.pill.danger {
  background: #2a1114;
  border-color: rgba(239, 68, 68, .35);
  color: #fecaca;
}

.badge {
  display:inline-flex; align-items:center; gap:6px;
  padding:3px 8px; border-radius:999px; background: var(--chip);
  border:1px solid var(--border); font-size:12px;
}
.badge.red   { background:#2a1114; }
.badge.green { background:#122a16; }
.hint { color: var(--muted); font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.section-title { display:flex; align-items:center; gap:10px; font-weight:700; margin:0 0 8px 0; }

/* Status chips */
.chip { display:inline-flex; align-items:center; gap:6px; padding:3px 8px; border-radius:999px; font-size:12px; background:var(--chip); border:1px solid var(--border); }
.chip.ok   { border-color: rgba(16,185,129,.35); }
.chip.warn  { background: rgba(214,163,0,0.12); border: 1px solid rgba(214,163,0,0.35); }
.chip.error { background: rgba(204,59,59,0.12);  border: 1px solid rgba(204,59,59,0.35); }
.chip .dot { width:6px; height:6px; border-radius:50%; }

/* tiny subdued chip for 'issued ago' */
.chip.subtle {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-2);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.4;
}

/* state chip can reuse .chip but a bit stronger */
.chip.state {
  margin-left: 8px;
}

/* one-line clamp with tooltip via title=... */
.clamp-1 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dot.ok   { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.err  { background: var(--danger); }

/* Alerts */
.alert { background:#161b28; border:1px solid var(--border); border-radius:10px; padding:10px 12px; }
.alert.warn { border-color: rgba(245,158,11,.35); color: #fde68a; }

/* 4) LAYOUT UTILITIES (grid helpers so HTML stays style-free)
   -------------------------------------------------------------------------- */
.grid { display:grid; gap:12px; }
.col-2 { grid-template-columns: 1fr 1fr; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.align-start { align-content: start; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }

/* 5) CARDS / TABLES
   -------------------------------------------------------------------------- */
.card { background: var(--panel); border:1px solid var(--border); border-radius:14px; box-shadow: var(--shadow); padding:14px; }

.table-wrap { overflow:auto; border-radius:12px; border:1px solid var(--border); }
table { width:100%; border-collapse: separate; border-spacing:0; }
thead th {
  position: sticky; top: 0;
  background:#101522; border-bottom:1px solid var(--border);
  text-align:left; padding:10px; font-weight:600;
}
tbody td { border-bottom: 1px solid rgba(32,38,54,.6); padding:10px; vertical-align: top; }
tbody tr:hover { background: rgba(255,255,255,.02); }
td.num { text-align:right; font-variant-numeric: tabular-nums; }
.sticky { position: sticky; left: 0; background: linear-gradient(90deg, #101522 0%, #111827 30%, transparent 100%); }

/* 6) DRAWER (right panel)
   -------------------------------------------------------------------------- */
.drawer {
  position: fixed; right: -680px; top: 56px;
  width: 680px; max-width: 95vw; height: calc(100% - 56px);
  background: var(--panel); border-left: 1px solid var(--border); box-shadow: var(--shadow);
  transition: right .18s ease; z-index: 30; display:flex; flex-direction:column;
}
.drawer.open { right: 0; }
.drawer header {
  position: sticky; top:0; background:var(--panel); border-bottom:1px solid var(--border);
  padding:12px 14px; display:flex; gap:8px; align-items:center;
}
.drawer .content { padding:18px; overflow:auto; display:grid; gap:14px; }
@media (min-width:1600px) { .drawer { width: 760px; right: -760px; } }

/* 7) TOASTS (top-right notifications)
   -------------------------------------------------------------------------- */
#toasts { position:fixed; top:10px; right:10px; display:grid; gap:8px; z-index:1000; }
.toast {
  background: rgba(23,27,36,.95); border:1px solid var(--border); border-radius:12px;
  padding:10px 12px; box-shadow: var(--shadow); opacity:0; transform: translateY(-6px);
  animation: toastIn .18s ease forwards;
}
.toast.success { border-color: rgba(16,185,129,.35); }
.toast.warn    { border-color: rgba(245,158,11,.35); }
.toast.error   { border-color: rgba(239,68,68,.35); }
@keyframes toastIn { to { opacity:1; transform: none; } }

/* 8) DASHBOARD METRICS & CHART AREA
   -------------------------------------------------------------------------- */
.metric { display:flex; align-items: baseline; gap:10px; }
.metric .metric-value { font-size:26px; font-weight:700; letter-spacing:.2px; }
.metric .metric-sub { color:var(--text-2); font-size:12px; }

/* 9) TOOLBARS (filters, actions)
   -------------------------------------------------------------------------- */
.toolbar {
  display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:space-between; margin:0 0 12px 0;
}
.filters { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }

/* 10) STAFF PAGE (role/perm strip)
   -------------------------------------------------------------------------- */
.perm-bar {
  display:flex; flex-wrap:wrap; gap:8px; align-items:center; padding:10px;
  background:#101522; border:1px solid var(--border); border-radius:12px;
}
.perm-bar .group { display:flex; gap:6px; align-items:center; background:#151b27; border:1px solid var(--border); border-radius:10px; padding:6px 8px; }
.switch { display:inline-flex; align-items:center; gap:6px; }
.switch input { accent-color: #60a5fa; }

/* 11) PLAYERS (grid & list views)
   -------------------------------------------------------------------------- */
/* Container + view switch controls */
.controls { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-bottom:12px; }
.controls .right-controls { margin-left:auto; display:flex; gap:8px; align-items:center; }

/* Grid & list containers */
.cards { display:grid; gap:10px; }
.cards.grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); } /* was 260px */
.cards.list { grid-template-columns: 1fr !important; gap: 10px; }

/* Player card base */
.player-card {
  position: relative; display:flex; gap:10px; background: var(--panel);
  border:1px solid var(--border); border-radius:12px; padding:10px;
}

/* Grid layout: vertical */
.cards.grid .player-card { flex-direction: column; align-items: stretch; }

/* List layout: horizontal */
.cards.list .player-card { flex-direction: row; align-items: center; padding: 12px 14px; min-height: 72px; }

/* List view: pills inline next to username */
.cards.list .player-card .topline {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cards.list .player-card .status-pills { position: static; }

/* Grid view: float pills to the top-right corner of the card */
.cards.grid .player-card .status-pills {
  position: absolute; top: 10px; right: 10px;
}

/* Avatar */
.player-card .avatar {
  display:grid; place-items:center; border:1px solid var(--border); background:#20283a;
  border-radius:8px; overflow:hidden; flex:0 0 auto;
}
.cards.list .player-card .avatar { width:42px; height:42px; }
.cards.grid .player-card .avatar { width:64px; height:64px; }
.player-card .avatar img { width:100%; height:100%; object-fit: cover; }

/* Meta & footer */
.player-card .meta { display:grid; gap:2px; }
.player-card .meta .title { font-weight:600; }
.cards.list .player-card .meta { margin-left:10px; min-width:260px; }

.player-card .footer,
.player-card > .footer,
.cards.list .player-card > div:last-child {
  margin-left:auto; display:inline-flex; gap:8px; align-items:center; flex-wrap:wrap;
}

/* wider search input on desktop; full width on narrow screens */
#playerSearch,
.input.wide { width: 360px; min-width: 320px; }
@media (max-width: 640px) {
  #playerSearch,
  .input.wide { width: 100%; min-width: 0; }
}

/* Punishments (horizontal list, one section under another) */
.punish-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.pc-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pc-col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pc-col-head .title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pc-col-head .count {
  font-size: 13px;
  color: var(--muted);
}

.pc-col-head .actions {
  display: flex;
  gap: 8px;
}

.pc-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pc {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}

.pc-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pc-info .line {
  font-size: 13px;
}

.pc-info .label {
  color: var(--muted);
  margin-right: 6px;
}

.pc-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Color accents per type */
.pc.ban  { border-left: 4px solid #cc3b3b; }
.pc.mute { border-left: 4px solid #d6a300; }
.pc.warn { border-left: 4px solid #3a78d0; }
.pc.kick { border-left: 4px solid #6b7280; }

.punish-stack { display:grid; gap: 22px; }

/* Section header: title + count + Add button (only) */
.psec {
  display:flex; align-items:center; justify-content:space-between;
  padding: 6px 10px; border:1px solid var(--border); border-radius:10px;
  background:#0f1523;
}
.psec .left { display:flex; align-items:center; gap:10px; }
.psec .count { background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.08);
  padding:2px 8px; border-radius:999px; font-size:12px; color:var(--text-2); }
.psec .actions .btn { padding:6px 10px; }

/* Horizontal rows list */
.p-list { display:grid; gap:10px; }
.p-row {
  display:grid;
  grid-template-columns: 320px 1fr 180px auto;
  gap: 12px;
  align-items:center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

/* Left info: status + time */
.p-left { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.flag {
  font-size:12px; padding:3px 8px; border-radius:999px;
  border:1px solid transparent; background: rgba(255,255,255,.06);
}
.flag.permanent { color:#ffd98a; border-color:rgba(214,163,0,.35); background:rgba(214,163,0,.1); }
.flag.expires   { color:#bfdbfe; border-color:rgba(59,130,246,.35); background:rgba(59,130,246,.12); }
.flag.expired   { color:#fca5a5; border-color:rgba(239,68,68,.35); background:rgba(239,68,68,.12); }

.when, .until, .by { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text-2); }
.until { font-weight:600; }

/* Reason column */
.p-reason .label { display:block; font-size:12px; color:var(--muted); margin-bottom:2px; }
.p-reason .text {
  white-space: normal;       /* allow multiple lines */
  word-break: break-word;    /* break long words if needed */
  overflow-wrap: anywhere;   /* wrap at any character */
}

/* By column */
.p-by .label { display:block; font-size:12px; color:var(--muted); margin-bottom:2px; }

/* Actions */
.p-act { display:flex; gap:8px; }
.p-act .btn { padding:6px 10px; }
.p-act .btn.danger { background: linear-gradient(180deg, #311c1c, #241516); border-color:#3b2021; color:#fecaca; }

/* Type-specific left border accent */
.p-row.mute { border-left:4px solid #d6a300; }
.p-row.ban  { border-left:4px solid #cc3b3b; }
.p-row.warn { border-left:4px solid #3a78d0; }
.p-row.kick { border-left:4px solid #6b7280; }

/* Empty message */
.p-empty {
  padding:10px 12px; border:1px dashed var(--border); border-radius:10px; color:var(--text-2);
}

/* Responsive: stack columns on narrow screens */
@media (max-width: 980px) {
  .p-row { grid-template-columns: 1fr; align-items:start; }
  .p-reason .text { white-space:normal; }
  .p-act { justify-content:flex-end; }
}


/* PLAYER DRAWER */
.tabpane { display: none; }
.tabpane.show { display: block; }

.tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.tab { cursor: pointer; }
.tab.active { font-weight: 600; }

/* Progress bars */
.bar { position: relative; height: 8px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: inherit; transition: width .25s ease; background: #3b82f6; } /* use your accent color */
.skill-header { display:flex; justify-content:space-between; align-items:center; margin-bottom: 6px; }
.level-badge { font-size: 12px; padding: 2px 6px; border-radius: 999px; background: rgba(255,255,255,0.08); }


/* 12) PLAYER FOOTER BITS
   -------------------------------------------------------------------------- */
.footer { opacity:.6; margin-top:8px; font-size:12px; }
.status-dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.status-dot.online { background: var(--ok); }
.status-dot.offline { background: var(--danger); }

/* 13) SMALL UTILITY HELPERS (to avoid inline styles)
   -------------------------------------------------------------------------- */
.ml-auto { margin-left: auto; }
.mt-8 { margin-top: 8px; }
.mb-8 { margin-bottom: 8px; }
.self-start { align-self: start; }
.w-full { width: 100%; }
.h-260 { height: 260px; }

.hstack { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vstack { display: grid; gap: 8px; }


body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #1e1e2f;
}

.login-container {
  max-width: 400px;
  width: 100%;
  padding: 1rem;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
}

.login-btn .icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 120;
}
.modal:target { display: block; }

.modal .backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}

.modal .card {
  position: absolute;
  left: 50%;
  top: 8%;
  transform: translateX(-50%);
  width: min(720px, 94vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.modal header h3 { margin: 0; font-size: 18px; }
.modal .content { display: grid; gap: 8px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

.modal .close {
  text-decoration: none;
  opacity: .75;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #111827;
}
.modal .close:hover { opacity: 1; }

/* inputs */
.modal input[type="text"],
.modal input[type="datetime-local"] {
  width: 100%;
}
