/* Revolution Internet — tema da interface GenieACS (System Revolution)
   Injetado pelo nginx. Não altera arquivos do pacote genieacs. */

:root {
  --rv-bg: #f5f7fb;
  --rv-surface: #ffffff;
  --rv-surface-2: #f8fafc;
  --rv-border: #e5e7eb;
  --rv-text: #0f172a;
  --rv-muted: #64748b;
  --rv-accent: #2563eb;
  --rv-accent-hover: color-mix(in srgb, var(--rv-accent) 82%, black);
  --rv-accent-soft: color-mix(in srgb, var(--rv-accent) 9%, white);
  --rv-on-accent: #ffffff;
  --rv-danger: #dc2626;
  --rv-success: #16a34a;
  --rv-warning: #d97706;
  --rv-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --rv-radius: 10px;
  --rv-font: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* variáveis do próprio GenieACS */
  --base-font-size: 14px;
  --color1: var(--rv-border);
  --color2: var(--rv-muted);
  --color3: var(--rv-accent-soft);
  --color4: var(--rv-accent);
  --color5: var(--rv-text);
  --disabled: #94a3b8;
  color-scheme: light;
}

html[data-rv-theme="dark"] {
  --rv-bg: #0b1120;
  --rv-surface: #111827;
  --rv-surface-2: #0f172a;
  --rv-border: #1f2937;
  --rv-text: #e5e7eb;
  --rv-muted: #94a3b8;
  --rv-accent: #60a5fa;
  --rv-accent-hover: color-mix(in srgb, var(--rv-accent) 75%, white);
  --rv-accent-soft: rgba(96, 165, 250, .12);
  --rv-on-accent: #0b1120;
  --rv-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
  --disabled: #475569;
  --status-red: 0 70% 35%;
  --status-green: 140 55% 28%;
  --status-gray: 215 15% 30%;
  --status-yellow: 40 80% 32%;
  color-scheme: dark;
}

/* ---------- base ---------- */
html, body { background: var(--rv-bg); }
body, input, button, select, option, textarea {
  font-family: var(--rv-font);
  color: var(--rv-text);
  font-size: var(--base-font-size);
}
a, a:visited { color: var(--rv-accent); text-decoration: none; }
a:hover { color: var(--rv-accent-hover); background: transparent; text-decoration: underline; }
h1 { color: var(--rv-text); font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 4px 0 18px; }
h2 { color: var(--rv-text); font-size: 15px; font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--rv-border); }

/* ---------- cabeçalho ---------- */
#header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  min-height: 64px;
  background: var(--rv-surface);
  border-bottom: 1px solid var(--rv-border);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}
#header > .logo { display: flex; align-items: center; }
#header > .logo > img {
  content: url(/rv/logo.svg);
  height: 40px; width: auto; margin: 0;
}
html[data-rv-theme="dark"] #header > .logo > img { content: url(/rv/logo-dark.svg); }
#header > .logo > .version { display: none; }

#header > nav { position: static; display: block; }
#header > nav > ul { display: flex; gap: 4px; margin: 0; font-weight: 500; }
#header > nav > ul > li {
  background: transparent; border: 0; border-radius: 8px; margin: 0;
}
#header > nav > ul > li > a,
#header > nav > ul > li > a:visited,
#header > nav > ul > li > a:hover {
  min-width: 0; padding: 8px 14px; color: var(--rv-muted); text-decoration: none; border-radius: 8px;
}
#header > nav > ul > li:hover { background: var(--rv-surface-2); }
#header > nav > ul > li:hover > a { color: var(--rv-text); }
#header > nav > ul > li.active { background: var(--rv-accent-soft); }
#header > nav > ul > li.active > a { color: var(--rv-accent); font-weight: 600; }
#header > nav > ul > li#rv-nav-dashboard { order: -1; }

#header > .user-menu {
  float: none; margin: 0 0 0 auto; display: flex; align-items: center; gap: 8px; color: var(--rv-muted);
}

#rv-theme-toggle {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rv-border) !important; border-radius: 9px; background: var(--rv-surface) !important;
  color: var(--rv-muted) !important; cursor: pointer; font-size: 16px; padding: 0;
}
#rv-theme-toggle:hover { color: var(--rv-text) !important; background: var(--rv-surface-2) !important; }

/* gaveta de tarefas pendentes e notificações */
#header > .drawer-wrapper > .drawer,
#header > .drawer-wrapper > .notifications-wrapper > .notification {
  background: var(--rv-surface); border-color: var(--rv-border); box-shadow: var(--rv-shadow); color: var(--rv-text);
}
#header > .drawer-wrapper > .notifications-wrapper > .notification { border-radius: var(--rv-radius); padding: 10px 14px; }

