/* BUNFILE user file manager — isolated contract */

.bun-myfiles {
    --mf-accent: #1598b8;
    --mf-blue: #1677f2;
    --mf-green: #16a365;
    --mf-red: #dc3545;
    --mf-text: #16213a;
    --mf-muted: #718096;
    --mf-line: #e3e9f0;
    --mf-soft: #f6f8fb;
    width: min(1240px, calc(100% - 40px));
    margin: 34px auto 64px;
    color: var(--mf-text);
}

.bun-myfiles *,
.bun-myfiles *::before,
.bun-myfiles *::after {
    box-sizing: border-box;
}

.bun-myfiles-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.bun-myfiles-heading h1 {
    margin: 0 0 5px;
    color: var(--mf-text);
    font-size: clamp(28px, 3vw, 36px);
    font-weight: 750;
    letter-spacing: -0.035em;
}

.bun-myfiles-heading p {
    margin: 0;
    color: var(--mf-muted);
    font-size: 14px;
}

.bun-myfiles-usage {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-bottom: 5px;
    color: var(--mf-muted);
    font-size: 13px;
    white-space: nowrap;
}

.bun-myfiles-usage strong {
    color: var(--mf-text);
    font-weight: 700;
}

.bun-myfiles>form:first-of-type {
    margin-bottom: 16px;
}

.bun-myfiles .bun-myfiles-toolbar {
    margin: 0;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid var(--mf-line);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(23, 43, 77, 0.06);
}

.bun-myfiles .bun-myfiles-toolbar .row {
    justify-content: space-between;
}

.bun-myfiles .bun-myfiles-toolbar .search {
    width: min(390px, 100%);
    max-width: none !important;
}

.bun-myfiles .bun-myfiles-toolbar .search-field {
    min-height: 44px;
    padding-left: 42px;
    border-color: #dbe2ea;
    border-radius: 9px;
    box-shadow: none;
}

.bun-myfiles .bun-myfiles-toolbar .btn-success {
    min-height: 44px;
    padding-inline: 18px;
    background: var(--mf-green);
    border-color: var(--mf-green);
    border-radius: 9px;
    font-weight: 650;
    box-shadow: 0 7px 15px rgba(22, 163, 101, 0.16);
}

.bun-myfiles #publish_link {
    min-height: 42px;
    padding: 10px 14px;
    color: var(--mf-blue);
    background: #fff;
    border: 1px solid #dbe2ea;
    border-radius: 9px;
    text-decoration: none;
}

.bun-myfiles .files {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--mf-line);
    border-radius: 15px;
    box-shadow: 0 12px 30px rgba(23, 43, 77, 0.07);
}

.bun-myfiles #files_list {
    overflow-x: auto;
}

.bun-myfiles #files_list>table,
.bun-myfiles #files_list .table {
    min-width: 960px;
    margin: 0;
    border: 0;
    box-shadow: none !important;
}

.bun-myfiles #files_list thead th {
    height: 56px;
    padding: 14px 16px;
    color: #667085;
    background: #f8fafc;
    border-bottom: 1px solid var(--mf-line);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
    vertical-align: middle;
}

.bun-myfiles #files_list tbody td {
    height: 58px;
    padding: 11px 16px;
    color: #24324a;
    border-color: #edf1f5;
    font-size: 13px;
    vertical-align: middle;
}

.bun-myfiles #files_list tbody tr:hover td {
    background: #f8fbfd;
}

.bun-myfiles #files_list th:nth-child(2),
.bun-myfiles #files_list td:nth-child(2) {
    width: 42%;
}

.bun-myfiles .file-name a,
.bun-myfiles .fld-name a {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    color: var(--mf-text) !important;
    text-decoration: none;
}

.bun-myfiles .files-total {
    display: inline-flex;
    width: auto;
    min-width: 20px;
    height: 20px;
    margin-left: 8px;
    padding: 0 6px;
    align-items: center;
    justify-content: center;
    color: #657386;
    background: #edf1f5;
    border-radius: 999px;
    font-size: 10px;
}


