/* List Management Section */
.list-management-container {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #eee;
}

.list-group {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.list-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.list-group-item:hover,
.list-group-item.active {
    background-color: #e9ecef;
}

.list-group-item .badge {
    font-size: 12px;
}

#create-list-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

#create-list-form .form-control {
    flex: 1;
    height: 36px;
    font-size: 14px;
}

#create-list-form .btn {
    height: 36px;
    padding: 6px 12px;
    font-size: 14px;
    white-space: nowrap;
}

/* Rank Item Checkbox */
.rank-item-checkbox {
    margin-right: 15px;
    display: flex;
    align-items: center;
}

.rank-item-select {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Add to List Dropdown */
#add-to-list-container {
    display: none;
    /* Initially hidden */
}

.dropdown-item {
    cursor: pointer;
}

/* New List Management UI */
.list-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.list-controls #list-filter-select {
    flex-grow: 1;
    height: 36px;
    font-size: 14px;
}

.list-controls .btn {
    height: 36px;
    padding: 6px 12px;
    font-size: 14px;
    white-space: nowrap;
}

/* Fixed "Add to List" Button */
#add-to-list-fixed-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background-color: #0d6efd;
    /* Blue color */
}

#add-to-list-fixed-btn:hover {
    background-color: #0b5ed7;
}

/* Modal Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1050;
}

.popup-overlay.show {
    display: flex;
}

.popup-content {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.popup-close:hover {
    color: #333;
}

.popup-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

#modal-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px 0;
}

#modal-list-container .list-group-item {
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px 16px;
    background-color: #fff;
    transition: all 0.2s ease;
    text-decoration: none;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    text-align: center;
    min-height: 50px;
}

#modal-list-container .list-group-item:hover {
    background-color: #f8f9fa;
    border-color: #0d6efd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: #0d6efd;
}

#modal-list-container .list-group-item:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#modal-list-container .add-new-list-btn {
    font-size: 24px;
    font-weight: bold;
    color: #03C75A;
    border-color: #03C75A;
    background-color: #fff;
}

#modal-list-container .add-new-list-btn:hover {
    background-color: #03C75A;
    color: #fff;
    border-color: #03C75A;
}

/* 새로 추가된 리스트 하이라이트 */
#modal-list-container .list-group-item.newly-added {
    border-color: #03C75A;
    background-color: #f0fff4;
    animation: highlight-pulse 2s ease-in-out;
}

@keyframes highlight-pulse {
    0% { 
        background-color: #03C75A; 
        color: #fff;
        transform: scale(1.05);
    }
    50% { 
        background-color: #e8f5e8; 
        color: #03C75A;
        transform: scale(1.02);
    }
    100% { 
        background-color: #f0fff4; 
        color: #333;
        transform: scale(1);
    }
}

/* Modal Form Styles */
#create-list-form {
    display: flex;
    flex-direction: column;
}

#create-list-form .form-group {
    margin-bottom: 20px;
}

#create-list-form .form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 6px;
    border: 1px solid #ddd;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

#create-list-form .form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    outline: none;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 0;
}

.modal-buttons .btn {
    min-width: 80px;
    padding: 8px 16px;
}

/* Reorder Modal Styles */
#reorder-list-items {
    max-height: none;
    margin-bottom: 20px;
    padding-left: 0;
    list-style: none;
}

#reorder-list-items .list-group-item {
    cursor: grab;
    display: flex;
    align-items: center;
    background-color: #fff;
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 6px;
}

#reorder-list-items .list-group-item:active {
    cursor: grabbing;
    background-color: #e9ecef;
}

#reorder-list-items .list-group-item.dragging {
    opacity: 0.5;
    background: #cce5ff;
}

#reorder-list-items .drag-handle {
    margin-right: 15px;
    color: #aaa;
    font-size: 16px;
}

.reorder-modal-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 0;
}

.reorder-modal-buttons .btn {
    min-width: 80px;
    padding: 8px 16px;
}
