/*
 * File picker for admin forms.
 *
 * Plain <input type="file"> renders the browser's own grey "Choose files"
 * control, which ignores the admin palette and speaks the browser's
 * language. js/file-input.js hides the native control and builds the
 * markup these rules describe: a button plus the name of what is chosen.
 * Fields that already have their own picker (Krajee widget, drop zones
 * wrapped in a label) are left alone by the script.
 */

.adm-file {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-width: 100%;
    vertical-align: middle;
}

/* The native control stays in the DOM — same name, same id, same
   listeners — but never shows up. */
.adm-file > input[type="file"].adm-file__native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: -1px !important;
    border: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
}

.adm-file__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 38px;
    padding: 0.45rem 0.9rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background: #ffffff;
    color: #212529;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.adm-file__btn:hover {
    border-color: #adb5bd;
    background: #e9edf2;
    color: #212529;
}

.adm-file__btn:active {
    background: #dde2e8;
}

.adm-file > input[type="file"].adm-file__native:focus + .adm-file__btn,
.adm-file__btn:focus-visible {
    outline: none;
    border-color: #cf454c;
    box-shadow: 0 0 0 3px rgba(207, 69, 76, 0.16);
}

.adm-file__btn .fa,
.adm-file__btn .fas,
.adm-file__btn .far {
    font-size: 0.9em;
    color: #7b8794;
}

.adm-file__name {
    max-width: 22rem;
    overflow: hidden;
    color: #243041;
    font-size: 0.85rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adm-file__name.is-empty {
    color: #96a0ac;
}

.adm-file__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #96a0ac;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.adm-file__clear:hover {
    background: #f2f4f6;
    color: #cf454c;
}

.adm-file__clear[hidden] {
    display: none;
}

/* Inside a narrow cell or a modal the name wraps under the button
   instead of stretching the layout. */
.adm-file--block {
    display: flex;
}

.adm-file--block .adm-file__name {
    max-width: 100%;
}

.adm-file.is-invalid .adm-file__btn {
    border-color: #cf454c;
}