/* Premium/Public switches: preserves native checkbox and setFileFlag(). */

.bun-myfiles .form-switcher {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bun-myfiles .form-switcher input[type="checkbox"] {
    position: relative;
    width: 38px;
    height: 21px;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    background: #dfe5ec;
    border: 0;
    border-radius: 999px;
    outline: 0;
    cursor: pointer;
    transition: background-color .2s ease, box-shadow .2s ease;
}

.bun-myfiles .form-switcher input[type="checkbox"]::after {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 15px;
    height: 15px;
    content: "";
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(15, 35, 65, 0.24);
    transition: transform .2s ease;
}

.bun-myfiles .form-switcher input[type="checkbox"]:checked {
    background: var(--mf-accent);
}

.bun-myfiles .form-switcher input[type="checkbox"]:checked::after {
    transform: translateX(17px);
}

.bun-myfiles .form-switcher input[type="checkbox"]:focus-visible {
    box-shadow: 0 0 0 4px rgba(21, 152, 184, 0.16);
}

.bun-myfiles .check-radio input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--mf-blue);
}

.bun-myfiles .control-buttons {
    position: static;
    display: flex;
    min-height: 66px;
    padding: 11px 18px;
    align-items: center;
    background: #fff;
    border-top: 1px solid var(--mf-line);
    box-shadow: none;
}

.bun-myfiles .control-buttons .btn {
    border-radius: 8px;
}

.bun-myfiles .paging.bottom:empty,
.bun-myfiles .bottom-space {
    display: none;
}

.bun-myfiles .table-responsive:not(#files_list) {
    margin-bottom: 16px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--mf-line);
    border-radius: 14px;
}

@media (max-width: 991.98px) {
    .bun-myfiles {
        width: min(100% - 24px, 1240px);
        margin-top: 24px;
    }
    .bun-myfiles-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }
    .bun-myfiles .bun-myfiles-toolbar>.row {
        align-items: stretch !important;
        flex-direction: column;
    }
    .bun-myfiles .bun-myfiles-toolbar .search {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .bun-myfiles {
        width: min(100% - 16px, 1240px);
        margin: 18px auto 40px;
    }
    .bun-myfiles-heading h1 {
        font-size: 28px;
    }
    .bun-myfiles .bun-myfiles-toolbar {
        padding: 12px;
    }
    .bun-myfiles .control-buttons {
        overflow-x: auto;
    }
}


/* Folder-tree file manager layout (UI only) */

.bun-myfiles .bun-myfiles-deleted-link {
    min-height: 42px;
    padding: 9px 14px;
    border-radius: 9px;
    font-weight: 600;
}

.bun-filemanager-shell {
    display: grid;
    overflow: hidden;
    grid-template-columns: 250px minmax(0, 1fr);
    background: #fff;
    border: 1px solid var(--mf-line);
    border-radius: 15px;
    box-shadow: 0 12px 30px rgba(23, 43, 77, 0.07);
}

.bun-folder-sidebar {
    display: flex;
    min-height: 500px;
    padding: 16px 12px 14px;
    flex-direction: column;
    background: #f8fafc;
    border-right: 1px solid var(--mf-line);
}

.bun-folder-sidebar-head {
    display: flex;
    padding: 0 4px 12px 8px;
    align-items: center;
    justify-content: space-between;
}

.bun-folder-sidebar-head h2 {
    margin: 0;
    color: var(--mf-text);
    font-size: 17px;
    font-weight: 700;
}

.bun-folder-add {
    width: 34px;
    height: 34px;
    color: #344054;
    background: #fff;
    border: 1px solid #d8e0e9;
    border-radius: 8px;
    font-size: 23px;
    line-height: 1;
}

.bun-folder-tree {
    display: flex;
    gap: 4px;
    flex-direction: column;
}

.bun-folder-node {
    display: grid;
    min-height: 42px;
    padding: 8px 10px;
    padding-left: calc(10px + var(--folder-depth, 0) * 18px);
    grid-template-columns: 20px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    color: #26344d;
    border: 1px solid transparent;
    border-radius: 9px;
    text-decoration: none;
}

