/* shared/css/flowchart-nodes.css — canvas, nodes, connections, linear diagram */

/* ─── Canvas container ───────────────────────────────────────────────── */

.fc-container {
    position: relative;
    width: 100%;
    height: 70vh;
    min-height: 600px;
    background: var(--fc-bg);
    border: 1px solid var(--fc-border);
    border-radius: var(--fc-radius);
    overflow: hidden;
    cursor: grab;
    user-select: none;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.03);
}
.fc-container:active { cursor: grabbing; }

.fc-transform-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    transform-origin: 0 0;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform;
}
.fc-transform-layer.dragging { transition: none; }

.fc-svg-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    overflow: visible;
}

/* ─── Connections ────────────────────────────────────────────────────── */

.fc-line {
    stroke: var(--fc-border);
    stroke-width: 3;
    fill: none;
    transition: stroke 0.4s, stroke-width 0.4s;
}
.fc-line.active { stroke: var(--fc-primary-light); stroke-width: 4; }

/* ─── Nodes ──────────────────────────────────────────────────────────── */

.fc-node {
    position: absolute;
    width: 200px;
    padding: 1rem;
    border-radius: 10px;
    border: 2px solid var(--fc-border);
    background: var(--fc-card);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--fc-text);
    text-align: center;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transform: translate(-50%, -50%);
    cursor: pointer;
}

.fc-node.hidden {
    opacity: 0.2;
    transform: translate(-50%, -50%) scale(0.9);
    filter: blur(2px);
    box-shadow: none;
    cursor: default;
}

.fc-node.revealed {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: blur(0);
}

.fc-node.active {
    border-color: var(--fc-active);
    box-shadow: 0 0 0 4px rgba(245,158,11,0.15), 0 8px 15px rgba(245,158,11,0.2);
    background: #fffbeb;
    transform: translate(-50%, -50%) scale(1.05);
    z-index: 20;
}

.fc-node.selected {
    border-color: var(--fc-primary);
    box-shadow: 0 0 0 4px rgba(79,70,229,0.2);
}

.fc-node.correct  { border-color: var(--fc-correct);   background: #ecfdf5; color: #065f46; }
.fc-node.incorrect { border-color: var(--fc-incorrect); background: #fef2f2; color: #991b1b; }

.fc-node-content { display: flex; flex-direction: column; gap: 0.25rem; }

.fc-node-alias {
    font-size: 0.75rem;
    font-style: italic;
    opacity: 0.7;
    display: none;
}

.fc-node-wrong {
    font-size: 0.75rem;
    opacity: 0.8;
    text-decoration: line-through;
    display: none;
}
.fc-node.incorrect .fc-node-wrong { display: block; }

/* Info button (top-right corner of node) */
.fc-node-info-btn {
    position: absolute;
    top: -10px; right: -10px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--fc-primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 30;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.fc-node:hover .fc-node-info-btn,
.fc-node.selected .fc-node-info-btn { opacity: 1; }
.fc-node-info-btn:hover { transform: scale(1.2); background: var(--fc-primary-light); }

/* Mnemonic badge */
.fc-mnemonic {
    margin-top: 0.5rem;
    font-size: 0.7rem;
    background: #e0e7ff;
    color: #4338ca;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s;
}
.fc-quiz-finished .fc-node.correct .fc-mnemonic,
.fc-quiz-finished .fc-node.incorrect .fc-mnemonic {
    opacity: 0.6;
    max-height: 30px;
    margin-top: 0.5rem;
}

/* ─── Linear diagram (node info modal chain) ─────────────────────────── */

.fc-linear-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: #f1f5f9;
    border-radius: 12px;
}

.fc-linear-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.fc-linear-node {
    padding: 0.75rem 1.25rem;
    background: white;
    border: 2px solid var(--fc-border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--fc-text);
    text-align: center;
    min-width: 150px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.fc-linear-node:hover              { border-color: var(--fc-primary-light); }
.fc-linear-node.fc-linear-node-open { border-color: var(--fc-primary); background: #eef2ff; }

.fc-linear-caret {
    margin-left: 0.4rem;
    font-size: 0.75em;
    opacity: 0.45;
    vertical-align: middle;
}

.fc-linear-hint {
    font-size: 0.72rem;
    color: var(--fc-muted);
    text-align: center;
    margin: 0.5rem 0 0;
    opacity: 0.7;
}

.fc-linear-expand {
    width: 100%;
    max-width: 340px;
    background: #f8fafc;
    border: 1px solid var(--fc-border);
    border-radius: 6px;
    padding: 0.6rem 0.85rem;
    font-size: 0.82rem;
    color: var(--fc-text);
    line-height: 1.55;
    margin-top: 0.4rem;
    text-align: left;
}

.fc-linear-node.active    { border-color: var(--fc-primary);   background: #eef2ff; color: var(--fc-primary); }
.fc-linear-node.correct   { border-color: var(--fc-correct);   background: #ecfdf5; color: #065f46; }
.fc-linear-node.incorrect { border-color: var(--fc-incorrect); background: #fef2f2; color: #991b1b; }
