/* brain-widget — estilos del shell, toolbar, side panel y chips. */

.brain-root {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    color: rgba(255, 255, 255, 0.92);
    font-family: ui-monospace, "JetBrains Mono", monospace;
    overflow: hidden;
    position: relative;
}

.brain-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(var(--accent-rgb, 123, 211, 234), 0.15);
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
}

.brain-search {
    flex: 0 0 200px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(var(--accent-rgb, 123, 211, 234), 0.25);
    color: rgba(255, 255, 255, 0.95);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
}
.brain-search:focus {
    border-color: rgba(var(--accent-rgb, 123, 211, 234), 0.7);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb, 123, 211, 234), 0.15);
}

.brain-cat-chips, .brain-tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
}
.brain-tag-chips {
    max-height: 56px;
    overflow-y: auto;
}

.brain-chip {
    --c: #888;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    padding: 3px 8px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 10.5px;
    cursor: pointer;
    transition: all 120ms ease;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.brain-chip:hover {
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.3);
}
.brain-chip.active {
    background: color-mix(in srgb, var(--c, #888) 18%, transparent);
    border-color: var(--c, #888);
    color: var(--c, #fff);
    box-shadow: 0 0 8px color-mix(in srgb, var(--c, #888) 35%, transparent);
}
.brain-chip-tag {
    --c: rgba(123, 211, 234, 0.8);
    text-transform: lowercase;
}
.brain-chip-tag.active {
    color: rgba(123, 211, 234, 1);
    border-color: rgba(123, 211, 234, 0.7);
    background: rgba(123, 211, 234, 0.12);
}
.brain-chip-n {
    margin-left: 5px;
    opacity: 0.55;
    font-size: 9.5px;
}

.brain-actions {
    display: flex;
    gap: 4px;
    flex: 0 0 auto;
}
.brain-act {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.75);
    width: 28px; height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 120ms ease;
}
.brain-act:hover {
    color: rgba(123, 211, 234, 1);
    border-color: rgba(123, 211, 234, 0.6);
}
.brain-act.off {
    opacity: 0.35;
}
.brain-act.active {
    background: rgba(123, 211, 234, 0.22);
    border-color: rgba(123, 211, 234, 0.85);
    color: rgba(123, 211, 234, 1);
    box-shadow: 0 0 8px rgba(123, 211, 234, 0.35);
}
.brain-act-sep {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 4px;
    align-self: center;
}

/* Modo pantalla completa del HoloModal. Lo añade brain-widget al modalEl
 * cuando el usuario pulsa ⛶ o cuando se abre desde "🧠 Ver grafo".
 *
 * `position: fixed` es relativo al viewport (no al .stage), que es lo que
 * queremos: ocupar la pantalla entera independientemente del contenedor.
 */
.holo-modal.holo-modal-fullscreen {
    position: fixed !important;
    top: 4vh !important;
    left: 2vw !important;
    right: 2vw !important;
    bottom: 4vh !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    transform: none !important;
    margin: 0 !important;
    z-index: 50 !important;
}
.holo-modal.holo-modal-fullscreen .holo-content {
    width: 100% !important;
    height: 100% !important;
    display: flex;
    flex-direction: column;
}
.holo-modal.holo-modal-fullscreen .holo-body {
    flex: 1 1 auto !important;
    height: auto !important;
    overflow: hidden;
}

.brain-stage {
    flex: 1 1 auto;
    position: relative;
    overflow: hidden;
    background: #000000;  /* Obsidian: fondo negro puro */
}
.brain-canvas {
    position: absolute;
    inset: 0;
    cursor: default;
    width: 100%;
    height: 100%;
}

.brain-hud {
    position: absolute;
    bottom: 8px; left: 10px;
    font-size: 10.5px;
    color: rgba(255, 255, 255, 0.55);
    pointer-events: none;
    background: rgba(0, 0, 0, 0.35);
    padding: 3px 8px;
    border-radius: 3px;
    backdrop-filter: blur(2px);
}
.brain-hud-stat { color: rgba(123, 211, 234, 0.85); }
.brain-hud-sep  { margin: 0 4px; opacity: 0.4; }

.brain-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.88);
    border: 1px solid rgba(123, 211, 234, 0.5);
    color: rgba(255, 255, 255, 0.95);
    padding: 5px 9px;
    border-radius: 4px;
    font-size: 11px;
    pointer-events: none;
    z-index: 10;
    max-width: 320px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
    transition: opacity 80ms;
}
.brain-tooltip-meta {
    font-size: 9.5px;
    color: rgba(123, 211, 234, 0.75);
}

/* Side panel (preview del nodo seleccionado) */
.brain-side {
    position: absolute;
    top: 0; right: 0;
    width: min(420px, 50%);
    height: 100%;
    background: rgba(4, 6, 10, 0.97);
    border-left: 1px solid rgba(123, 211, 234, 0.35);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 5;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.55);
    animation: brain-side-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes brain-side-in {
    from { transform: translateX(40px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
.brain-side[hidden] { display: none; }

.brain-side-head {
    padding: 12px 14px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-direction: column;
}
.brain-side-cat {
    --c: #888;
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--c, #888);
    border: 1px solid color-mix(in srgb, var(--c, #888) 50%, transparent);
    padding: 1px 7px;
    border-radius: 8px;
}
.brain-side-title {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.97);
    flex: 1 1 auto;
}
.brain-side-close {
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    font-size: 16px;
    align-self: flex-end;
    margin-top: -22px;
}
.brain-side-close:hover { color: rgba(255, 100, 100, 0.95); }

.brain-side-meta {
    padding: 6px 14px;
    font-size: 10.5px;
    color: rgba(255, 255, 255, 0.55);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.brain-side-tags {
    padding: 4px 14px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.brain-side-tag {
    font-size: 10px;
    color: rgba(123, 211, 234, 0.85);
    background: rgba(123, 211, 234, 0.08);
    padding: 1px 6px;
    border-radius: 8px;
    border: 1px solid rgba(123, 211, 234, 0.18);
}
.brain-side-preview {
    padding: 4px 14px 12px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.5;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.brain-side-actions {
    padding: 10px 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.brain-side-actions button {
    background: rgba(123, 211, 234, 0.12);
    border: 1px solid rgba(123, 211, 234, 0.4);
    color: rgba(123, 211, 234, 0.95);
    padding: 5px 12px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    letter-spacing: 0.4px;
}
.brain-side-actions button:hover {
    background: rgba(123, 211, 234, 0.22);
    border-color: rgba(123, 211, 234, 0.7);
}

.brain-side-full {
    padding: 14px;
    font-size: 12.5px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.85);
    flex: 1 1 auto;
    overflow-y: auto;
}
.brain-side-full[hidden] { display: none; }
.brain-side-full h1, .brain-side-full h2, .brain-side-full h3 {
    color: rgba(123, 211, 234, 0.95);
    margin-top: 16px; margin-bottom: 6px;
}
.brain-side-full h1 { font-size: 16px; }
.brain-side-full h2 { font-size: 14px; }
.brain-side-full h3 { font-size: 12.5px; }
.brain-side-full a {
    color: rgba(255, 180, 84, 0.9);
    text-decoration: none;
    border-bottom: 1px dotted rgba(255, 180, 84, 0.4);
}
.brain-side-full code {
    background: rgba(0, 0, 0, 0.45);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 91%;
    color: rgba(167, 139, 250, 0.95);
}
.brain-side-full pre {
    background: rgba(0, 0, 0, 0.55);
    padding: 8px 10px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 11px;
}
.brain-loading, .brain-empty, .brain-error {
    padding: 20px;
    text-align: center;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.55);
}
.brain-error { color: rgba(255, 130, 130, 0.85); }

/* Botón "🧠 Ver grafo" en la cabecera del modal SecondBrain (📚) */
.sb-graph-btn {
    margin-left: auto;
    background: rgba(167, 139, 250, 0.15);
    border: 1px solid rgba(167, 139, 250, 0.55);
    color: rgba(220, 200, 255, 0.95);
    padding: 5px 12px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    transition: all 130ms ease;
}
.sb-graph-btn:hover {
    background: rgba(167, 139, 250, 0.28);
    border-color: rgba(167, 139, 250, 0.9);
    color: rgba(255, 255, 255, 1);
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.45);
}

/* Bloque "Vistas y widgets" en Ajustes → Sistema */
.quick-launch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.quick-launch-row .btn {
    font-size: 11.5px;
}

/* Overlay informativo cuando el grafo está vacío o falla */
.brain-empty-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 30px 40px;
    text-align: center;
    pointer-events: none;
    background: radial-gradient(ellipse at center,
        rgba(167, 139, 250, 0.08) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: 3;
}
.brain-empty-overlay > * { pointer-events: auto; }
.brain-empty-icon {
    font-size: 56px;
    opacity: 0.9;
    filter: drop-shadow(0 0 14px rgba(167, 139, 250, 0.5));
}
.brain-empty-title {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 1px;
    font-weight: 600;
}
.brain-empty-body {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    max-width: 460px;
    line-height: 1.6;
}
.brain-empty-path {
    font-size: 11px;
    color: rgba(123, 211, 234, 0.85);
    background: rgba(0, 0, 0, 0.45);
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid rgba(123, 211, 234, 0.25);
}
.brain-empty-path code {
    font-family: ui-monospace, "JetBrains Mono", monospace;
    color: rgba(255, 200, 124, 0.9);
}
.brain-empty-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    max-width: 460px;
    line-height: 1.55;
    text-align: left;
}
.brain-empty-hint ul {
    margin: 6px 0 0 18px;
    padding: 0;
}
.brain-empty-hint li {
    margin: 3px 0;
}
.brain-empty-hint code {
    background: rgba(0, 0, 0, 0.35);
    padding: 1px 5px;
    border-radius: 3px;
    color: rgba(167, 139, 250, 0.9);
}
.brain-empty-error .brain-empty-icon {
    color: rgba(255, 130, 130, 0.95);
    filter: drop-shadow(0 0 10px rgba(255, 130, 130, 0.4));
}

/* Mini-mapa esquina inferior derecha — sutil, no llamativa */
.brain-minimap {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 160px;
    height: 100px;
    border: 1px solid rgba(180, 180, 180, 0.18);
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    cursor: crosshair;
    z-index: 4;
    background: #000;
    opacity: 0.65;
    transition: opacity 180ms ease;
}
.brain-minimap:hover {
    opacity: 1;
    border-color: rgba(180, 180, 180, 0.45);
}

/* Spinner de carga */
.brain-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 8;
    background: rgba(2, 7, 13, 0.55);
    backdrop-filter: blur(2px);
}
.brain-spinner-ring {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(123, 211, 234, 0.18);
    border-top-color: rgba(123, 211, 234, 0.95);
    border-right-color: rgba(167, 139, 250, 0.7);
    border-radius: 50%;
    animation: brain-spin 0.9s linear infinite;
    box-shadow: 0 0 20px rgba(123, 211, 234, 0.3);
}
@keyframes brain-spin {
    to { transform: rotate(360deg); }
}
.brain-spinner-text {
    font-size: 11px;
    color: rgba(123, 211, 234, 0.85);
    letter-spacing: 2px;
    text-transform: uppercase;
}
