/* IVR visual builder — node + panel styling. The canvas sits in snaketrax's dark theme, so the
   default Z.Blazor.Diagrams node (tiny light box, low contrast) is hard to read. These nodes are
   larger, color-coded by type, and show id + type + a one-line preview. */

.ivr-node {
    position: relative;
    min-width: 150px;
    max-width: 220px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: #2b3a4a;
    color: #f4f7fa;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    font-family: "Segoe UI", system-ui, sans-serif;
    cursor: pointer;
    user-select: none;
    transition: box-shadow .12s ease, border-color .12s ease;
}

/* Drag-to-connect handles. The library's default port positioning is scoped to .default-node, so a
   custom node must place its own ports. Top = inbound, bottom = outbound; drag bottom → another node. */
.ivr-node .diagram-port {
    position: absolute;
    width: 13px;
    height: 13px;
    left: 50%;
    transform: translateX(-50%);
    background: #cfe0ee;
    border: 2px solid #11181f;
    border-radius: 50%;
    cursor: crosshair;
    z-index: 3;
}

.ivr-node .diagram-port.top { top: -8px; }
.ivr-node .diagram-port.bottom { bottom: -8px; }
.ivr-node .diagram-port:hover,
.ivr-node .diagram-port.has-links { background: #ffd34d; }

.ivr-node:hover {
    border-color: rgba(255, 255, 255, 0.6);
}

.ivr-node--selected {
    border-color: #ffd34d;
    box-shadow: 0 0 0 3px rgba(255, 211, 77, 0.55), 0 2px 6px rgba(0, 0, 0, 0.35);
}

.ivr-node__type {
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .85;
    font-weight: 600;
}

.ivr-node__id {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    word-break: break-word;
}

.ivr-node__preview {
    margin-top: 3px;
    font-size: 11px;
    opacity: .8;
    line-height: 1.25;
}

/* Color by node type — a left accent bar + tinted background. */
.ivr-node.ivr-say        { background: #1f3a5f; border-left: 6px solid #4a90d9; }
.ivr-node.ivr-menu       { background: #3a2b5f; border-left: 6px solid #9b6cd9; }
.ivr-node.ivr-collect    { background: #1f4f4a; border-left: 6px solid #2fb3a3; }
.ivr-node.ivr-lookup     { background: #5f4321; border-left: 6px solid #e0902f; }
.ivr-node.ivr-addtocart  { background: #2f4f24; border-left: 6px solid #6cbf4a; }
.ivr-node.ivr-pay        { background: #1f5236; border-left: 6px solid #2fbf6c; }
.ivr-node.ivr-conditional{ background: #5f5421; border-left: 6px solid #e0c92f; }
.ivr-node.ivr-transfer   { background: #1f4f5f; border-left: 6px solid #2fb3d9; }
.ivr-node.ivr-goto       { background: #3a4452; border-left: 6px solid #8a98a8; }
.ivr-node.ivr-hangup     { background: #5f2424; border-left: 6px solid #d94a4a; }

/* Flow-level language strip. */
.ivr-langbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.ivr-lang-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #26313c;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
}

.ivr-lang-chip.is-default { border-color: #ffd34d; }
.ivr-lang-code { opacity: .55; font-size: 10px; }
.ivr-lang-default { color: #ffd34d; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }

.ivr-lang-x {
    border: none;
    background: transparent;
    color: #d98a8a;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 0 0 2px;
}

.ivr-lang-x:hover { color: #ff6b6b; }

.ivr-lang-star {
    border: none;
    background: transparent;
    color: #ffd34d;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 0 0 0 2px;
}

.ivr-lang-star:hover { color: #fff0b0; }

/* "Entry point" tag in the property panel. */
.ivr-entry-tag {
    color: #7fd0a0;
    font-size: 11px;
    margin: 4px 0;
}

/* START badge on the entry node (top-left; warn badge is top-right). */
.ivr-node__start {
    position: absolute;
    top: -8px;
    left: -6px;
    background: #2fbf6c;
    color: #08231a;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 1px 5px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.ivr-voices { display: flex; flex-wrap: wrap; gap: 10px; }
.ivr-voice-row { display: flex; align-items: center; gap: 5px; }
.ivr-voice-row input { width: 190px; }

/* Add-node palette (one chip per node type, color-matched to the node accent). */
.ivr-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.ivr-palette-label {
    font-size: 11px;
    opacity: .7;
    margin-right: 2px;
}

.ivr-palette-btn {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-left-width: 4px;
    background: #2b3a4a;
    color: #f4f7fa;
    cursor: pointer;
}

.ivr-palette-btn:hover { border-color: #fff; }

.ivr-palette-btn.ivr-say        { border-left-color: #4a90d9; }
.ivr-palette-btn.ivr-menu       { border-left-color: #9b6cd9; }
.ivr-palette-btn.ivr-collect    { border-left-color: #2fb3a3; }
.ivr-palette-btn.ivr-lookup     { border-left-color: #e0902f; }
.ivr-palette-btn.ivr-addtocart  { border-left-color: #6cbf4a; }
.ivr-palette-btn.ivr-pay        { border-left-color: #2fbf6c; }
.ivr-palette-btn.ivr-conditional{ border-left-color: #e0c92f; }
.ivr-palette-btn.ivr-transfer   { border-left-color: #2fb3d9; }
.ivr-palette-btn.ivr-goto       { border-left-color: #8a98a8; }
.ivr-palette-btn.ivr-hangup     { border-left-color: #d94a4a; }

/* Link labels (transition names: digits, found/notFound, success/declined, cases). */
.ivr-link-label {
    background: #11181f;
    color: #cfe0ee;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

/* Warning badge on nodes with validation issues. */
.ivr-node__warn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #d94a4a;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Right-hand column holding the fields reference + property panels. */
.ivr-side {
    width: 340px;
    flex: 0 0 340px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: auto;
}

/* Property editor + reference panels. */
.ivr-prop-panel {
    background: #1a2530;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 12px;
}

.ivr-ref-row {
    font-size: 12px;
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ivr-insert {
    margin-top: 2px;
    font-size: 11px;
    color: #9fd0ee;
}

.ivr-issues {
    background: rgba(217, 74, 74, 0.15);
    border: 1px solid rgba(217, 74, 74, 0.5);
    border-radius: 4px;
    padding: 6px 8px;
    margin: 8px 0;
    font-size: 11px;
    color: #ffb4b4;
}

.ivr-issues > div { line-height: 1.4; }

.ivr-prop-panel h6 {
    margin: 0 0 8px;
    color: #ffd34d;
}

.ivr-prop-panel label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    opacity: .75;
    margin: 10px 0 2px;
    display: block;
}

.ivr-prop-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 4px;
}
