/* Nestable styles */
.dd {
    position: relative; 
    display: block; 
    margin: 0; 
    padding: 0; 
    max-width: 100%; 
    list-style: none; 
    font-size: 13px; 
    line-height: 20px;
}
.dd-list {
    display: block; 
    position: relative; 
    margin: 0; 
    padding: 0; 
    list-style: none;
}
.dd-list .dd-list {
    padding-left: 30px;
}

/* Timeline styling for trip stops */
/* Instead of a continuous line with white gaps, we'll add connector lines only between items */
/* Remove the continuous vertical line */
#trip_stops_nestable .dd-list:before {
    display: none;
}

/* Line between items - appears only for non-last elements */
#trip_stops_nestable .dd-item:not(:last-child):after {
    content: '';
    position: absolute;
    top: calc(50% + 12px); /* Start from middle of current item's circle */
    bottom: -10px; /* Extend past the item's border to connect with the next item */
    left: 19px; /* Center of the 24px circle with 2px border */
    width: 2px;
    background-color: var(--bs-primary);
    z-index: 1;
}

/* Line coming from the top for all but the first item */
#trip_stops_nestable .dd-item:not(:first-child):before {
    content: '';
    position: absolute;
    top: -10px; /* Start above the item to connect with the previous item */
    height: calc(50% + 22px); /* Reach the middle of the current item's circle */
    left: 19px; /* Center of the 24px circle with 2px border */
    width: 2px;
    background-color: var(--bs-primary);
    z-index: 1;
}

/* When there's only one item - no lines */
#trip_stops_nestable .dd-item:only-child:after,
#trip_stops_nestable .dd-item:only-child:before {
    display: none;
}
#trip_stops_nestable .dd-item .dd-handle {
    padding-left: 50px;
}
.dd-item {
    display: block; 
    position: relative; 
    margin: 0; 
    padding: 0; 
    min-height: 20px; 
    font-size: 13px; 
    line-height: 20px;
}

.dd-handle {
    display: block; 
    margin: 5px 0; 
    padding: 10px; 
    text-decoration: none; 
    background: var(--bs-tertiary-bg); 
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius); 
    box-sizing: border-box;
}
.dd-handle:hover {
    background: var(--bs-body-bg);
}
.dd-item > button {
    position: relative; 
    cursor: pointer; 
    float: left; 
    width: 25px; 
    height: 20px; 
    margin: 5px 0; 
    padding: 0; 
    text-indent: 100%; 
    white-space: nowrap; 
    overflow: hidden; 
    border: 0; 
    background: transparent; 
    font-size: 12px; 
    line-height: 1; 
    text-align: center; 
    font-weight: bold;
}
.dd-item > button:before {
    content: '+'; 
    display: block; 
    position: absolute; 
    width: 100%; 
    text-align: center; 
    text-indent: 0;
}
.dd-item > button[data-action="collapse"]:before {
    content: '-';
}
/* Fix for drag-and-drop placeholder */
.dd-dragel {
    position: absolute; 
    pointer-events: none; 
    z-index: 9999;
}
.dd-dragel > .dd-item .dd-handle {
    margin-top: 0;
}
.dd-dragel .dd-handle {
    box-shadow: var(--bs-box-shadow-sm);
}
.dd-placeholder {
    display: block; 
    position: relative; 
    margin: 0; 
    padding: 0; 
    min-height: 20px; 
    background: var(--bs-secondary-bg-subtle); 
    border: 1px dashed var(--bs-border-color); 
    box-sizing: border-box;
}