/* ---------- layout ---------- */
#content-wrapper { background: var(--rv-bg); }
#content { margin: 24px 28px; }

#side-menu { width: 220px; min-width: 220px; padding: 16px 0 16px 16px; }
#side-menu > ul > li > a {
  margin: 2px 0; padding: 9px 12px; border-radius: 8px; background: transparent; color: var(--rv-muted);
}
#side-menu > ul > li > a:hover { background: var(--rv-surface-2); color: var(--rv-text); text-decoration: none; }
#side-menu > ul > li.active > a { background: var(--rv-accent-soft); color: var(--rv-accent); }

/* ---------- tabelas ---------- */
table.table {
  border-collapse: separate; border-spacing: 0; background: var(--rv-surface);
  border: 1px solid var(--rv-border); border-radius: var(--rv-radius); box-shadow: var(--rv-shadow);
  overflow: hidden;
}
table.table table.table { box-shadow: none; }
table.table th {
  background: var(--rv-surface-2); color: var(--rv-muted); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--rv-border); padding: 10px 14px;
}
table.table th a, table.table th a:visited { color: var(--rv-muted); }
table.table td { padding: 10px 14px; }
table.table.highlight > tbody > tr > td { border-bottom: 1px solid var(--rv-border); }
table.table.highlight > tbody > tr:last-child > td { border-bottom: 0; }
table.table.highlight > tbody > tr:hover { background: var(--rv-accent-soft); }
table.table tfoot td { background: var(--rv-surface-2); border-top: 1px solid var(--rv-border); color: var(--rv-muted); }
table.table tbody > tr.empty { color: var(--rv-muted); }

table.parameter-list th { color: var(--rv-muted); font-weight: 600; padding: 6px 12px 6px 0; }
table.parameter-list td { padding: 6px 0; }

.all-parameters > .parameter-list { border: 1px solid var(--rv-border); border-radius: var(--rv-radius); background: var(--rv-surface); }
.all-parameters > .parameter-list > table > tbody > tr:hover { background: var(--rv-accent-soft); }

/* ---------- botões e campos ---------- */
input[type=button], button {
  padding: 6px 12px; border-radius: 8px; font-weight: 500; color: var(--rv-accent); cursor: pointer;
}
:is(input[type=button], button):hover:enabled { background: var(--rv-accent-soft); color: var(--rv-accent-hover); }
:is(input[type=button], button).primary {
  background: var(--rv-accent); border: 1px solid var(--rv-accent); color: var(--rv-on-accent);
}
:is(input[type=button], button).primary:hover:enabled { background: var(--rv-accent-hover); border-color: var(--rv-accent-hover); color: var(--rv-on-accent); }
:is(input[type=button], button).critical { background: transparent; border: 1px solid var(--rv-danger); color: var(--rv-danger); }
:is(input[type=button], button).critical:hover:enabled { background: var(--rv-danger); color: #fff; }

input:not([type=button]):not([type=checkbox]):not([type=radio]):not([type=submit]),
select, textarea {
  background: var(--rv-surface); color: var(--rv-text);
  border: 1px solid var(--rv-border); border-radius: 8px; padding: 7px 10px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--rv-accent) !important; box-shadow: 0 0 0 3px var(--rv-accent-soft);
}
input[type=submit] {
  background: var(--rv-accent); color: var(--rv-on-accent); border: 0; border-radius: 8px; padding: 8px 16px; font-weight: 600; cursor: pointer;
}
.filter > input { width: 36em; max-width: 100%; padding: 9px 12px; font-size: 14px; }
.autocomplete { background: var(--rv-surface); border: 1px solid var(--rv-border); border-radius: 8px; box-shadow: var(--rv-shadow); }
.autocomplete > .suggestion:hover, .autocomplete > .suggestion.selected { background: var(--rv-accent-soft); }

.actions-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.actions-bar > button { border: 1px solid var(--rv-border); background: var(--rv-surface); }

span.tag, .tags > .tag {
  background: var(--rv-accent-soft); color: var(--rv-accent); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 500;
}

/* ---------- overview ---------- */
.page-overview > h1 { text-align: left; }
.overview-chart-group { gap: 20px; justify-content: flex-start; flex-wrap: wrap; }
.pie-chart {
  margin: 0; padding: 20px 24px; background: var(--rv-surface);
  border: 1px solid var(--rv-border); border-radius: var(--rv-radius); box-shadow: var(--rv-shadow);
}
.pie-chart > svg > path { stroke: var(--rv-surface); stroke-width: 2px; }
.pie-chart > .legend { margin-top: 12px; color: var(--rv-muted); }
.pie-chart > .legend > .legend-line > .color { border-radius: 3px; }
.overview-chart-group h2 { color: var(--rv-text); }

