/*
 * FileHolder styles — self-hosted replacement for the dead vendor CDN stylesheet.
 *
 * Class names match what the app's own page CSS already targets, so existing
 * overrides keep working:
 *   .fileholder
 *   .fileholder-files-view-wrp (+ .accept-single-file / .fileholder-perview-single)
 *   .fileholder-single-file-view
 *
 * No @import and no webfont: the old stylesheet pulled Google Fonts, which is one
 * more remote dependency for something that must work offline on the server.
 */

.fileholder {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px dashed rgba(128, 139, 160, 0.55);
    border-radius: 10px;
    background: rgba(128, 139, 160, 0.06);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.fileholder.is-dragover {
    border-color: #4c6fff;
    background: rgba(76, 111, 255, 0.1);
}

/* The real input stays in the form so the file is still submitted and validated —
   it is only taken out of the visual flow. */
.fileholder .fileholder-native-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.fileholder-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 84px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    color: inherit;
    opacity: 0.9;
}

.fileholder-drop:focus-visible {
    outline: 2px solid #4c6fff;
    outline-offset: 2px;
}

.fileholder-drop__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 20px;
    line-height: 1;
    border-radius: 50%;
    border: 1px solid rgba(128, 139, 160, 0.55);
}

.fileholder-drop__text {
    font-size: 13px;
}

.fileholder-files-view-wrp {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.fileholder-files-view-wrp:empty {
    display: none;
}

.fileholder-single-file-view {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 120px;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(128, 139, 160, 0.35);
    background: rgba(17, 24, 39, 0.04);
}

.fileholder-single-file-view.is-error {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.08);
}

.fileholder-single-file-view__body {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 72px;
    overflow: hidden;
    border-radius: 6px;
    background: rgba(128, 139, 160, 0.14);
}

.fileholder-single-file-view__body img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fileholder-single-file-view__ext {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0.75;
}

.fileholder-single-file-view__name {
    font-size: 11px;
    line-height: 1.3;
    word-break: break-all;
    opacity: 0.85;
}

.fileholder-single-file-view__status {
    font-size: 10px;
    line-height: 1.3;
    opacity: 0.8;
}

.fileholder-single-file-view.is-error .fileholder-single-file-view__status {
    color: #dc3545;
    opacity: 1;
}

.fileholder-single-file-view__remove {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 15px;
    line-height: 20px;
    color: #fff;
    cursor: pointer;
    background: #dc3545;
    border: 0;
    border-radius: 50%;
}

/* Single-file fields render one large tile. The app's own page CSS sizes these
   further (see homepage-phone-banner), which is why the hooks are kept. */
.fileholder-files-view-wrp.accept-single-file,
.fileholder-files-view-wrp.fileholder-perview-single {
    display: block;
}

.fileholder-files-view-wrp.accept-single-file .fileholder-single-file-view,
.fileholder-files-view-wrp.fileholder-perview-single .fileholder-single-file-view {
    width: 100%;
}

.fileholder-files-view-wrp.accept-single-file .fileholder-single-file-view__body,
.fileholder-files-view-wrp.fileholder-perview-single .fileholder-single-file-view__body {
    height: 100%;
    min-height: 120px;
}

@media (prefers-color-scheme: dark) {
    .fileholder-single-file-view {
        background: rgba(255, 255, 255, 0.04);
    }
}
