/* ============================================================
   Neural Pathways Feedback Panel
   Click-through feedback trees visualized as a neural network.
   FAB morph overlay — expands from button position.
   ============================================================ */

/* ---------- Anchor container ---------- */
.np-anchor {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1090;
    pointer-events: none;
}
.np-anchor > * {
    pointer-events: auto;
}

/* ---------- FAB ---------- */
.np-fab {
    position: relative;
    z-index: 2;
    margin-left: auto;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.35);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.25s ease,
                opacity 0.2s ease 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.np-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(16, 185, 129, 0.5);
}
.np-fab:focus-visible {
    outline: 2px solid #10B981;
    outline-offset: 3px;
}
.np-fab[aria-expanded="true"] {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.6);
}

/* ---------- Panel (overlay morph) ---------- */
.np-panel {
    position: absolute;
    bottom: 0;
    right: 0;
    z-index: 1;
    width: 340px;
    max-height: 70vh;
    background: rgba(12, 12, 20, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 16px;
    transform: scale(0);
    transform-origin: bottom right;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.25s ease;
    display: flex;
    flex-direction: column;
    color: rgba(220, 230, 240, 0.85);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5),
                0 0 1px rgba(16, 185, 129, 0.2);
}
.np-panel--open {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.np-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(16, 185, 129, 0.12);
    flex-shrink: 0;
}
.np-panel__title {
    font-size: 16px;
    font-weight: 600;
    color: #10B981;
    letter-spacing: 0.3px;
    margin: 0;
}
.np-panel__subtitle {
    font-size: 12px;
    color: rgba(220, 230, 240, 0.35);
    margin: 0;
    font-weight: 400;
    letter-spacing: 0.2px;
}
.np-panel__close {
    background: none;
    border: none;
    color: rgba(220, 230, 240, 0.5);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}
.np-panel__close:hover {
    color: #fff;
}

/* SVG container */
.np-panel__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 185, 129, 0.25) transparent;
}
.np-panel__body::-webkit-scrollbar { width: 5px; }
.np-panel__body::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.25);
    border-radius: 3px;
}

/* SVG canvas */
.np-svg {
    width: 100%;
    min-height: 200px;
}

/* ---------- Nodes ---------- */
.np-node {
    cursor: pointer;
}
.np-node__body {
    fill: var(--np-fill, rgba(107, 114, 128, 0.15));
    stroke: none;
    stroke-width: 0;
    rx: 12;
    ry: 12;
    filter: drop-shadow(0 2px 8px var(--np-glow, rgba(0, 0, 0, 0.3)));
    transition: filter 0.25s ease, fill 0.25s ease;
}
.np-node:hover .np-node__body {
    fill: var(--np-fill-hover, rgba(107, 114, 128, 0.25));
    filter: drop-shadow(0 4px 16px var(--np-glow-hover, rgba(0, 0, 0, 0.4)));
}
.np-node:focus-visible .np-node__body {
    fill: var(--np-fill-hover, rgba(107, 114, 128, 0.25));
    filter: drop-shadow(0 4px 16px var(--np-glow-hover, rgba(0, 0, 0, 0.4)));
}
.np-node__label {
    fill: rgba(255, 255, 255, 0.9);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-anchor: middle;
    pointer-events: none;
}

/* Visited */
.np-node--visited .np-node__body {
    fill: var(--np-fill, rgba(107, 114, 128, 0.15));
    opacity: 0.4;
    stroke: none;
}
.np-node--visited .np-node__label {
    fill: rgba(220, 230, 240, 0.45);
}

/* ---------- Edges ---------- */
.np-edge {
    stroke: var(--np-edge-color, rgba(107, 114, 128, 0.25));
    stroke-width: 2;
    fill: none;
}

/* Edge pulse particle */
.np-edge-particle {
    r: 3;
}

/* ---------- Animations ---------- */
@keyframes np-node-appear {
    from { opacity: 0; transform: translateY(10px) scale(0.92); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.np-node--entering {
    animation: np-node-appear 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

@keyframes np-edge-pulse {
    0%   { offset-distance: 0%; opacity: 1; }
    100% { offset-distance: 100%; opacity: 0; }
}

@keyframes np-glow-pulse {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.3)); }
    50%      { filter: drop-shadow(0 0 12px rgba(16, 185, 129, 0.6)); }
}

/* Loading skeleton */
.np-skeleton {
    opacity: 0.35;
}
.np-skeleton circle {
    fill: rgba(16, 185, 129, 0.15);
    stroke: rgba(16, 185, 129, 0.2);
    stroke-width: 1.5;
}
@keyframes np-skeleton-pulse {
    0%, 100% { opacity: 0.25; }
    50%      { opacity: 0.5; }
}
.np-skeleton circle {
    animation: np-skeleton-pulse 1.2s ease-in-out infinite;
}

/* Completion */
.np-completion {
    text-anchor: middle;
}
.np-completion__check {
    stroke: #10B981;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
}
.np-completion--animate .np-completion__check {
    animation: np-check-draw 0.6s ease forwards 0.2s;
}
@keyframes np-check-draw {
    to { stroke-dashoffset: 0; }
}
.np-completion__text {
    fill: #10B981;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 600;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .np-panel { transition: none; }
    .np-fab { transition: none; }
    .np-node--entering { animation: none; opacity: 1; }
    .np-skeleton circle { animation: none; opacity: 0.35; }
    .np-completion--animate .np-completion__check { animation: none; stroke-dashoffset: 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
    .np-anchor {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }
    .np-panel {
        width: auto;
        left: 0;
        max-height: 85vh;
        transform-origin: bottom right;
    }
    .np-fab {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}
