/* ══════════════════════════════════════════════════════════════
   KACHAI · Architecture Explorer — estilos (solo lectura)
   ══════════════════════════════════════════════════════════════ */

.arch { display: flex; flex-direction: column; gap: 16px; min-height: 100%; }

.arch__head h1 { margin: 0 0 6px; font-size: 26px; font-weight: 600; color: #f8fafc; }
.arch__head p { margin: 0; color: #94a3b8; font-size: 13px; }
.arch__head code, .arch__detail code { font-family: 'JetBrains Mono', monospace; background: rgba(148,163,184,.12); border: 1px solid rgba(148,163,184,.18); padding: 1px 6px; border-radius: 6px; font-size: 11px; }
.arch__review { color: #f59e0b; }

.arch__toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.arch__tabs { display: inline-flex; gap: 4px; background: rgba(148,163,184,.08); padding: 4px; border-radius: 10px; }
.arch__tab { border: 0; background: transparent; color: #94a3b8; padding: 7px 14px; border-radius: 7px; font-size: 13px; cursor: pointer; font-family: inherit; }
.arch__tab.is-on { background: #1e293b; color: #f8fafc; }
.arch__search { display: inline-flex; align-items: center; gap: 8px; background: rgba(148,163,184,.08); border: 1px solid rgba(148,163,184,.16); border-radius: 10px; padding: 6px 12px; flex: 1; min-width: 200px; max-width: 360px; color: #94a3b8; }
.arch__search input { border: 0; background: transparent; color: #f8fafc; outline: none; font-size: 13px; width: 100%; font-family: inherit; }
.arch__refresh { display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(148,163,184,.2); background: #0f172a; color: #cbd5e1; padding: 7px 14px; border-radius: 10px; font-size: 13px; cursor: pointer; font-family: inherit; }
.arch__refresh:disabled { opacity: .5; cursor: default; }
.arch__zoom { display: inline-flex; gap: 4px; }
.arch__zoom button { display: inline-flex; align-items: center; justify-content: center; width: 33px; height: 33px; border: 1px solid rgba(148,163,184,.2); background: #0f172a; color: #cbd5e1; border-radius: 9px; cursor: pointer; }
.arch__zoom button:hover { background: #1e293b; }
.arch__tab:focus-visible, .arch__refresh:focus-visible, .arch__zoom button:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }

.arch__body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }

.arch__graph-wrap { position: relative; background: radial-gradient(ellipse at center, #0b1220 0%, #060a14 100%); border: 1px solid rgba(148,163,184,.14); border-radius: 14px; min-height: 720px; overflow: hidden; cursor: grab; }
.arch__graph-wrap:active { cursor: grabbing; }
.arch__graph { width: 100%; }
.arch__svg { display: block; width: 100%; height: auto; }

.arch__legend { position: absolute; left: 14px; bottom: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: #94a3b8; }
.arch-legend-note { color: #64748b; font-size: 11px; }

/* ── Grafo: aristas ── */
.arch-edge { stroke-linecap: round; }
.arch-edge--root { stroke: rgba(148,163,184,.45); stroke-width: 1.7; }
.arch-edge--member { stroke: rgba(148,163,184,.28); stroke-width: 1.1; }
.arch-edge--dep { stroke: rgba(96,165,250,.65); stroke-width: 1.5; fill: none; }
.arch-edge--dep.is-dim { opacity: .08; }
#archArrow path { fill: rgba(96,165,250,.55); }

/* ── Grafo: nodos ── */
.arch-node { cursor: pointer; }
.arch-node circle { transition: opacity .15s ease, filter .15s ease; }
.arch-node--root circle { fill: #7c3aed; stroke: #a78bfa; stroke-width: 1.5; }
.arch-node__root-label { fill: #fff; font-size: 16px; font-weight: 700; text-anchor: middle; dominant-baseline: middle; font-family: 'JetBrains Mono', monospace; }
.arch-node--domain circle { fill: #243450; stroke: #7c8aa0; stroke-width: 1.5; }
.arch-node__domain-label { fill: #f1f5f9; font-size: 12.5px; font-weight: 600; text-anchor: middle; dominant-baseline: middle; font-family: 'Instrument Sans', sans-serif; }

.arch-node--module .arch-node__circle { fill: #16243c; stroke-width: 1.7; }
.arch-node__label { fill: #cbd5e1; font-size: 10.5px; text-anchor: middle; font-family: 'JetBrains Mono', monospace; opacity: 0.68; transition: opacity .15s ease; }
.arch-node__label.is-on { opacity: 1; fill: #f8fafc; }
.arch-node.is-hover .arch-node__label { opacity: 1; fill: #f8fafc; font-weight: 600; }

.arch-node__halo { fill: rgba(124,58,237,.18); }
.arch-node--module.is-sel .arch-node__halo { fill: rgba(56,189,248,.22); }
.arch-node--module.is-sel .arch-node__circle { stroke: #f8fafc; stroke-width: 2.6; }
.arch-node.is-neighbor { opacity: .9; }
.arch-node.is-dim { opacity: .34; }
.arch-edge--dep.is-active { stroke: #38bdf8; stroke-width: 2.4; }

/* Hover de dominio: resalta el dominio y sus módulos, atenúa el resto. */
.arch-node--module.is-domain-active { opacity: 1; }
.arch-node--module.is-domain-dim { opacity: .32; }
.arch-node--domain.is-domain-active circle { stroke: #f8fafc; stroke-width: 2.2; }
.arch-node--domain.is-domain-active .arch-node__domain-label { fill: #fff; }
.arch-node--domain.is-domain-dim { opacity: .45; }
.arch-edge--member.is-domain-active { stroke: rgba(226,232,240,.55); stroke-width: 1.8; }

/* Modo Dependencias: la pertenencia se atenúa y depends_on destaca. */
.arch__graph-wrap[data-view="dependencies"] .arch-edge--root,
.arch__graph-wrap[data-view="dependencies"] .arch-edge--member { opacity: .16; }
.arch__graph-wrap[data-view="dependencies"] .arch-edge--dep { stroke: #60a5fa; stroke-width: 2; }
.arch__graph-wrap[data-view="dependencies"] .arch-edge--dep.is-active { stroke: #38bdf8; stroke-width: 2.8; }

/* Riesgo: borde por color + tamaño (el JS aplica el tamaño por rango). */
.arch-node--module.arch-risk--low .arch-node__circle { stroke: #22c55e; }
.arch-node--module.arch-risk--medium .arch-node__circle { stroke: #f59e0b; }
.arch-node--module.arch-risk--high .arch-node__circle { stroke: #f97316; }
.arch-node--module.arch-risk--critical .arch-node__circle { stroke: #ef4444; }

/* Modo riesgos: relleno por riesgo (además de borde, tamaño y leyenda). */
.arch__graph-wrap[data-view="risks"] .arch-node--module.arch-risk--low .arch-node__circle { fill: rgba(34,197,94,.28); }
.arch__graph-wrap[data-view="risks"] .arch-node--module.arch-risk--medium .arch-node__circle { fill: rgba(245,158,11,.28); }
.arch__graph-wrap[data-view="risks"] .arch-node--module.arch-risk--high .arch-node__circle { fill: rgba(249,115,22,.32); }
.arch__graph-wrap[data-view="risks"] .arch-node--module.arch-risk--critical .arch-node__circle { fill: rgba(239,68,68,.36); }

.arch-node__review { fill: #f59e0b; stroke: #0b1220; stroke-width: 1; }

.arch-node.is-hover circle { filter: brightness(1.45); }
.arch-node.is-match .arch-node__circle { stroke: #38bdf8; stroke-width: 2.4; }
.arch-node.is-match .arch-node__label { fill: #7dd3fc; }

/* ── Leyenda de riesgo ── */
.arch-risk { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #cbd5e1; }
.arch-risk i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.arch-risk--low i { background: #22c55e; }
.arch-risk--medium i { background: #f59e0b; }
.arch-risk--high i { background: #f97316; }
.arch-risk--critical i { background: #ef4444; }

/* ── Panel de detalle ── */
.arch__detail { position: sticky; top: 12px; }
.arch__detail-card { background: #0b1220; border: 1px solid rgba(148,163,184,.14); border-radius: 14px; padding: 18px; max-height: 78vh; overflow: auto; }
.arch__detail-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #64748b; padding: 40px 16px; text-align: center; border: 1px dashed rgba(148,163,184,.2); border-radius: 14px; }
.arch__detail-empty .ms { font-size: 34px; }
.arch__detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.arch__detail-head h2 { margin: 0 0 4px; font-size: 18px; color: #f8fafc; }
.arch__detail-desc { color: #94a3b8; font-size: 13px; line-height: 1.6; margin: 0 0 14px; }
.arch__detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.arch__detail-meta > div { background: rgba(148,163,184,.06); border-radius: 9px; padding: 9px 10px; }
.arch__detail-meta .k { display: block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #64748b; margin-bottom: 3px; }
.arch__detail-meta .v { display: block; font-size: 12.5px; color: #e2e8f0; }
.arch__detail-block { margin-bottom: 13px; }
.arch__detail-block h3 { margin: 0 0 6px; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: #64748b; }
.arch__detail-block ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.arch__detail-block li code { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #cbd5e1; background: rgba(148,163,184,.08); padding: 2px 7px; border-radius: 6px; word-break: break-all; display: inline-block; }
.arch__detail-block li code.is-link { cursor: pointer; color: #7dd3fc; }
.arch__detail-block li code.is-link:hover { background: rgba(56,189,248,.14); }
.arch-muted { color: #64748b; font-size: 12px; margin: 0; }

.arch-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 600; }
.arch-badge--ok { background: rgba(34,197,94,.14); color: #4ade80; }
.arch-badge--review { background: rgba(245,158,11,.16); color: #fbbf24; }

.arch-risk-pill { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.arch-risk-pill.arch-risk--low { background: rgba(34,197,94,.16); color: #4ade80; }
.arch-risk-pill.arch-risk--medium { background: rgba(245,158,11,.16); color: #fbbf24; }
.arch-risk-pill.arch-risk--high { background: rgba(249,115,22,.18); color: #fb923c; }
.arch-risk-pill.arch-risk--critical { background: rgba(239,68,68,.2); color: #f87171; }

.arch__error { color: #f87171; padding: 24px; }

.arch__state { font-weight: 600; }
.arch__state--ok { color: #4ade80; }
.arch__state--unavailable { color: #94a3b8; }
.arch-badge--na { background: rgba(148,163,184,.14); color: #94a3b8; }

/* Riesgos: high/critical más destacados (además de color, tamaño y borde). */
.arch__graph-wrap[data-view="risks"] .arch-node--module.arch-risk--high .arch-node__circle { stroke-width: 2.6; }
.arch__graph-wrap[data-view="risks"] .arch-node--module.arch-risk--critical .arch-node__circle { stroke-width: 3; }
.arch__graph-wrap[data-view="risks"] .arch-node--module.arch-risk--low .arch-node__circle { opacity: .6; }

@media (prefers-reduced-motion: reduce) {
  .arch-node circle, .arch-node__label, .arch-edge { transition: none !important; }
}

/* ── Responsive ── */
@media (max-width: 1020px) {
  .arch__body { grid-template-columns: 1fr; }
  .arch__detail { position: static; }
  .arch__detail-card { max-height: none; }
  .arch-node__label { display: none; }
}

