/* ============================================================
   MNEMOS — Cognitive & Linguistic Flow Visualizations
   Adapted from Blazor app.css for SPA theme variables
============================================================ */

.cognitive-flow-wrapper {
    display: flex;
    position: relative;
    gap: 0;
    min-height: 600px;
}

.cognitive-flow-container {
    flex: 1;
    position: relative;
    background: var(--bg-principal);
    border: 1px solid var(--borde);
    border-radius: 12px;
    overflow: hidden;
    min-height: 600px;
    cursor: default;
}

.cognitive-flow-container svg {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* Tooltip (hover) */
.cf-tooltip {
    position: absolute;
    max-width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--borde);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 100;
    box-shadow: 0 8px 32px var(--sombra);
}

.cf-tooltip-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--texto);
    margin-bottom: 0.3rem;
}

.cf-tooltip-theory {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--texto-secundario);
    margin-bottom: 0.4rem;
}

.cf-tooltip-desc {
    font-size: 0.8rem;
    color: var(--texto-secundario);
    line-height: 1.4;
}

/* Detail Panel (click) */
.cf-detail-panel {
    position: absolute;
    right: 0;
    top: 0;
    width: 360px;
    max-width: 40%;
    height: 100%;
    background: var(--bg-card);
    border-left: 1px solid var(--borde);
    border-radius: 0 12px 12px 0;
    padding: 1.5rem;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    box-shadow: -8px 0 32px var(--sombra);
}

.cf-detail-panel.cf-detail-visible {
    transform: translateX(0);
}

.cf-detail-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--texto-secundario);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}

.cf-detail-close:hover {
    color: var(--texto);
    background: var(--bg-input);
}

.cf-detail-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.cf-detail-title {
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    color: var(--texto);
    margin-bottom: 0.5rem;
}

.cf-detail-theory {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--texto-secundario);
    text-align: center;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.cf-detail-divider {
    height: 1px;
    background: var(--borde);
    margin: 1rem 0;
}

.cf-detail-desc {
    font-size: 0.88rem;
    color: var(--texto-secundario);
    line-height: 1.7;
}

.cf-detail-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--texto-secundario);
    margin-bottom: 0.6rem;
}

.cf-detail-usecase {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--texto-secundario);
    line-height: 1.4;
}

.cf-detail-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.cf-detail-metrics {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    color: var(--acento);
    line-height: 1.6;
    word-break: break-word;
}

.cf-detail-keyinsight {
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.1), rgba(255, 101, 132, 0.1));
    border: 1px solid rgba(108, 99, 255, 0.3);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--texto);
    line-height: 1.5;
}

.cf-detail-formula {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.78rem;
    color: #06d6a0;
    background: var(--bg-input);
    border-left: 3px solid var(--acento);
    border-radius: 0 8px 8px 0;
    padding: 0.75rem 1rem;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Legend */
.cf-legend {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 0.8rem 1.2rem;
    margin-top: 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--borde);
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--texto-secundario);
}

.cf-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cf-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.cf-legend-hint {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--texto-secundario);
}

/* SVG Animations */
@keyframes cf-pulse-opacity {
    0%, 100% { stroke-opacity: 0.15; }
    50% { stroke-opacity: 0.5; }
}

.cf-pulse-ring {
    animation: cf-node-pulse 2.5s ease-in-out infinite;
    transform-origin: center;
}

@keyframes cf-node-pulse {
    0% { opacity: 0.5; }
    50% { opacity: 0; }
    100% { opacity: 0.5; }
}

.cf-node:hover circle {
    transition: all 0.2s ease;
}

/* Responsive */
@media (max-width: 1024px) {
    .cognitive-flow-wrapper {
        flex-direction: column;
    }

    .cognitive-flow-container {
        height: 500px;
    }

    .cf-detail-panel {
        position: relative;
        width: 100%;
        max-width: 100%;
        right: auto;
        top: auto;
        height: auto;
        max-height: 400px;
        border-radius: 12px;
        border-left: none;
        border-top: 1px solid var(--borde);
    }

    .cf-detail-visible {
        display: block;
    }

    .cf-legend {
        flex-wrap: wrap;
    }

    .cf-legend-hint {
        width: 100%;
        margin-left: 0;
        text-align: center;
    }
}
