/* HCGPT-CAR-003 / HCGPT-CRS-003: upload preview owner (chat-media) */

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-image-preview-box {
    display: none !important;
    position: absolute !important;
    top: 21px !important;
    left: 31px !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    z-index: 15 !important;
    width: 60px !important;
    height: 60px !important;
    text-align: left !important;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-image-preview-box.active {
    display: block !important;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-image-preview-box img {
    display: block !important;
    margin: 0 !important;
    width: 60px !important;
    height: 60px !important;
    object-fit: cover !important;
    border-radius: 6px !important;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-image-preview-box #hcgpt-remove-image {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    width: 24px !important;
    height: 24px !important;
    background: #e1e1e1b4 !important;
    color: #dc3545 !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    font-size: var(--hcgpt-font-size-18) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 30 !important;
    padding: 0 !important;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-image-preview-box #hcgpt-remove-image:hover {
    background: #e1e1e1b4 !important;
    color: #a80000 !important;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-image-upload {
    display: none;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-visually-hidden-file {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    border: 0 !important;
    opacity: 0 !important;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) #hcgpt-image-previews {
    position: absolute !important;
    top: 15px !important;
    left: 31px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    z-index: 1002 !important;
    pointer-events: auto !important;
    max-width: calc(100% - 30px) !important;
    opacity: 1 !important;
    visibility: visible !important;
    height: auto !important;
    min-height: 0 !important;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-preview {
    position: relative !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    min-height: 96px !important;
    min-width: 96px !important;
    width: 96px !important;
    height: 96px !important;
    background: #f6f7f8 !important;
}

@media (max-width: 767.98px) {
    :where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-preview {
        min-height: 72px !important;
        min-width: 72px !important;
        width: 72px !important;
        height: 72px !important;
    }
}

@media (max-width: 480px) {
    :where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-preview {
        min-height: 60px !important;
        min-width: 60px !important;
        width: 60px !important;
        height: 60px !important;
    }

    :where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-preview .hcgpt-remove-image {
        opacity: 1 !important;
        width: 28px !important;
        height: 28px !important;
        font-size: var(--hcgpt-font-size-18) !important;
    }
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-preview.is-loading {
    background: linear-gradient(90deg, #f6f7f8 25%, #edeef1 37%, #f6f7f8 63%) !important;
    background-size: 400% 100% !important;
    animation: hcgpt-chat-media-skeleton 1.2s ease-in-out infinite !important;
}

@keyframes hcgpt-chat-media-skeleton {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: 0 0;
    }
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-preview > img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-preview.is-loading > img {
    opacity: 0 !important;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-preview.is-loaded > img {
    opacity: 1 !important;
    transition: opacity 0.2s ease-in-out;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-preview .hcgpt-remove-image {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
    width: 26px !important;
    height: 26px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    background: rgba(255, 255, 255, 0.9) !important;
    color: #d32f2f !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: var(--hcgpt-line-height-100) !important;
    padding: 0 !important;
    cursor: pointer !important;
    opacity: 0 !important;
    transform: scale(0.96);
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease, color 0.18s ease !important;
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-preview.is-loaded .hcgpt-remove-image {
    opacity: 1 !important;
    transform: scale(1);
}

:where(#hcgpt-unified-chat-wrapper, .hcgpt-scope) .hcgpt-preview .hcgpt-remove-image:hover {
    background: rgba(255, 255, 255, 1) !important;
    color: #b71c1c !important;
}
