/*
 * css/views/resources.css — General > Resources (js/views/resources.js; estándar Resources 1.1 §7.2, §7.8).
 *
 * 5-nov, pedido del usuario: adaptado de la maqueta del estándar (docs/standard/examples/Resources/styles.css) a los
 * tokens del dashboard (css/base.css). Todas las clases llevan el prefijo res- para no chocar con las del resto.
 * Color propio por tarjeta (RES-5): la paleta de ejemplo del estándar, validada el 5-nov contra las superficies del
 * dashboard (#ffffff y #1e293b): contraste >= 3,1:1, ΔE entre vecinas >= 76 y >= 22 contra ok/alto/crítico/acento
 * (docs/Resources_ES.md §2). El tema lo pone siempre el kit en <html data-theme>, no hace falta @media.
 */
:root {
  --res-mem: #7c3aed; --res-swap: #ea580c; --res-cpu: #2563eb; --res-disk: #db2777; --res-heavy: #0891b2; --res-db: #65a30d;
}
:root[data-theme="dark"] {
  --res-mem: #8b5cf6; --res-swap: #ea580c; --res-cpu: #3b82f6; --res-disk: #ec4899; --res-heavy: #0891b2; --res-db: #65a30d;
}

#res-root { display: flex; flex-direction: column; gap: 16px; }
.res-dim { color: var(--text-dim); font-size: .8rem; }
.res-spacer { flex: 1; }

/* ---------- barra ---------- */
.res-bar { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--border);
           border-radius: var(--radius); padding: 12px 14px; }
.res-row { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.res-label { font-weight: 600; font-size: .85rem; }
.res-field { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--text-dim); }
.res-field[hidden], #res-apply[hidden], .res-link[hidden] { display: none; }
.res-bar input, .res-bar select { font: inherit; font-size: .85rem; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; min-height: 32px; }
.res-num { width: 80px; }
.res-bar input:focus-visible, .res-bar select:focus-visible, .res-bar button:focus-visible, .res-link:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; }
.res-link { font-size: .85rem; color: var(--accent-text); text-decoration: none; border: 1px solid var(--border);
            border-radius: 6px; padding: 5px 12px; min-height: 32px; display: inline-flex; align-items: center; }
.res-link:hover { border-color: var(--text-dim); }
.res-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.res-seg button { font: inherit; font-size: .82rem; color: var(--text-dim); background: transparent; border: 0;
                  padding: 6px 11px; cursor: pointer; min-height: 32px; }
.res-seg button + button { border-left: 1px solid var(--border); }
.res-seg button:hover { color: var(--text); }
.res-seg button.active { color: var(--text); background: color-mix(in srgb, var(--accent) 18%, transparent); font-weight: 600; }
.res-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.res-notice { margin: 0; padding: 8px 10px; border-radius: 6px; font-size: .82rem; color: var(--warn-text);
              background: color-mix(in srgb, var(--warn) 12%, transparent); }

/* ---------- tarjetas ---------- */
.res-mem { --lc: var(--res-mem); }   .res-swap { --lc: var(--res-swap); }   .res-cpu { --lc: var(--res-cpu); }
.res-disk { --lc: var(--res-disk); } .res-heavy { --lc: var(--res-heavy); } .res-db { --lc: var(--res-db); }

.res-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.res-card {
  min-width: 0; padding: 14px 18px; border: 1px solid var(--border); border-top: 5px solid var(--lc);
  border-radius: var(--radius); display: flex; flex-direction: column; gap: 6px; box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  background: linear-gradient(180deg, color-mix(in srgb, var(--lc) 12%, var(--surface)) 0, var(--surface) 110px);
}
.res-k { margin: 0; font-size: .76rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); }
.res-v { font: 700 2.6rem/1.1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.res-na { color: var(--text-dim); font-weight: 400; }
.res-unit { font-size: 1.2rem; font-weight: 600; margin-left: 5px; }
.res-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 22px; font-size: .78rem; color: var(--text-dim); }
.res-errtxt { color: var(--err-text); }

.res-state { font-size: .75rem; padding: 1px 8px; border-radius: 999px; white-space: nowrap; color: var(--text-dim);
             background: color-mix(in srgb, var(--text-dim) 14%, transparent); }
.res-state:empty { display: none; }
.res-state.ok   { color: var(--ok-text);   background: color-mix(in srgb, var(--ok) 14%, transparent); }
.res-state.warn { color: var(--warn-text); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.res-state.err  { color: var(--err-text);  background: color-mix(in srgb, var(--err) 14%, transparent); }

.res-spark { position: relative; height: 44px; cursor: crosshair; touch-action: pan-y; }
.res-svg { width: 100%; height: 44px; display: block; overflow: visible; }
.res-line { fill: none; stroke: var(--lc); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.res-area { fill: var(--lc); opacity: .14; stroke: none; }
.res-guide { stroke: var(--text-dim); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.res-guide[hidden] { display: none; }   /* hidden no se aplica solo dentro de un SVG */
.res-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--lc);
           border: 1.5px solid var(--surface); transform: translate(-50%, -50%); pointer-events: none; }
.res-dot[hidden] { display: none; }
.res-spark-empty { height: 44px; display: grid; place-items: center; text-align: center; font-size: .78rem; color: var(--text-dim); }
.res-cap { margin: 0; min-height: 1.2em; font-size: .75rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* ---------- carga y error (§7.10) ---------- */
.res-skel { border-radius: var(--radius); min-height: 196px; border: 1px solid var(--border);
            background: linear-gradient(90deg, var(--surface) 0, var(--surface-2) 50%, var(--surface) 100%);
            background-size: 200% 100%; animation: res-shimmer 1.2s infinite linear; }
@keyframes res-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .res-skel { animation: none; } }
.res-err { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px;
           border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--err) 40%, transparent);
           background: color-mix(in srgb, var(--err) 8%, var(--surface)); color: var(--err-text); }
.res-err.res-wait { color: var(--text-dim); border-color: var(--border); background: var(--surface); }

/* ---------- detalle ---------- */
.res-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.res-box-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.res-box-h h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.res-tbl { overflow-x: auto; }
.res-detail { width: 100%; border-collapse: collapse; font-size: .85rem; }
.res-detail td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.res-detail td:first-child { color: var(--text-dim); width: 40%; }
.res-detail td:last-child { overflow-wrap: anywhere; }

@media (max-width: 600px) {
  .res-v { font-size: 2rem; }
  .res-detail td:first-child { width: 45%; }
}
