/* ==========================================================================
   pages-panel.css — RESERVADO (placeholder)
   Dueño: el agente de la fase siguiente que ajusta las paginas propias del
   panel de cliente (/panel/*: config, players, bans, settings, multistream,
   download, redeem...). Se carga despues de glass.css y dashboard.css.
   Usar selectores con alcance de pagina para no filtrar estilos a otras.
   ========================================================================== */

/* ==========================================================================
   /panel/config — layout estilo "Electron": buscador + navegacion por
   categorias a la izquierda, filas toggle + Warn/Kick/Ban a la derecha.
   Todo con alcance .cfg-* (no filtra a otras paginas). Usa solo los tokens
   del tema (rojo --accent), asi el modo claro funciona solo.
   ========================================================================== */
.cfg-layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* ---------- columna izquierda ---------- */
.cfg-side {
  position: sticky;
  top: 16px;
  display: flex; flex-direction: column; gap: 12px;
  max-height: calc(100vh - 32px);
  min-width: 0;
}
.cfg-search { position: relative; }
.cfg-search svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--muted-2); pointer-events: none;
}
.cfg-search input[type=search] {
  width: 100%; height: 40px; padding: 0 12px 0 36px;
  border-radius: 12px;
  background: var(--g-input); border: 1px solid var(--g-border-strong);
  font-size: 13.5px;
}
.cfg-search input[type=search]::-webkit-search-cancel-button { filter: grayscale(1) opacity(.6); }

.cfg-nav {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px;
  overflow-y: auto; min-height: 0;
  background: var(--g-card);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius);
  box-shadow: var(--g-shadow), var(--g-hl);
  scrollbar-width: thin;
}
.cfg-nav-label {
  padding: 10px 10px 6px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--muted-2);
}
.cfg-nav-label:not(:first-child) { margin-top: 6px; border-top: 1px solid var(--g-divider); padding-top: 14px; }
.cfg-nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; margin: 0;
  padding: 8px 10px;
  border: 1px solid transparent; border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit; font-size: 13.5px; font-weight: 500; text-align: left;
  cursor: pointer;
  transition: background .2s var(--g-ease), color .2s ease, border-color .2s ease;
}
.cfg-nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .85; }
.cfg-nav-item > span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfg-nav-item:hover { background: var(--g-subtle-2); color: var(--text); }
.cfg-nav-item.active {
  background: rgba(255, 57, 71, 0.12);
  border-color: rgba(255, 57, 71, 0.28);
  color: var(--text);
}
.cfg-nav-item.active svg { color: var(--accent); opacity: 1; filter: drop-shadow(0 0 6px rgba(255, 57, 71, 0.5)); }
.cfg-nav-count {
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--muted-2);
}
.cfg-nav-item.active .cfg-nav-count { color: var(--muted); }
.cfg-nav-item[hidden], .cfg-nav-label[hidden] { display: none; }

/* ---------- panel derecho ---------- */
.cfg-main { min-width: 0; }
.cfg-pane[hidden] { display: none; }
.cfg-pane-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.cfg-pane-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 57, 71, 0.3), rgba(255, 57, 71, 0.07));
  border: 1px solid rgba(255, 57, 71, 0.3);
  color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 8px 18px -10px rgba(255, 57, 71, 0.8);
}
.cfg-pane-icon svg { width: 18px; height: 18px; }
.cfg-pane-head h2 { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.015em; }
.cfg-pane-head p { margin-top: 2px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }

.cfg-card {
  position: relative;
  background: var(--g-card);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius);
  box-shadow: var(--g-shadow), var(--g-hl);
  backdrop-filter: blur(var(--g-blur)) saturate(var(--g-sat));
  -webkit-backdrop-filter: blur(var(--g-blur)) saturate(var(--g-sat));
}
.cfg-card::before {
  content: ""; position: absolute; top: 0; left: 8%; right: 8%; height: 1px;
  background: var(--g-spec); opacity: .5; pointer-events: none;
}
.cfg-card-body { padding: 6px 20px 18px; }
.cfg-card-body > .wave-row:first-child { border-top: none; }
.cfg-card-body > .field { margin-top: 14px; }

