/* The file browser (Controls/Files/FileBrowser): schema files and map samples. Built on the rd-* buttons and inputs and
   the rn-table, so it reads like the value map and runs pages. */

.fb {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.fb-icon {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

/* ---------------------------------------------------------------- the bar: where you are, and what you can add */

.fb-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.fb-crumbs {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 200px;
    overflow: hidden;
    font-size: 13px;
}

.fb-crumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 240px;
    height: 28px;
    padding: 0 8px;
    border: 0;
    border-radius: 7px;
    background: none;
    color: var(--xm-text-muted);
    font: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

    .fb-crumb:hover {
        background: var(--xm-surface-hover);
        color: var(--xm-text);
    }

    .fb-crumb.is-here {
        color: var(--xm-text);
        font-weight: 600;
    }

.fb-crumb-home {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

.fb-crumb-sep {
    color: var(--xm-text-muted);
    opacity: .6;
}

.fb-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.fb-filter {
    width: 190px;
    height: 28px;
    font-size: 12.5px;
}

.fb-tools .rd-btn,
.fb-selbar .rd-btn {
    gap: 6px;
}

/* The picker input covers its button, invisibly, so the button is what is clicked. */
.fb-upload {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

    .fb-upload.is-disabled {
        opacity: .55;
        pointer-events: none;
    }

.fb-upload-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ---------------------------------------------------------------- the selection bar */

.fb-selbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 7px 10px;
    border: 1px solid var(--xm-accent);
    border-radius: 10px;
    background: var(--xm-surface-hover);
}

.fb-selcount {
    margin-right: auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    color: var(--xm-text);
}

.fb-progress {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--xm-text-muted);
}

/* Something running with nothing selected (an upload, mostly): the line and how far it is. */
.fb-busy {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 7px 10px;
    border: 1px solid var(--xm-border-soft);
    border-radius: 10px;
    background: var(--xm-surface-hover);
}

/* How far an upload is. Not .fb-bar: that is the browser's toolbar, which took this shape when it was so named. */
.fb-meter {
    flex: 1 1 160px;
    max-width: 320px;
    height: 6px;
    border-radius: 999px;
    background: var(--xm-border-soft);
    overflow: hidden;
}

    .fb-meter > span {
        display: block;
        height: 100%;
        border-radius: inherit;
        background: var(--xm-accent);
        transition: width .15s linear;
    }

/* ---------------------------------------------------------------- what an upload, rename or delete left behind */

.fb-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--xm-border-soft);
    border-radius: 10px;
    background: var(--xm-surface);
    list-style: none;
    font-size: 12.5px;
}

    .fb-results li {
        display: flex;
        align-items: center;
        gap: 7px;
    }

    .fb-results li.is-ok .e-icons {
        color: var(--xm-status-success);
    }

    .fb-results li.is-failed .e-icons {
        color: var(--xm-danger, #c62828);
    }

.fb-results-close {
    justify-content: flex-end;
}

/* ---------------------------------------------------------------- the list */

.fb-list {
    position: relative;
    flex: 1;
    min-height: 220px;
    overflow: auto;
    border: 1px solid var(--xm-border-soft);
    border-radius: 12px;
    background: var(--xm-surface);
}

/* Up only while files are dragged over the list (wwwroot/js/dropzone.js adds is-drag). */
.fb-drop-input {
    position: absolute;
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.fb-list.is-drag .fb-drop-input {
    pointer-events: auto;
}

.fb-drop-hint {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 2;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--xm-accent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--xm-surface) 82%, transparent);
    color: var(--xm-accent);
    font-size: 14px;
    font-weight: 600;
}

.fb-list.is-drag .fb-drop-hint {
    display: flex;
}

.fb-table th {
    z-index: 1;
}

.fb-col-check {
    width: 34px;
    padding-right: 0 !important;
}

    .fb-col-check input {
        width: 15px;
        height: 15px;
        margin: 0;
        accent-color: var(--xm-accent);
        cursor: pointer;
        vertical-align: middle;
    }

.fb-col-size {
    width: 110px;
}

.fb-col-when {
    width: 150px;
    white-space: nowrap;
}

.fb-row {
    cursor: default;
    user-select: none;
}

    .fb-row:hover td {
        background: var(--xm-surface-hover);
    }

    .fb-row.is-selected td {
        background: color-mix(in srgb, var(--xm-accent) 10%, var(--xm-surface));
    }

    .fb-row.is-editing td {
        background: var(--xm-surface-hover);
    }

.fb-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--xm-text);
    font: inherit;
    text-align: left;
}

    .fb-name > span:not(.fb-ext) {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .fb-name.is-folder {
        font-weight: 600;
        cursor: pointer;
    }

        .fb-name.is-folder:hover > span {
            color: var(--xm-accent);
            text-decoration: underline;
        }

.fb-kind {
    width: 17px;
    height: 17px;
    flex: none;
    fill: none;
    stroke: var(--xm-text-muted);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

    .fb-kind.is-folder {
        fill: color-mix(in srgb, var(--xm-accent) 16%, transparent);
        stroke: var(--xm-accent);
    }

.fb-ext {
    flex: none;
    padding: 0 6px;
    border: 1px solid var(--xm-border-soft);
    border-radius: 999px;
    color: var(--xm-text-muted);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 17px;
    text-transform: uppercase;
}

.fb-muted {
    color: var(--xm-text-muted);
    font-size: 12px;
}

.fb-sort-mark {
    font-size: 10px;
}

.fb-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.fb-name-input {
    width: 280px;
    max-width: 100%;
    height: 28px;
    font-size: 13px;
}

.fb-foot {
    font-size: 12px;
    color: var(--xm-text-muted);
}
