/* How carrying attachments by hand looks. The behaviour is in ./AttachmentDragDrop.js. */

/* Shared attachment preview tiles used by the main UI and the shop. */
.attachment-preview {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background-color: var(--input-bg);
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.attachment-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.attachment-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    background: #000;
}

.attachment-preview .video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.attachment-preview .video-overlay .play-button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-preview .video-overlay .play-button::before {
    content: '';
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 11px solid rgba(255, 255, 255, 0.9);
    transform: translateX(1px);
}

.attachment-preview a {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-break: break-all;
    font-size: 0.7em;
}

.attachment-preview .remove-attachment {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    padding: 0;
    /* Draw the cross so it stays vertically centered regardless of the active font. */
    font-size: 0;
    line-height: 0;
}

.attachment-preview .remove-attachment::before,
.attachment-preview .remove-attachment::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 9px;
    height: 2px;
    background-color: currentColor;
}

.attachment-preview .remove-attachment::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.attachment-preview .remove-attachment::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.attachment-preview .remove-attachment:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* An attachment that can be picked up says so under the pointer. */
[data-tnx-attachment-source] [draggable="true"],
[data-tnx-attachment-draggable="1"] {
    cursor: grab;
}

[data-tnx-attachment-source] [draggable="true"]:active,
[data-tnx-attachment-draggable="1"]:active {
    cursor: grabbing;
}

/* Picked out with CTRL, and waiting to travel with the others. */
.is-tnx-attachment-selected {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

/* On its way somewhere. */
.is-tnx-attachment-group-dragging {
    opacity: 0.45;
}

/* A place that would take what is being carried. */
.is-tnx-attachment-drop-active {
    outline: 2px dashed var(--primary-color);
    outline-offset: -2px;
    background-color: color-mix(in srgb, var(--primary-color) 12%, transparent);
}

/* Where carried attachments would land: one empty outline per attachment, in the strip above the
   input, so their places are already drawn before the drop. It borrows the size and the rounding
   of a real tile from the page it is on and only trades the filling for an outline. */
.attachment-preview.is-tnx-attachment-drop-placeholder {
    background-color: transparent;
    border-style: dashed;
    border-color: var(--link-color);
    pointer-events: none;
}