/* ---------- fila de deteccion ---------- */
.cfg-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 16px;
  padding: 15px 20px;
  border-top: 1px solid var(--g-divider);
  transition: background .2s ease;
}
.cfg-row:first-child { border-top: none; }
.cfg-row:hover { background: var(--g-subtle); }
.cfg-row[hidden] { display: none; }
.cfg-row-text { min-width: 0; }
.cfg-row-title {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px;
  font-size: 14px; font-weight: 600; color: var(--text);
  transition: color .2s ease;
}
.cfg-row-title .check-badge { margin-left: 0; }
.cfg-row-desc {
  margin: 3px 0 0;
  font-size: 12.5px; line-height: 1.45; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* checks de solo interruptor: la descripcion se lee completa, sin recortar */
.cfg-row-desc.is-full { display: block; -webkit-line-clamp: unset; overflow: visible; max-width: 760px; }
.cfg-row-actions { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.cfg-switch { margin: 0; }

.cfg-gear {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; margin: 0;
  background: var(--g-subtle); border: 1px solid var(--g-border); border-radius: 10px;
  color: var(--muted); cursor: pointer;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}
.cfg-gear svg { width: 15px; height: 15px; transition: transform .35s var(--g-ease); }
.cfg-gear:hover, .cfg-gear.open { color: var(--accent); background: rgba(255, 57, 71, 0.12); border-color: rgba(255, 57, 71, 0.3); }
.cfg-gear.open svg { transform: rotate(60deg); }

/* Selector segmentado Warn / Kick / Ban */
.cfg-seg {
  display: inline-flex; flex-wrap: wrap; max-width: 100%; gap: 2px; padding: 3px;
  background: var(--g-input);
  border: 1px solid var(--g-border);
  border-radius: 12px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}
.cfg-seg-opt { position: relative; display: block; margin: 0; cursor: pointer; }
.cfg-seg-opt input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; opacity: 0; cursor: pointer;
}
.cfg-seg-opt span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 56px; padding: 6px 13px;
  border-radius: 9px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.cfg-seg-opt:hover span { color: var(--text); }
.cfg-seg-opt.seg-warn input:checked + span {
  background: rgba(255, 177, 59, 0.16); color: var(--warning);
  box-shadow: inset 0 0 0 1px rgba(255, 177, 59, 0.3);
}
.cfg-seg-opt.seg-kick input:checked + span {
  background: rgba(53, 210, 138, 0.16); color: var(--success);
  box-shadow: inset 0 0 0 1px rgba(53, 210, 138, 0.3);
}
.cfg-seg-opt.seg-ban input:checked + span {
  background: rgba(255, 57, 71, 0.16); color: var(--danger);
  box-shadow: inset 0 0 0 1px rgba(255, 57, 71, 0.32);
}
/* Comunitarias (solo con la opcion prendida en General -> Comunitarias) */
.cfg-seg-opt.seg-service input:checked + span {
  background: rgba(34, 211, 238, 0.14); color: #7ee3f5;
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.32);
}
.cfg-seg-opt[hidden] { display: none; }
.cfg-seg-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Check apagado: se ve atenuado, como en Electron */
.cfg-row.is-off .cfg-row-title,
.cfg-row.is-off .cfg-row-desc { color: var(--muted-2); }
.cfg-row.is-off .cfg-seg { opacity: .45; }
.cfg-row.is-off .cfg-seg:hover { opacity: .8; }

/* ajustes finos (se abre con el engranaje) */
.cfg-tune {
  grid-column: 1 / -1;
  margin-top: 14px; padding: 14px 16px;
  background: var(--g-subtle);
  border: 1px solid var(--g-border);
  border-radius: 14px;
}
.cfg-tune[hidden] { display: none; }
.cfg-tune .field-row { margin: 0; align-content: flex-start; align-items: flex-start; }
.cfg-tune .field-row > .field:not([style*="flex"]) { flex: 0 1 210px; }
.cfg-tune .field-row > .field.checkbox-row { flex: 0 0 auto; align-self: flex-end; }
.cfg-tune .hint { margin-top: 2px; }
.cfg-tune .field:last-child { margin-bottom: 0; }

.cfg-empty {
  display: none;
  padding: 36px 20px; text-align: center;
  color: var(--muted); font-size: 13.5px;
}
.cfg-layout.is-searching.has-no-results .cfg-empty { display: block; }

