/**
 * The look of the one file upload field (partials/file_upload + public/js/file_upload.js; owner 2026-11-04).
 * Every rule sits under .mc-file-field (set by file_upload.js), so other bootstrap-fileinput fields keep the plugin's look.
 * The picture is ALWAYS fitted inside the box, shape kept: --mc-preview-height comes from the field's preview_height.
 * A single file: no card and no caption (its name is already in the bar below), the zoom / delete buttons in the corner.
 */
.mc-file-field .file-preview {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    min-height: 72px; /* a tiny picture: the × and the zoom button never sit on each other */
    margin-bottom: 6px;
    padding: 12px 36px;
    overflow: hidden;
    background: #f7f8fa;
    border: 1px solid #dfe3e8;
    border-radius: 6px;
}
.mc-file-field .file-preview > .close.fileinput-remove {
    position: absolute;
    top: 6px;
    right: 10px;
    z-index: 2;
    float: none;
}
.mc-file-field .file-preview .file-preview-status:empty {
    display: none;
}
.mc-file-field .file-preview-thumbnails {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
    min-width: 0;
}

/* the frame: flat, never wider than the box */
.mc-file-field .file-preview-thumbnails .krajee-default.file-preview-frame,
.mc-file-field .file-preview-thumbnails .krajee-default.file-preview-frame:not(.file-preview-error):hover {
    position: relative;
    display: block;
    float: none;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}
.mc-file-field .file-preview-thumbnails .krajee-default.file-preview-frame .kv-file-content {
    width: auto !important;
    height: auto;
    max-width: 100%;
}
.mc-file-field .file-preview-thumbnails .kv-file-content img.file-preview-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: var(--mc-preview-height, 160px);
    margin: 0 auto;
    object-fit: contain;
}

/* a PDF uses the width of the box */
.mc-file-field .file-preview-thumbnails .krajee-default.file-preview-frame[data-template="pdf"] {
    width: 100%;
}
.mc-file-field .file-preview-thumbnails .kv-file-content embed {
    display: block;
    width: 100%;
}

/* other file types and the small bar under each file */
.mc-file-field .file-preview-thumbnails .krajee-default.file-preview-frame .file-thumbnail-footer {
    height: auto;
    margin-top: 4px;
}
.mc-file-field .file-preview-thumbnails .krajee-default .file-footer-caption {
    width: auto !important;
    max-width: 180px;
    margin: 0 auto 2px;
    padding-top: 0;
}

/* the plugin's "not uploaded yet" mark means nothing here: the file goes with the form's Save */
.mc-file-field .file-preview-thumbnails .file-upload-indicator {
    display: none;
}

/* a single file: the frame is first + followed only by the plugin's hidden zoom copy */
.mc-file-field .file-preview-thumbnails .krajee-default.file-preview-frame:first-child:nth-last-child(2),
.mc-file-field .file-preview-thumbnails .krajee-default.file-preview-frame:first-child:nth-last-child(2):not(.file-preview-error):hover {
    position: static;
}
.mc-file-field .file-preview-thumbnails .krajee-default.file-preview-frame:first-child:nth-last-child(2) .file-thumbnail-footer {
    position: static;
    height: 0;
    margin: 0;
}
.mc-file-field .file-preview-thumbnails .krajee-default.file-preview-frame:first-child:nth-last-child(2) .file-footer-caption {
    display: none;
}
.mc-file-field .file-preview-thumbnails .krajee-default.file-preview-frame:first-child:nth-last-child(2) .file-actions {
    position: absolute;
    right: 6px;
    bottom: 6px;
    z-index: 2;
}

/* the file name + buttons bar: never wider than the box; in a narrow column the buttons go under the name */
.mc-file-field > .input-group.file-caption-main {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}
.mc-file-field > .input-group.file-caption-main > .file-caption {
    flex: 1 1 130px;
    width: auto;
    min-width: 0;
}
.mc-file-field > .input-group.file-caption-main > .input-group-btn {
    display: flex;
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
    margin-left: auto;
}

/* a white logo: dark box, the × stays visible */
.mc-file-field.mc-file-dark .file-preview {
    background: #13284a;
    border-color: #13284a;
}
.mc-file-field.mc-file-dark .file-preview > .close.fileinput-remove {
    color: #fff;
    text-shadow: none;
    opacity: .8;
}
