.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.list-header fieldset {
    border: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0;
    margin: 0;
}

.list-header legend {
    font-weight: 600;
    margin-right: 0.5rem;
}

.actions-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: #fff;
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.list-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.list-controls .control-group {
    display: flex;
    flex-grow: 1;
}

.list-controls .input-field {
    border-radius: 0.5rem;
    margin-right: -1px;
}

.list-controls .control-group .btn {
    border-radius: 0 0.5rem 0.5rem 0;
}

.list-controls .control-group > *:first-child:not(:last-child) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.list-controls .control-group > *:not(:first-child):not(:last-child) {
    border-radius: 0;
    margin-right: -1px;
}

.list-utils {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}
.btn-secondary:hover:not(:disabled) {
    background-color: #4b5563;
}

.list-canvas {
    flex-grow: 1;
    background-color: #f9fafb;
    border: 2px dashed #e5e7eb;
    border-radius: 0.75rem;
    margin: 1.5rem 0;
    min-height: 250px;
    color: #9ca3af;
    font-size: 1.2rem;
    font-weight: 500;
    transition: border-color 0.3s;
    position: relative; 
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.list-description {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.8);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #4b5563;
    z-index: 100;
    backdrop-filter: blur(4px);
    border: 1px solid #e5e7eb;
    text-align: center;
}

.animation-caption {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: #f3f4f6;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    white-space: nowrap;
}

.list-description b {
    color: #1f2937;
}

.list-description span {
    font-weight: 700;
    color: #3b82f6;
}

.variable-display {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 100;
    display: flex;
    gap: 1rem;
}

.variable-box {
    text-align: center;
}

.variable-box .label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
}

.variable-box .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1f2937;
    background-color: #f3f4f6;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    min-width: 40px;
    display: inline-block;
}

.node-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem; 
    transition: transform 0.5s ease-in-out;
    position: relative;
    z-index: 5;
}

.list-node {
    background: linear-gradient(145deg, #e0f2fe, #a8d5f5);
    border: 2px solid #3b82f6;
    color: #1e3a8a;
    font-weight: 600;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.node-index {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
}

.list-pointer {
    width: 40px;
    height: 3px;
    background-color: #9ca3af;
    border-radius: 2px;
    position: relative;
    transition: all 0.3s ease, transform 0.5s ease-in-out;
}

.list-pointer::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 50%;
    transform: translateY(-50%);
    width: 0; 
    height: 0; 
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 7px solid #9ca3af;
    transition: border-color 0.3s ease;
}

.back-pointer {
    position: absolute;
    top: 30px;
    right: calc(100% + 1.5rem / 2);
    width: 40px;
    height: 3px;
    background-color: #a5b4fc;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.back-pointer::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 50%;
    transform: translateY(-50%);
    width: 0; 
    height: 0; 
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 7px solid #a5b4fc;
}
 
.pointer-broken {
    opacity: 0.2;
    background-image: repeating-linear-gradient(45deg, #d1d5db, #d1d5db 5px, transparent 5px, transparent 10px);
}
.pointer-broken::after {
    opacity: 0.2;
}


.list-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 1rem;
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    z-index: 10;
}

.null-element {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: #9ca3af;
    border: 2px dashed #d1d5db;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease, transform 0.5s ease-in-out;
}

.pending-node-container {
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 20;
}

.pending-node {
    background: linear-gradient(145deg, #fde047, #facc15);
    border-color: #eab308;
    color: #713f12;
    animation: pulse-yellow 1.5s infinite;
}

@keyframes pulse-yellow {
    0% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(234, 179, 8, 0); }
    100% { box-shadow: 0 0 0 0 rgba(234, 179, 8, 0); }
}

.pending-node-text {
    color: #4b5563;
    font-weight: 500;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.list-node.highlight {
    background: linear-gradient(145deg, #fde047, #facc15);
    border-color: #eab308;
    color: #713f12;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.3);
}

.list-node.highlight-aux {
    background: #a5f3fc;
    border-color: #0891b2;
    color: #164e63;
}
.list-node.highlight-dest {
    background: #a7f3d0;
    border-color: #059669;
    color: #064e3b;
}
.list-pointer.highlight-path-back, .back-pointer.highlight-path-back {
    animation: glow-blue-pointer 0.8s ease-in-out;
}
.back-pointer.highlight-path-back::before {
    animation: glow-blue-arrow 0.8s ease-in-out;
}


.node-wrapper.removing {
    animation: fly-out 0.5s ease-in forwards;
}

@keyframes fly-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-80px) scale(0.5);
    }
}

.insert-mode .highlight-path,
.remove-mode .highlight-path {
    animation: glow-green 0.8s ease-in-out;
}
.insert-mode .list-pointer.highlight-path,
.remove-mode .list-pointer.highlight-path {
    animation: glow-green-pointer 0.8s ease-in-out;
}
.insert-mode .list-pointer.highlight-path::after,
.remove-mode .list-pointer.highlight-path::after {
    animation: glow-green-arrow 0.8s ease-in-out;
}

.reverse-search-mode .back-pointer.highlight-path {
    animation: glow-blue-pointer 0.8s ease-in-out;
}
.reverse-search-mode .back-pointer.highlight-path::before {
    animation: glow-blue-arrow 0.8s ease-in-out;
}


@keyframes glow-green {
    0% { border-color: #3b82f6; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
    50% { border-color: #22c55e; box-shadow: 0 0 15px rgba(34, 197, 94, 0.6); }
    100% { border-color: #3b82f6; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
}
@keyframes glow-green-pointer {
    0% { background-color: #9ca3af; }
    50% { background-color: #16a34a; }
    100% { background-color: #9ca3af; }
}
@keyframes glow-green-arrow {
    0% { border-left-color: #9ca3af; }
    50% { border-left-color: #16a34a; }
    100% { border-left-color: #9ca3af; }
}

@keyframes glow-blue-pointer {
    0% { background-color: #a5b4fc; }
    50% { background-color: #4f46e5; }
    100% { background-color: #a5b4fc; }
}
@keyframes glow-blue-arrow {
    0% { border-right-color: #a5b4fc; }
    50% { border-right-color: #4f46e5; }
    100% { border-right-color: #a5b4fc; }
}

.circular-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: visible;
}
