/* Lumen.UI.Mvc - ui-upload.css. File upload: a wrapper over FilePond (MIT). The server writes a plain box
   (Browse and "Or drop files here") that works without script; the script swaps in FilePond, styled at the
   end of this file in the theme's colours. Linked by @Html.UiStyles() so the box is complete at first paint.
   Colours come from the shared --ui-* tokens; these few are Fluent 2's own and worked out for the other themes. */

:root,
.ui-theme-fluent2 {
    --ui-upload-dash: #c7c7c7;      /* the dashed frame */
    --ui-upload-danger: #d13438;    /* refused / failed files */
    --ui-upload-success: #0e700e;   /* uploaded */
    --ui-upload-track: #e6e6e6;     /* behind the progress bar */
}

[class*="ui-theme-"]:not(.ui-theme-fluent2) {
    --ui-upload-dash: initial;
    --ui-upload-danger: initial;
    --ui-upload-success: initial;
    --ui-upload-track: initial;
}

.ui-upload {
    --up-dash: var(--ui-upload-dash, var(--ui-input-border));
    --up-danger: var(--ui-upload-danger, var(--ui-danger));
    --up-success: var(--ui-upload-success, var(--ui-success, #0e700e));
    --up-track: var(--ui-upload-track, color-mix(in srgb, var(--ui-text) 12%, var(--ui-surface)));
    --up-other: var(--ui-cal-other, var(--ui-muted));
    --up-icon: var(--ui-icon, var(--ui-muted));
    display: block;
    box-sizing: border-box;
    width: 100%;
    color: var(--ui-text);
    font-family: var(--ui-font);
    color-scheme: var(--ui-color-scheme);
}

.ui-upload *,
.ui-upload *::before {
    box-sizing: border-box;
}

.ui-upload-label {
    display: block;
    margin: 0;
    color: var(--ui-muted);
    font-size: 12px;
    line-height: 20px;
    cursor: pointer;
}

.ui-upload-message {
    margin-top: 4px;
    color: var(--up-danger);
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-line;
}

.ui-upload-message[hidden] {
    display: none;
}

.ui-upload-disabled .ui-upload-label {
    color: var(--ui-disabled);
    cursor: default;
}

/* ---------- the box ---------- */

.ui-upload-box {
    width: 100%;
    border: 1px dashed var(--up-dash);
    border-radius: 4px;
    background: var(--ui-surface);
    font-size: 16px;
    user-select: none;
}

.ui-upload-box.ui-upload-drag-hover,
.ui-upload-drag-hover:not(.ui-upload-box) {
    border-color: var(--ui-accent);
    outline: 1px dashed var(--ui-accent);
    outline-offset: -2px;
}

.ui-upload-invalid .ui-upload-box {
    border-color: var(--up-danger);
}

.ui-upload-select-wrap {
    display: flex;
    align-items: center;
    padding: 12px 0 12px 12px;
}

.ui-upload-browse {
    height: 32px;
    margin: 0;
    padding: 5px 12px;
    border: 1px solid var(--ui-input-border);
    border-radius: 4px;
    background: var(--ui-surface);
    color: var(--ui-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    vertical-align: middle;
    cursor: pointer;
}

.ui-upload-browse:hover {
    background: var(--ui-row-hover-bg);
}

.ui-upload-browse:active {
    background: var(--ui-list-selected, color-mix(in srgb, var(--ui-text) 10%, var(--ui-surface)));
}

.ui-upload-browse:focus-visible {
    outline: 0;
    box-shadow: inset 0 0 0 1px var(--ui-text), inset 0 0 0 2px var(--ui-surface);
}

.ui-upload-browse:disabled {
    border-color: var(--ui-button-disabled-bg);
    background: var(--ui-button-disabled-bg);
    color: var(--ui-disabled);
    cursor: default;
}

/* the native input: it holds the files of a form post, Browse opens it */
.ui-upload-select {
    display: inline-block;
    width: 0;
    height: 0;
    overflow: hidden;
    vertical-align: middle;
}

.ui-upload-input {
    display: block;
    width: 0;
    height: 0;
    padding: 0;
    border: 0;
    opacity: 0;
}

.ui-upload-drop {
    margin-left: 12px;
    color: var(--ui-muted);
    font-family: inherit;
    font-size: 14px;
    line-height: normal;
    vertical-align: middle;
}

.ui-upload-disabled .ui-upload-drop {
    color: var(--ui-disabled);
}

/* ---------- Clear / Upload (AutoUpload = false) ---------- */

.ui-upload-actions {
    position: relative;
    border-radius: 0 0 6px 6px;
    background: var(--ui-surface);
    text-align: right;
}

.ui-upload-action {
    height: 32px;
    margin: 8px;
    padding: 5px 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--ui-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    cursor: pointer;
}

.ui-upload-action-primary {
    color: var(--ui-accent);
}

.ui-upload-action:hover {
    background: var(--ui-row-hover-bg);
}

.ui-upload-action:focus-visible {
    outline: 0;
    box-shadow: inset 0 0 0 1px var(--ui-text), inset 0 0 0 2px var(--ui-surface);
}

.ui-upload-action:disabled,
.ui-upload-action:disabled:hover {
    background: transparent;
    color: var(--ui-disabled);
    cursor: default;
}

/* ---------- FilePond (filepond.min.css is loaded with the script) in the theme's colours ---------- */

.ui-upload .filepond--root {
    margin: 0;
    font-family: var(--ui-font);
    font-size: 14px;
}

.ui-upload .filepond--panel-root {
    border: 1px dashed var(--up-dash);
    border-radius: 4px;
    background-color: var(--ui-surface);
}

.ui-upload .filepond--drop-label {
    color: var(--ui-muted);
}

.ui-upload .filepond--label-action {
    color: var(--ui-accent);
    text-decoration-color: var(--ui-accent);
}

.ui-upload .filepond--root[data-hopper-state="drag-over"] .filepond--panel-root,
.ui-upload-drag-hover {
    border-color: var(--ui-accent);
    background-color: var(--ui-accent-soft, var(--ui-row-hover-bg));
}

/* A file of the list. */
.ui-upload .filepond--item-panel {
    border-radius: 4px;
    background-color: var(--ui-muted);
}

.ui-upload [data-filepond-item-state="processing-complete"] .filepond--item-panel {
    background-color: var(--up-success);
}

.ui-upload [data-filepond-item-state*="error"] .filepond--item-panel,
.ui-upload [data-filepond-item-state*="invalid"] .filepond--item-panel {
    background-color: var(--up-danger);
}

.ui-upload .filepond--file-action-button {
    cursor: pointer;
}

.ui-upload .filepond--file-action-button:focus-visible {
    box-shadow: 0 0 0 2px var(--ui-surface), 0 0 0 4px var(--ui-text);
}

/* ShowFileList = false: only the drop area. */
.ui-upload-nolist .filepond--list-scroller {
    display: none;
}

/* Disabled: greyed, nothing reacts. */
.ui-upload-disabled .filepond--root {
    opacity: 0.6;
    pointer-events: none;
}

.ui-upload-actions[hidden] {
    display: none;
}

/* ---------- Template / ShowImagePreview: the list of files drawn by ui-upload.js ---------- */

.ui-upload-list {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.ui-upload-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 6px 8px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: var(--ui-surface);
    color: var(--ui-text);
}

.ui-upload-item + .ui-upload-item {
    margin-top: 6px;
}

.ui-upload-item.ui-upload-templated {
    display: block;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.ui-upload-thumb {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    background: var(--ui-row-hover-bg);
}

.ui-upload-fileicon {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background: var(--ui-row-hover-bg);
    color: var(--ui-muted);
    font-size: 11px;
    font-weight: 600;
}

.ui-upload-item-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.ui-upload-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ui-upload-item-meta {
    color: var(--ui-muted);
    font-size: 12px;
}

.ui-upload-error .ui-upload-item-meta {
    color: var(--ui-danger);
}

.ui-upload-uploaded .ui-upload-item-meta {
    color: var(--ui-success, var(--ui-muted));
}

.ui-upload-item-remove {
    flex: none;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ui-muted);
    cursor: pointer;
}

.ui-upload-item-remove::before {
    content: "";
    display: block;
    width: 12px;
    height: 12px;
    margin: auto;
    background-color: currentColor;
    -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M1.5 1.5l9 9M10.5 1.5l-9 9' stroke='%23000' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
    mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M1.5 1.5l9 9M10.5 1.5l-9 9' stroke='%23000' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
}

.ui-upload-item-remove:hover,
.ui-upload-item-remove:focus-visible {
    background: var(--ui-row-hover-bg);
    color: var(--ui-text);
}
