/* ============================================================================
   ARROWS & CONNECTORS - Wikipedia Dark Mode Theme
   ============================================================================ */

/* === ARROWS === */
.connection-arrow {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

/* ALL ARROWS - Wikipedia style */
.connection-arrow line,
.connection-arrow polyline,
.connection-arrow path {
    stroke: #eaecf0;
    stroke-width: 2;
    fill: none;
}

.connection-arrow polygon {
    fill: #eaecf0;
}

/* Temporary drawing line */
.connection-line-temp {
    position: absolute;
    pointer-events: none;
    z-index: 999;
}

.connection-line-temp line {
    stroke: #eaecf0;
    stroke-width: 2;
    stroke-dasharray: 5, 5;
    animation: dash 0.5s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: -10;
    }
}

/* Arrow labels - GENERAL STYLE */
.arrow-label {
    position: absolute;
    background: transparent;
    color: #eaecf0;
    padding: 3px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
    z-index: 100;
    border: none;
    box-shadow: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Operation name label (at arrow start) */
.arrow-label.operation-name {
    background: transparent;
    color: #eaecf0;
    border: none;
}

/* Translation language label (at arrow end) */
.arrow-label.translation-lang {
    background: transparent;
    color: #eaecf0;
    border: none;
}

/* Similarity badges on arrows */
.similarity-badge {
    position: absolute;
    padding: 3px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
    z-index: 100;
    border: none;
    box-shadow: none;
    background: transparent;
    color: #eaecf0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.language-on-arrow {
    position: absolute;
    padding: 3px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
    z-index: 2;
    border: none;
}

.language-on-arrow.translation-language {
    background: transparent;
    color: #eaecf0;
}

/* === CONNECTORS - GOLDEN RATIO RECTANGLES === */

.connector {
    position: absolute;
    width: 10px;              /* Short side */
    height: 16px;             /* Long side (golden ratio: 10 * 1.618 ≈ 16) */
    background: transparent;
    border: 2px solid #eaecf0;
    cursor: crosshair;
    transition: all 0.15s ease;
    z-index: 10;
    box-shadow: 0 0 3px rgba(234, 236, 240, 0.4);
    /* Hidden by default */
    opacity: 0;
    pointer-events: none;
}

/* Show connectors on selected blocks/operations */
.verse-block.selected .connector,
.operation-block.selected .connector {
    opacity: 1;
    pointer-events: auto;
}

/* Show empty connectors on operations (not filled) */
.operation-block .connector:not(.filled) {
    opacity: 1;
    pointer-events: auto;
}

/* Always show connectors in active connection mode states */
.connector.half-filled {
    opacity: 1;
    pointer-events: auto;
}

/* INPUT connectors - rectangles with rounded corners */
.connector.block-connector-in,
.connector.operation-connector-in {
    border-radius: 2px;
}

/* OUTPUT connectors - rectangles with rounded corners */
.connector.block-connector-out,
.connector.operation-connector-out {
    border-radius: 2px;
}

.connector:hover:not(.disabled) {
    border-color: #eaecf0;
    box-shadow: 0 0 6px rgba(234, 236, 240, 0.7);
    z-index: 11;
}

/* State: source selected (half filled) */
.connector.half-filled {
    background: linear-gradient(to right, #eaecf0 50%, transparent 50%);
    border-color: #eaecf0;
    box-shadow: 0 0 6px rgba(234, 236, 240, 0.6);
    animation: pulse-half 1.5s infinite;
    z-index: 12;
}

/* State: connection established (fully filled) */
.connector.filled {
    background: #eaecf0;
    border-color: #eaecf0;
    box-shadow: 0 0 4px rgba(234, 236, 240, 0.5);
}

/* Disabled connector (crossed out) */
.connector.disabled {
    cursor: not-allowed;
    opacity: 0.4;
    position: relative;
}

.connector.disabled::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 2px;
    background: #ff4444;
    transform: translateY(-50%) rotate(45deg);
}

.connector.disabled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 2px;
    background: #ff4444;
    transform: translateY(-50%) rotate(-45deg);
}

@keyframes pulse-half {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 6px rgba(234, 236, 240, 0.6);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 10px rgba(234, 236, 240, 0.8);
    }
}

/* Numbered connectors for merge operation */
.connector.numbered {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: bold;
    color: #000;
    text-shadow: none;
}

/* Container for multiple input connectors */
.merge-connectors-container {
    position: absolute;
    left: -14px;  /* -(CONNECTOR_WIDTH + CONNECTOR_OFFSET + border) = -(10 + 2 + 2) */
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: flex-start;
    padding: 12px 0;
}