/* ---------- modais ---------- */
.overlay-wrapper { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.overlay-wrapper > .overlay {
  background: var(--rv-surface); color: var(--rv-text); border: 1px solid var(--rv-border);
  border-radius: 14px; box-shadow: 0 20px 50px rgba(15, 23, 42, .25); padding: 20px 24px;
}
.wizard-dialog { background: var(--rv-surface); border-radius: 14px; }

/* ---------- editor de código ---------- */
html[data-rv-theme="dark"] .CodeMirror { background: var(--rv-surface-2); color: var(--rv-text); }
html[data-rv-theme="dark"] .CodeMirror-gutters { background: var(--rv-surface); border-color: var(--rv-border); }
html[data-rv-theme="dark"] .CodeMirror-cursor { border-left-color: var(--rv-text); }

/* ---------- status / progresso ---------- */
.progress { background: var(--rv-surface-2); border-radius: 999px; overflow: hidden; }
.progress > .progress-bar { background: var(--rv-accent); }
p.error { color: var(--rv-danger); }
.loading-overlay { background: color-mix(in srgb, var(--rv-bg) 70%, transparent); }

/* ---------- página do dispositivo em blocos ---------- */
.rv-device-grid {
  display: grid; gap: 16px; margin: 16px 0;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
section.rv-card {
  background: var(--rv-surface); border: 1px solid var(--rv-border); border-radius: 12px;
  box-shadow: var(--rv-shadow); padding: 16px 20px; min-width: 0;
}
section.rv-card.rv-wide { margin: 16px 0; overflow-x: auto; }
section.rv-card > h2 {
  margin: 0 0 12px; font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--rv-muted);
}
section.rv-card table.parameter-list { width: 100%; border-collapse: collapse; }
section.rv-card table.parameter-list th {
  text-align: left; font-weight: 500; color: var(--rv-muted); width: 42%; white-space: nowrap;
  padding: 7px 12px 7px 0; border-bottom: 1px solid var(--rv-border);
}
section.rv-card table.parameter-list td { padding: 7px 0; border-bottom: 1px solid var(--rv-border); font-weight: 500; }
section.rv-card table.parameter-list tr:last-child th,
section.rv-card table.parameter-list tr:last-child td { border-bottom: 0; }
section.rv-card table.table { box-shadow: none; width: 100%; }
section.rv-card .summon-button, section.rv-card button.primary { margin-left: 8px; padding: 4px 10px; font-size: 12px; }

/* ================= menu lateral + barra superior (todas as páginas) ================= */
:root { --rv-side-w: 232px; }
html.rv-side-mini { --rv-side-w: 68px; }
#rv-side { display: none; }
html.rv-shell body { padding-left: var(--rv-side-w); transition: padding-left .15s; }
html.rv-shell #rv-side {
  display: flex; flex-direction: column; position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: var(--rv-side-w);
  background: var(--rv-surface); border-right: 1px solid var(--rv-border); padding: 12px 10px; overflow-y: auto; transition: width .15s;
}
#rv-side .rv-side-logo { display: flex; align-items: center; height: 52px; padding: 0 8px; margin-bottom: 8px; }
#rv-side .rv-side-logo img { height: 36px; display: none; }
#rv-side .rv-side-logo img.l { display: block; }
html[data-rv-theme="dark"] #rv-side .rv-side-logo img.l { display: none; }
html[data-rv-theme="dark"] #rv-side .rv-side-logo img.d { display: block; }
html.rv-side-mini #rv-side .rv-side-logo img.l, html.rv-side-mini #rv-side .rv-side-logo img.d { display: none !important; }
html.rv-side-mini #rv-side .rv-side-logo img.m { display: block; height: 30px; }
#rv-side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#rv-side .rv-side-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--rv-muted); padding: 16px 12px 6px; opacity: .8; }
html.rv-side-mini #rv-side .rv-side-sec { font-size: 0; padding: 10px 0 4px; border-top: 1px solid var(--rv-border); margin: 6px 8px 0; }
#rv-side nav a, #rv-side nav a:visited {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; color: var(--rv-muted);
  font-weight: 500; text-decoration: none; white-space: nowrap; overflow: hidden;
}
#rv-side nav a:hover { background: var(--rv-surface-2); color: var(--rv-text); text-decoration: none; }
#rv-side nav a.ativo { background: var(--rv-accent-soft); color: var(--rv-accent); font-weight: 600; }
#rv-side nav a .ic { width: 22px; text-align: center; font-size: 16px; flex: none; }
html.rv-side-mini #rv-side nav a { justify-content: center; padding: 10px 0; }
html.rv-side-mini #rv-side nav a .tx { display: none; }
#rv-side .rv-side-toggle {
  margin-top: 10px; border: 1px solid var(--rv-border); background: var(--rv-surface); color: var(--rv-muted);
  border-radius: 9px; height: 34px; cursor: pointer; font-size: 16px;
}
#rv-side .rv-side-toggle:hover { background: var(--rv-surface-2); color: var(--rv-text); }
html.rv-side-mini #rv-side .rv-side-toggle { transform: rotate(180deg); }

