/* ═══════════════════════════════════════════════════════════════════════
   Featrix Viz Core — Shared visual language for all D3 widgets.
   Keep this small: only tokens, tooltip, container, and animation base.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens (CSS custom properties) ── */
:root {
    /* Background */
    --fvz-bg:           #0a0a23;
    --fvz-bg-surface:   rgba(16, 12, 42, 0.96);
    --fvz-bg-stripe:    rgba(255, 255, 255, 0.02);
    --fvz-bg-hover:     rgba(78, 205, 196, 0.06);

    /* Primary accent */
    --fvz-cyan:         #4ecdc4;
    --fvz-cyan-dim:     rgba(78, 205, 196, 0.3);
    --fvz-cyan-faint:   rgba(78, 205, 196, 0.12);

    /* Semantic colors */
    --fvz-magenta:      #ff6b9d;
    --fvz-red:          #ff6b6b;
    --fvz-orange:       #ffaf22;
    --fvz-blue:         #45b7d1;
    --fvz-green:        #4ecdc4;
    --fvz-purple:       #9b59b6;

    /* Column type colors (match chord diagram CHORD_TYPE_COLORS) */
    --fvz-type-scalar:       #4ecdc4;
    --fvz-type-set:          #ff6b6b;
    --fvz-type-hybrid:       #45b7d1;
    --fvz-type-string:       #f7797d;
    --fvz-type-multiset:     #dda0dd;
    --fvz-type-timestamp:    #9b59b6;
    --fvz-type-phone:        #95a5a6;
    --fvz-type-email:        #e67e22;
    --fvz-type-json:         #1abc9c;
    --fvz-type-vector:       #3498db;

    /* Text */
    --fvz-text:         #e0e0e0;
    --fvz-text-dim:     #999;
    --fvz-text-faint:   #666;
    --fvz-text-bright:  #fff;

    /* Typography */
    --fvz-font:         'SF Mono', 'Fira Code', 'Consolas', monospace;
    --fvz-font-size:    12px;
    --fvz-font-size-sm: 9px;
    --fvz-font-size-xs: 8px;
    --fvz-font-size-lg: 13px;

    /* Spacing */
    --fvz-radius:       8px;
    --fvz-pad:          12px 16px;

    /* Shadows */
    --fvz-shadow:       0 8px 32px rgba(0, 0, 0, 0.6);
    --fvz-shadow-sm:    0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ── Container (wrap every widget) ── */
.fvz-container {
    background: var(--fvz-bg);
    border-radius: var(--fvz-radius);
    overflow: hidden;
    position: relative;
    font-family: var(--fvz-font);
}
.fvz-container svg {
    display: block;
    width: 100%;
    height: auto;
}

/* ── Tooltip ── */
.fvz-tooltip {
    position: fixed;
    pointer-events: none;
    background: var(--fvz-bg-surface);
    border: 1px solid var(--fvz-cyan-dim);
    border-radius: var(--fvz-radius);
    padding: var(--fvz-pad);
    font-family: var(--fvz-font);
    font-size: var(--fvz-font-size);
    color: var(--fvz-text);
    max-width: 380px;
    z-index: 100001;
    box-shadow: var(--fvz-shadow);
    line-height: 1.5;
}
.fvz-tooltip.pinned {
    pointer-events: auto;
}

/* Tooltip building blocks */
.fvz-tip-title {
    font-size: var(--fvz-font-size-lg);
    font-weight: 600;
    color: var(--fvz-cyan);
    margin-bottom: 6px;
    white-space: nowrap;
}
.fvz-tip-divider {
    border: none;
    border-top: 1px solid var(--fvz-cyan-dim);
    margin: 6px 0;
}
.fvz-tip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
.fvz-tip-label {
    color: var(--fvz-text-dim);
}
.fvz-tip-value {
    color: var(--fvz-text-bright);
    font-weight: 500;
}
.fvz-tip-section {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.fvz-tip-section-label {
    font-size: 11px;
    color: var(--fvz-orange);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

/* ── Controls bar (epoch slider, filter, etc.) ── */
.fvz-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(22, 33, 62, 0.8);
    border-bottom: 1px solid rgba(78, 205, 196, 0.15);
    font-family: var(--fvz-font);
    font-size: 11px;
    color: var(--fvz-text-dim);
    flex-wrap: wrap;
}
.fvz-controls label {
    color: var(--fvz-text-dim);
    font-size: 11px;
}
.fvz-controls input[type="range"] {
    flex: 1;
    min-width: 60px;
    max-width: 200px;
}

/* ── Buttons ── */
.fvz-btn {
    background: #16213e;
    color: var(--fvz-cyan);
    border: 1px solid #3498db;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 14px;
    font-family: var(--fvz-font);
    transition: background 0.15s, border-color 0.15s;
}
.fvz-btn:hover {
    background: #1a2744;
    border-color: var(--fvz-cyan);
}

.fvz-fullscreen-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(22, 33, 62, 0.9);
    color: var(--fvz-cyan);
    border: 1px solid rgba(78, 205, 196, 0.4);
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
    font-family: var(--fvz-font);
    z-index: 10;
    transition: background 0.15s;
}
.fvz-fullscreen-btn:hover {
    background: rgba(22, 33, 62, 1);
}

/* ── Row hover (for list-style widgets) ── */
.fvz-row:hover rect.fvz-row-bg {
    fill: var(--fvz-bg-hover);
}

/* ── Colorbar legend ── */
.fvz-colorbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 6px;
    font-size: var(--fvz-font-size-xs);
    color: var(--fvz-text-faint);
    font-family: var(--fvz-font);
}
.fvz-colorbar-gradient {
    height: 8px;
    flex: 1;
    border-radius: 2px;
    min-width: 60px;
}

/* ── Entrance animations ── */
@keyframes fvz-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes fvz-slide-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fvz-scale-in {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}