.bun-folder-node:hover,
.bun-folder-node.is-active {
    color: #0f6f87;
    background: #eaf7fa;
}

.bun-folder-node.is-drop-target {
    background: #e5f7fb;
    border-color: var(--mf-accent);
    box-shadow: 0 0 0 3px rgba(21, 152, 184, 0.1);
}

.bun-folder-node small {
    min-width: 21px;
    padding: 2px 6px;
    color: #718096;
    background: #e9eef4;
    border-radius: 999px;
    text-align: center;
}

.bun-folder-symbol {
    display: inline-flex;
    width: 18px;
    align-items: center;
    justify-content: center;
    color: #f4b400;
    font-size: 12px;
}

.bun-folder-symbol svg {
    display: block;
    flex: 0 0 auto;
}

.bun-folder-name {
    display: flex;
    min-width: 0;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
}

.bun-folder-pre {
    flex: 0 0 auto;
    color: #98a2b3;
    white-space: pre;
}

.bun-folder-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bun-all-files-symbol {
    color: var(--mf-accent);
}

.bun-folder-trash .bun-folder-symbol {
    color: #8a94a6;
}

.bun-folder-drop-hint {
    margin-top: auto;
    padding: 18px 10px;
    color: #718096;
    border: 1px dashed #cbd5e1;
    border-radius: 9px;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.bun-filemanager-main {
    min-width: 0;
}

.bun-filemanager-main .files {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

@media (max-width: 900px) {
    .bun-filemanager-shell {
        grid-template-columns: 1fr;
    }
    .bun-folder-sidebar {
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--mf-line);
    }
    .bun-folder-tree {
        overflow-x: auto;
        flex-direction: row;
    }
    .bun-folder-node {
        min-width: 150px;
    }
    .bun-folder-drop-hint {
        display: none;
    }
}


/* Final sidebar alignment override — keep this section last. */

.bun-myfiles .bun-folder-tree {
    display: flex;
    gap: 4px;
    flex-direction: column;
}

.bun-myfiles .bun-folder-tree>.bun-folder-node {
    display: grid !important;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px !important;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    gap: 9px;
    align-items: center;
    color: #26344d;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    text-decoration: none;
}

.bun-myfiles .bun-folder-tree>.bun-folder-node:hover,
.bun-myfiles .bun-folder-tree>.bun-folder-node.is-active {
    color: #0f6f87;
    background: #eaf7fa;
    border-color: rgba(21, 152, 184, 0.12);
}

.bun-myfiles .bun-folder-node .bun-folder-symbol {
    display: inline-flex !important;
    width: 18px;
    height: 20px;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    color: #f4b400;
}

.bun-myfiles .bun-folder-node .bun-folder-symbol svg {
    display: block;
    width: 17px;
    max-width: 17px;
    height: 17px;
}

.bun-myfiles .bun-folder-node .bun-all-files-symbol {
    color: #1598b8;
}

.bun-myfiles .bun-folder-node.bun-folder-trash .bun-folder-symbol {
    color: #8a94a6;
}

.bun-myfiles .bun-folder-node .bun-folder-label {
    display: block !important;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bun-myfiles .bun-folder-node small {
    display: inline-flex !important;
    width: auto;
    min-width: 22px;
    height: 22px;
    margin: 0;
    padding: 0 6px;
    align-items: center;
    justify-content: center;
    color: #718096;
    background: #e9eef4;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1;
}

.bun-myfiles .bun-folder-root {
    grid-template-columns: 20px minmax(0, 1fr) auto;
}

.bun-myfiles .bun-folder-trash {
    grid-template-columns: 20px minmax(0, 1fr) !important;
}

@media (max-width: 900px) {
    .bun-myfiles .bun-folder-tree {
        overflow-x: auto;
        flex-direction: row;
    }
    .bun-myfiles .bun-folder-tree>.bun-folder-node {
        min-width: 150px;
    }
}