/* barra superior: o logo e os links antigos saem (estão no menu lateral) */
html.rv-shell #header > .logo, html.rv-shell #header > nav,
html.rv-shell .rv-top > a:first-child, html.rv-shell .rv-top > nav { display: none !important; }
html.rv-shell #header, html.rv-shell .rv-top { position: sticky; top: 0; z-index: 40; min-height: 60px; }
#rv-topo { display: flex; align-items: center; gap: 14px; flex: 1; order: -1; min-width: 0; }
#rv-topo .rv-hamb { display: none; width: 36px; height: 36px; border: 1px solid var(--rv-border); border-radius: 9px; background: var(--rv-surface); color: var(--rv-text); cursor: pointer; font-size: 18px; }
#rv-topo .rv-busca { position: relative; flex: 1; max-width: 460px; }
#rv-topo .rv-busca input {
  width: 100%; height: 38px; border: 1px solid var(--rv-border); border-radius: 10px; padding: 0 14px;
  background: var(--rv-surface-2); color: var(--rv-text); font-size: 14px; outline: none;
}
#rv-topo .rv-busca input:focus { border-color: var(--rv-accent); background: var(--rv-surface); box-shadow: 0 0 0 3px var(--rv-accent-soft); }
#rv-topo .rv-busca-res {
  display: none; position: absolute; top: 44px; left: 0; right: 0; z-index: 60; background: var(--rv-surface);
  border: 1px solid var(--rv-border); border-radius: 10px; box-shadow: var(--rv-shadow); overflow: hidden;
}
#rv-topo .rv-busca-res a { display: block; padding: 9px 14px; color: var(--rv-text); text-decoration: none; border-bottom: 1px solid var(--rv-border); }
#rv-topo .rv-busca-res a:last-child { border-bottom: 0; }
#rv-topo .rv-busca-res a:hover, #rv-topo .rv-busca-res a.sel { background: var(--rv-accent-soft); }
#rv-topo .rv-busca-res small { display: block; color: var(--rv-muted); font-size: 12px; }
#rv-topo .rv-busca-res .vazio { padding: 12px 14px; color: var(--rv-muted); }
#rv-topo .rv-ind { display: flex; gap: 8px; margin-left: auto; }
#rv-topo .rv-pill, #rv-topo .rv-pill:visited {
  display: inline-flex; align-items: baseline; gap: 4px; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 13px;
  border: 1px solid var(--rv-border); background: var(--rv-surface); color: var(--rv-text); text-decoration: none; white-space: nowrap;
}
#rv-topo .rv-pill small { font-weight: 500; color: var(--rv-muted); }
#rv-topo .rv-pill.bad { border-color: var(--rv-danger); color: var(--rv-danger); }
#rv-topo .rv-pill:hover { background: var(--rv-surface-2); text-decoration: none; }

/* celular: menu vira gaveta */
@media (max-width: 900px) {
  html.rv-shell body { padding-left: 0; }
  html.rv-shell #rv-side { transform: translateX(-100%); width: 240px; transition: transform .2s; box-shadow: var(--rv-shadow); }
  html.rv-shell.rv-side-aberto #rv-side { transform: none; }
  html.rv-side-mini #rv-side nav a .tx { display: inline; }
  #rv-topo .rv-hamb { display: inline-block; }
  #rv-topo .rv-pill small { display: none; }
}
#rv-side .rv-side-admin, #rv-side .rv-side-admin:visited {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; color: var(--rv-muted);
  font-weight: 500; text-decoration: none; white-space: nowrap; border-top: 1px solid var(--rv-border); margin-top: 8px;
}
#rv-side .rv-side-admin:hover { background: var(--rv-surface-2); color: var(--rv-text); text-decoration: none; }
#rv-side .rv-side-admin.ativo { background: var(--rv-accent-soft); color: var(--rv-accent); font-weight: 600; }
#rv-side .rv-side-admin .ic { width: 22px; text-align: center; font-size: 16px; flex: none; }
html.rv-side-mini #rv-side .rv-side-admin { justify-content: center; padding: 10px 0; }
html.rv-side-mini #rv-side .rv-side-admin .tx { display: none; }

/* reset de fábrica bloqueado por segurança (o servidor também recusa) */
button[title="Factory reset device"], button[title="Factory reset selected devices"] { display: none !important; }
