/* ==========================================================================
   Technology View — schematic objects, pipes, palette
   Animation is CSS only: no per-frame server work, which matters on Blazor
   Server where every render is a SignalR round trip.
   ========================================================================== */

.tv-canvas .gd-world { background-size: 20px 20px; }

/* ------------------------------------------------------------------ object */
.tv-object {
    background: transparent;
    border: 1px dashed transparent;
    border-radius: 4px;
    box-shadow: none;
    padding: 0;
    overflow: visible;
}

.tv-object:hover { border-color: rgba(21,101,192,.35); }
.tv-object.sel   { border-color: var(--rz-primary, #1565c0); border-style: solid; box-shadow: none; }

.tv-object-name {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -15px;
    text-align: center;
    font-size: 10px;
    color: var(--rz-text-secondary-color, #607d8b);
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-shape { display: block; width: 100%; height: 100%; overflow: visible; }
.tv-part { vector-effect: non-scaling-stroke; }

/* ports sit on the shape, positioned from percentages in C# */
.tv-port { width: 12px; height: 12px; border-width: 2px; }

/* ------------------------------------------------------------------- pipes */
.tv-pipe-casing {
    fill: none;
    stroke: #90a4ae;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .45;
}

.tv-pipe {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* fluid moving in a pipe: a marching dash. GPU-composited, and it costs the
   server nothing because the value never changes — only the offset does. */
.tv-pipe.tv-flowing {
    stroke-dasharray: 10 8;
    animation: tv-flow 1s linear infinite;
}

@keyframes tv-flow { to { stroke-dashoffset: -18; } }

/* --------------------------------------------------------------- animation */
.tv-static * { animation: none !important; }

.tv-anim-flow .tv-flow {
    animation: tv-flow 1.1s linear infinite;
}

.tv-anim-spin .tv-rotor {
    transform-origin: 50% 50%;
    animation: tv-spin 1.6s linear infinite;
}

.tv-anim-spin .tv-blade {
    transform-origin: 50% 50%;
    animation: tv-spin .7s linear infinite;
}

@keyframes tv-spin { to { transform: rotate(360deg); } }

.tv-anim-blink .tv-indicator,
.tv-blink .tv-indicator {
    animation: tv-blink 1s steps(2, end) infinite;
}

@keyframes tv-blink { 50% { opacity: .25; } }

.tv-anim-pulse .tv-indicator {
    animation: tv-pulse 1.4s ease-in-out infinite;
}

@keyframes tv-pulse { 50% { opacity: .45; } }

.tv-anim-level .tv-level,
.tv-anim-none .tv-level { transition: y .5s ease, height .5s ease; }

.tv-fillbar { transition: width .4s ease; }

.tv-anim-slide .tv-indicator { transition: cx .25s ease; }

/* ----------------------------------------------------------------- palette */
.tv-palette { padding: .5rem; }

.tv-cat {
    margin: .7rem 0 .3rem;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
}

.tv-cat-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
    gap: .4rem;
}

.tv-lib-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    padding: .35rem .2rem;
    border: 1px solid var(--rz-border-color, #e0e0e0);
    border-radius: 5px;
    background: var(--rz-base-100, #fff);
    cursor: grab;
    user-select: none;
    transition: box-shadow .12s, border-color .12s;
}

.tv-lib-item:hover { border-color: var(--rz-primary, #1565c0); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.tv-lib-item:active { cursor: grabbing; }

.tv-lib-preview { width: 46px; height: 38px; pointer-events: none; }

.tv-lib-name {
    font-size: 9px;
    line-height: 1.1;
    text-align: center;
    color: var(--rz-text-secondary-color, #607d8b);
}

/* -------------------------------------------------------------- properties */
.tv-prop-icon { width: 34px; height: 34px; flex: 0 0 34px; }

.tv-preview-box {
    height: 120px;
    margin: .4rem 0;
    padding: .4rem;
    border: 1px solid var(--rz-border-color, #e0e0e0);
    border-radius: 5px;
    background: #f7f9fa;
}

/* designer.css pins .gd-port.in to left:-7px and .out to right:-7px, which is
   right for a fixed-width workflow node. Technology ports come from percentages
   in the template, so the inline left/top must win. */
.tv-object .gd-port.in,
.tv-object .gd-port.out { left: auto; right: auto; }

/* --------------------------------------------------------- port affordance
   Ports must be findable before you can connect anything. They stay faint
   until the object is hovered, then become obvious targets. */

.tv-object .gd-port {
    width: 13px;
    height: 13px;
    border: 2px solid #0277bd;
    background: #fff;
    opacity: .35;
    transition: opacity .12s, transform .12s, background .12s;
}

.tv-object:hover .gd-port,
.tv-object.sel .gd-port { opacity: 1; }

.tv-object .gd-port:hover {
    background: #0277bd;
    transform: scale(1.35);
}

/* while a link is being dragged, every landing port lights up green */
.gd-linking .tv-object .gd-port.in { opacity: 1; border-color: #2e7d32; }
.gd-linking .tv-object .gd-port.in.drop-ok { background: #2e7d32; transform: scale(1.4); }

/* the canvas shows the link cursor throughout the gesture */
.gd-linking .tv-canvas { cursor: crosshair; }

/* ------------------------------------------------------------ pipe styling
   Closer to the Gardener screen: a grey casing with the medium running
   inside it, rather than a single coloured stroke. */

.tv-pipe-casing { opacity: .7; stroke: #b0bec5; }
