/*
 * Styles for the reusable image upload preview component.
 * See resources/views/components/image_upload.blade.php
 * Scoped to .image-upload-* classes so it has no effect on any other markup.
 */
.image-upload-thumb {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.image-upload-img {
    display: block;
    max-width: 120px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    border: 1px solid #e0e6ed;
    border-radius: 6px;
    padding: 4px;
    background: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.image-upload-thumb:hover .image-upload-img {
    border-color: #c3cbd8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.image-upload-remove {
    position: absolute;
    top: -7px;
    right: -7px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    color: #fff;
    background: #e7515a;
    /* Ring keeps the button readable against a dark image behind it. */
    border: 1px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0.9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    transition: opacity 0.15s ease-in-out, transform 0.15s ease-in-out,
        background-color 0.15s ease-in-out;
}

/*
 * The icon needs an explicit size: the global `.fa-times` rule in app.css sets
 * 30px on the <i> itself, which the button's font-size cannot override. Without
 * this the glyph overflows the button and renders as a broken looking blob.
 */
.image-upload-remove > .fa-times {
    font-size: 10px;
    line-height: 1;
}

.image-upload-remove:hover,
.image-upload-remove:focus {
    background: #c8434b;
    opacity: 1;
    transform: scale(1.15);
}

.image-upload-remove:focus-visible {
    outline: 2px solid #4361ee;
    outline-offset: 1px;
}

/* Smaller box on phones */
@media (max-width: 575px) {
    .image-upload-img {
        max-width: 90px;
        max-height: 90px;
    }
}