/* ---------- barra de guardado ---------- */
.cfg-savebar {
  position: sticky; bottom: 16px; z-index: 5;
  display: flex; align-items: center; justify-content: flex-end; gap: 14px;
  margin-top: 18px; padding: 10px 12px 10px 18px;
  background: var(--g-elevated);
  border: 1px solid var(--g-border-strong);
  border-radius: 16px;
  box-shadow: var(--g-shadow-lg), var(--g-hl-strong);
  backdrop-filter: blur(var(--g-blur-strong)) saturate(var(--g-sat));
  -webkit-backdrop-filter: blur(var(--g-blur-strong)) saturate(var(--g-sat));
}
.cfg-dirty {
  margin-right: auto;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--warning);
}
.cfg-dirty::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 8px currentColor;
}
/* Solo aparece cuando hay cambios sin guardar */
.cfg-savebar { display: none; }
.cfg-savebar.is-dirty { display: flex; animation: cfgSaveIn .35s var(--g-ease); }
@keyframes cfgSaveIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cfg-savebar.is-dirty { animation: none; } }

/* Icono (i) con tooltip negro en lugar de la descripcion en linea */
.cfg-row:hover, .cfg-row:focus-within { position: relative; z-index: 3; }
.cfg-info {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0;
  color: var(--muted-2); cursor: help; outline: none;
  transition: color .2s ease;
}
.cfg-info > svg { width: 16px; height: 16px; }
.cfg-info:hover, .cfg-info:focus-visible { color: var(--text); }
.cfg-info:focus-visible > svg { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 50%; }
.cfg-tip {
  position: absolute; left: -6px; top: 100%;
  margin-top: 8px;
  width: max-content; max-width: min(380px, 80vw); max-height: 280px; overflow-y: auto;
  padding: 10px 14px;
  background: #050506; color: #f5f5f5;
  border: 1px solid var(--g-border-strong);
  border-radius: 10px;
  box-shadow: 0 14px 34px -8px rgba(0, 0, 0, 0.85);
  font-size: 12.5px; font-weight: 500; line-height: 1.5; letter-spacing: 0; text-align: left; white-space: normal;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s var(--g-ease), visibility .18s;
  z-index: 20;
  cursor: auto;
}
/* puente invisible para poder mover el mouse hasta el tooltip sin que se cierre */
.cfg-tip::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.cfg-info:hover .cfg-tip, .cfg-info:focus .cfg-tip, .cfg-info:focus-within .cfg-tip { opacity: 1; visibility: visible; transform: none; }
html[data-theme="light"] .cfg-tip { background: #0b0b0c; color: #f5f5f5; }
@media (prefers-reduced-motion: reduce) { .cfg-tip { transition: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .cfg-row { grid-template-columns: auto minmax(0, 1fr); row-gap: 12px; }
  .cfg-row-actions { grid-column: 2; justify-content: flex-start; }
}
@media (max-width: 900px) {
  .cfg-layout { grid-template-columns: minmax(0, 1fr); }
  .cfg-side { position: static; max-height: none; }
  .cfg-nav {
    flex-direction: row; flex-wrap: nowrap; align-items: center;
    overflow-x: auto; overflow-y: hidden; padding: 8px; border-radius: 16px;
    scrollbar-width: none;
  }
  .cfg-nav::-webkit-scrollbar { display: none; }
  .cfg-nav-label { display: none; }
  .cfg-nav-item { width: auto; flex-shrink: 0; white-space: nowrap; }
  .cfg-nav-count { display: none; }
}
@media (max-width: 520px) {
  .cfg-row { padding: 14px 14px; column-gap: 12px; }
  .cfg-card-body { padding: 4px 14px 14px; }
  .cfg-seg-opt span { min-width: 48px; padding: 7px 10px; }
  .cfg-savebar { bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .cfg-gear svg, .cfg-nav-item, .cfg-seg-opt span { transition: none; }
}
/* Detecciones que el plan del servidor no incluye (ver /plan-features): visibles pero bloqueadas. */
.cfg-row.is-locked { opacity: .55; }
.cfg-row.is-locked input, .cfg-row.is-locked select, .cfg-row.is-locked button, .cfg-row.is-locked .switch { pointer-events: none; }
