/* Resistencia Staff - tema oscuro */
:root {
    --bg: #0d0f13;
    --surface: #14171d;
    --surface-2: #1a1e26;
    --surface-3: #222732;
    --border: #2a303c;
    --text: #dfe3ea;
    --muted: #8b93a3;
    --accent: #e5484d;
    --accent-2: #ff6b6f;
    --focus: #5b9cff;

    --c-player: #6cb6ff;
    --c-weapon: #ff7b72;
    --c-entity: #f0a35e;
    --c-vehicle: #c89bff;
    --c-money: #56d364;
    --c-damage: #ff9492;
    --c-highlight: #f2cc60;
    --c-team: #7ee0c3;
    --c-group: #f0a35e;

    --radius: 8px;
    --sidebar: 248px;
    --topbar: 56px;
    font-size: 15px;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--c-player); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: .1px; }
h1 { font-size: 1.55rem; }
h3 { font-size: 1.02rem; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.ico { width: 18px; height: 18px; flex: none; }
.ico-xl { width: 46px; height: 46px; }

/* ---------- Barra superior ---------- */
.topbar {
    position: fixed; inset: 0 0 auto 0; height: var(--topbar); z-index: 30;
    display: flex; align-items: center; gap: 12px; padding: 0 18px;
    background: rgba(13, 15, 19, .92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: .3px; }
.brand:hover { text-decoration: none; }
.brand-ico { color: var(--accent); width: 22px; height: 22px; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-user form { margin: 0; }
.user-name { color: var(--text); font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); padding: 6px; border-radius: 6px; cursor: pointer; }

/* ---------- Menú lateral ---------- */
.sidebar {
    position: fixed; top: var(--topbar); bottom: 0; left: 0; width: var(--sidebar); z-index: 20;
    overflow-y: auto; padding: 14px 10px 24px;
    background: var(--surface); border-right: 1px solid var(--border);
}
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px;
    color: var(--muted); font-weight: 550;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: rgba(229, 72, 77, .14); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nav-group {
    margin: 18px 10px 6px; font-size: .72rem; font-weight: 700; letter-spacing: 1.2px;
    text-transform: uppercase; color: var(--accent-2);
}
.nav-server { margin-bottom: 6px; }
.nav-server-name { display: flex; align-items: center; gap: 10px; padding: 6px 10px; color: var(--text); font-weight: 600; }
.nav-server-name .ico { color: var(--muted); }
.nav-sub { padding-left: 38px; font-size: .93rem; }
.nav-sub .ico { width: 16px; height: 16px; }
.nav-empty { padding: 2px 10px 4px 38px; font-size: .82rem; color: #5f6675; }
.nav-backdrop { display: none; }

/* ---------- Contenido ---------- */
.main { padding: calc(var(--topbar) + 26px) 28px 40px; max-width: 1500px; }
.has-nav .main { margin-left: var(--sidebar); }
.no-nav .main { margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; }
.crumbs { color: var(--muted); font-size: .85rem; margin-bottom: 4px; }
.head-stats { display: flex; gap: 22px; }
.head-stats > div { display: flex; flex-direction: column; align-items: flex-end; }
.stat-num { font-size: 1.15rem; font-weight: 700; }
.stat-label { font-size: .78rem; color: var(--muted); }

.section-title { font-size: .8rem; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent-2); margin: 26px 0 12px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head .ico { color: var(--muted); }
.tool-list { display: flex; flex-direction: column; gap: 8px; }
.tool {
    display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 6px;
    background: var(--surface-2); border: 1px solid transparent; color: var(--text);
}
.tool:hover { border-color: var(--accent); text-decoration: none; }
.tool small { display: block; color: var(--muted); font-size: .84rem; margin-top: 2px; }
.tool-ico { color: var(--accent-2); width: 22px; height: 22px; margin-top: 2px; }

/* ---------- Botones y formularios ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
    border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
    font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-sm { height: 32px; padding: 0 10px; }
.btn-steam { background: #1b2838; border-color: #2a475e; height: 46px; padding: 0 22px; font-size: 1rem; }
.btn-steam:hover { background: #2a475e; border-color: #66c0f4; }

.filters {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; margin-bottom: 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 160px; }
.field > span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.field-grow { flex: 1 1 260px; }
.field-actions { flex-direction: row; gap: 8px; min-width: 0; }
input, select {
    height: 38px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text); font: inherit; min-width: 0;
}
input::placeholder { color: #5f6675; }
input:focus, select:focus { border-color: var(--focus); outline: none; }
select optgroup { color: var(--accent-2); }
select option { color: var(--text); background: var(--surface); }
input[type="datetime-local"] { color-scheme: dark; }
.field input, .field select { width: 100%; }

/* ---------- Logs ---------- */
.logs { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.log-row {
    display: grid; grid-template-columns: 112px 150px 1fr; gap: 14px; align-items: start;
    padding: 9px 14px; border-bottom: 1px solid #1f242d;
}
.log-row:last-child { border-bottom: 0; }
.log-row:hover { background: var(--surface-2); }
.log-time { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; font-size: .86rem; }
.log-time small { color: var(--muted); font-size: .76rem; }
.log-module {
    align-self: start; justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: .78rem; font-weight: 650; padding: 3px 8px; border-radius: 999px;
    color: hsl(var(--h), 80%, 75%); background: hsla(var(--h), 70%, 50%, .13); border: 1px solid hsla(var(--h), 70%, 55%, .28);
}
.log-module:hover { text-decoration: none; filter: brightness(1.2); }
.log-text { word-break: break-word; min-width: 0; }
.player-meta { white-space: nowrap; }

.chip { display: inline-block; padding: 0 6px; border-radius: 4px; font-weight: 600; line-height: 1.5; }
.chip-player { color: var(--c-player); background: rgba(108, 182, 255, .1); }
.chip-player:hover { background: rgba(108, 182, 255, .2); text-decoration: none; }
.chip-weapon { color: var(--c-weapon); background: rgba(255, 123, 114, .1); }
.chip-entity { color: var(--c-entity); background: rgba(240, 163, 94, .1); }
.chip-vehicle { color: var(--c-vehicle); background: rgba(200, 155, 255, .1); }
.chip-money { color: var(--c-money); background: rgba(86, 211, 100, .1); }
.chip-damage { color: var(--c-damage); background: rgba(255, 148, 146, .1); }
.chip-highlight { color: var(--c-highlight); background: rgba(242, 204, 96, .1); }
.chip-team { color: var(--c-team); background: rgba(126, 224, 195, .1); }
.chip-group { color: var(--c-group); background: rgba(240, 163, 94, .1); }
.chip-console { color: var(--muted); background: var(--surface-3); }
.chip-missing { color: var(--muted); background: var(--surface-3); font-style: italic; font-weight: 500; }
.log-string { color: #fff; }
.player-meta { margin-left: 4px; font-size: .8rem; color: var(--muted); }
.player-meta > span { margin-left: 6px; }
.player-meta > span:first-child::before { content: "➞ "; color: #5f6675; }
.m-team { color: var(--c-team); }
.m-hp { color: var(--c-weapon); }
.m-armor { color: #79a9ff; }
.m-weapon { color: var(--c-weapon); }
.m-group, .m-role { color: var(--c-group); }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 16px 0; }
.note { margin-top: 18px; }

/* ---------- Mensajes ---------- */
.alert { padding: 14px 16px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; }
.alert-error { background: rgba(229, 72, 77, .1); border-color: rgba(229, 72, 77, .4); color: #ffb3b5; }
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state.small { padding: 26px 16px; }
.empty-state h1 { margin-bottom: 8px; }
.empty-state p { color: var(--muted); }

/* ---------- Acceso ---------- */
.login { min-height: calc(100vh - var(--topbar) - 66px); display: grid; place-items: center; }
.login-card {
    width: 100%; max-width: 420px; text-align: center; padding: 34px 28px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.login-logo { color: var(--accent); margin-bottom: 10px; }
.login-card p { margin: 10px 0 22px; }

/* ---------- Móvil ---------- */
@media (max-width: 900px) {
    .nav-toggle { display: inline-flex; }
    .has-nav .main { margin-left: 0; }
    .main { padding: calc(var(--topbar) + 18px) 16px 32px; }
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .nav-open .sidebar { transform: none; }
    .nav-open .nav-backdrop { display: block; position: fixed; inset: var(--topbar) 0 0 0; background: rgba(0,0,0,.5); z-index: 15; }
    .log-row { grid-template-columns: 1fr auto; gap: 6px 10px; }
    .log-time { flex-direction: row; gap: 8px; align-items: baseline; }
    .log-module { justify-self: end; }
    .log-text { grid-column: 1 / -1; }
    .hide-sm { display: none; }
    .field { min-width: 0; flex: 1 1 140px; }
    .head-stats > div { align-items: flex-start; }
    .player-meta { white-space: normal; }
    .user-name { max-width: 110px; }
    .filters { padding: 12px; }
}
html, body { overflow-x: hidden; }
