/* Container */
.custom-image-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    margin-bottom: 0.5rem;
}

/* Image wrapper - Reduced size */
.custom-image-list-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    cursor: grab;
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    opacity: 1;
}

    .custom-image-list-item.inactive {
        opacity: 0.5;
        transition: opacity 0.2s ease-in-out;
    }

    .custom-image-list-item.removing {
        opacity: 0;
        transform: scale(0.8);
        transition: opacity 0.5s ease, transform 0.5s ease;
    }

    .custom-image-list-item:hover {
        transform: translateY(-5px) scale(1.05);
        box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
    }

    .custom-image-list-item.dragging {
        opacity: 0.8;
        transform: scale(1.1) rotate(5deg);
        box-shadow: 0 15px 20px rgba(0, 0, 0, 0.25);
        transition: transform 0.3s ease, opacity 0.3s ease;
        z-index: 100;
    }

    .custom-image-list-item.moving {
        transition: all 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    }

    .custom-image-list-item.drop-zone {
        border: 2px dashed #6a11cb !important;
        background: rgba(106, 17, 203, 0.1) !important;
        transform: scale(1.05);
    }

    /* The image */
    .custom-image-list-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    /* Added / Edited overlay & border */
    .custom-image-list-item.modified {
        border: 2px solid #198754;
        box-shadow: rgba(25,135,84, 0.35) 0px 5px 15px;
    }

        .custom-image-list-item.modified::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(25,135,84,0.1);
            pointer-events: none;
            z-index: 1;
        }

/* Delete button - smaller */
.custom-image-list-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #dc3545;
    color: white;
    font-weight: bold;
    text-align: center;
    line-height: 20px;
    font-size: 10px;
    cursor: pointer;
    z-index: 3;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

    .custom-image-list-delete:hover {
        transform: scale(1.1);
    }

/* Active toggle button - smaller */
.custom-image-list-active-toggle {
    position: absolute;
    bottom: 5px;
    left: 5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #28a745;
    color: white;
    font-weight: bold;
    text-align: center;
    line-height: 20px;
    font-size: 10px;
    cursor: pointer;
    z-index: 3;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s ease, background-color 0.3s ease;
}

    .custom-image-list-active-toggle.inactive {
        background: #6c757d;
        transition: background-color 0.5s ease-in-out;
    }

    .custom-image-list-active-toggle:hover {
        transform: scale(1.1);
    }

/* Edit button - smaller */
.custom-image-list-edit {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #17a2b8;
    color: white;
    font-weight: bold;
    text-align: center;
    line-height: 20px;
    font-size: 10px;
    cursor: pointer;
    z-index: 3;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

    .custom-image-list-edit:hover {
        transform: scale(1.1);
    }

/* Add new tile - smaller */
.custom-image-list-add {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    border: 2px dashed #999;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: #555;
    cursor: pointer;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

    .custom-image-list-add:hover {
        border-color: #6a11cb;
        color: #6a11cb;
        background: rgba(106, 17, 203, 0.05);
    }

    .custom-image-list-add.drag-over {
        border-color: #6a11cb;
        background: rgba(106, 17, 203, 0.1);
    }

    /* Hide file input */
    .custom-image-list-add input {
        display: none;
    }