/* Download Vault - File Manager UI (flat, compact, table view) */

.dv-wrap, .dv-fm{
    --bg: transparent;
    --panel: #ffffff;
    --line: #e6e8ee;
    --text: #0b1220;
    --muted: #6b7280;
    --hi: #6b7280;

    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial;
}

.dv-wrap *, .dv-fm *{ box-sizing: border-box; }

/* FULL WIDTH, no extra padding */
.dv-shell, .dv-panel { width: 100%; max-width: none; margin: 0; padding: 0; background: transparent; border: 0; box-shadow: none; }

/* Top bar */
.dv-fm-top{
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.dv-fm-title{
    font-size: 16px;
    font-weight: 900;
    letter-spacing: .2px;
}

.dv-fm-bc .dv-bc{
    display:flex;
    flex-wrap:wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
}
.dv-fm-bc .dv-bc a{ color: var(--text); text-decoration:none; font-weight: 700; }
.dv-fm-bc .dv-bc a:hover{ text-decoration:underline; }
.dv-fm-bc .dv-bc .sep{ color:#c5cad6; }

.dv-fm-right{
    display:flex;
    gap: 10px;
    align-items:center;
}

.dv-btn{
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    background: var(--panel);
    font-weight: 900;
    cursor:pointer;
    text-decoration:none;
    color: var(--text);
    display:inline-flex;
    align-items:center;
}
.dv-btn:hover{ background: #f6f7fb; }

.dv-fm-search{
    display:flex;
    gap: 8px;
    align-items:center;
    margin:0;
}
.dv-fm-search input{
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    background: var(--panel);
    outline:none;
    font-size: 13px;
    min-width: min(340px, 60vw);
}
.dv-fm-search input:focus{
    border-color: rgba(13,110,253,.55);
    box-shadow: 0 0 0 3px rgba(13,110,253,.12);
}
.dv-fm-search button{
    height: 34px;
    padding: 0 10px;
    color: var(--text);
    border: 1px solid var(--line);
    background: var(--panel);
    font-weight: 900;
    cursor:pointer;
}
.dv-fm-search button:hover{ background: #f6f7fb; }

/* Body layout */
.dv-fm-body{
    display:grid;
    grid-template-columns: 260px 1fr;
    gap: 16px;
    padding: 14px 0 0;
}

@media (max-width: 900px){
    .dv-fm-body{ grid-template-columns: 1fr; }
}

/* Sidebar */
.dv-fm-sidebar{
    border: 1px solid var(--line);
    background: var(--panel);
    padding: 10px;
}

.dv-fm-shead{
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 900;
    padding: 4px 2px 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
}

.dv-tree{
    display:flex;
    flex-direction:column;
    gap: 2px;
    max-height: 65vh;
    overflow-y:auto;
    overflow-x:hidden;
    padding-right: 2px;
}

.dv-tree-item{
    display:flex;
    align-items:center;
    gap: 8px;
    padding: 7px 8px;
    text-decoration:none;
    color: var(--text);
    font-size: 13px;
}
.dv-tree-item:hover{ background:#f6f7fb; }
.dv-dot{
    width: 8px;
    height: 8px;
    border: 1px solid var(--line);
    background: #f1f5ff;
    flex: 0 0 auto;
}



/* Tree nodes (collapsible) */
.dv-tree-node{ margin:0; }

/* Make the whole row (including the toggle area) feel like one hoverable item */
.dv-tree-sum{
    list-style:none;
    cursor:pointer;
    display:flex;
    align-items:center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 10px;
}
/* Hide native disclosure markers (triangle) */
.dv-tree-sum::-webkit-details-marker{ display:none; }
.dv-tree-sum::marker{ content: ""; }

/* Force-hide native disclosure marker across browsers (themes like to override this) */
.dv-tree-node > summary,
.dv-tree-sum{
    list-style: none !important;
}
.dv-tree-node > summary::-webkit-details-marker,
.dv-tree-sum::-webkit-details-marker{
    display:none !important;
}
.dv-tree-node > summary::marker,
.dv-tree-sum::marker{
    content:"" !important;
}

.dv-tree-sum:hover{ background:#f6f7fb; }
.dv-tree-sum.is-active{
    background:#eef2ff;
    border: 1px solid var(--line);
}

.dv-tree-link{
    display:flex;
    align-items:center;
    gap: 8px;
    text-decoration:none;
    color: var(--text);
    font-size: 13px;
    border-radius: 10px;
}

/* When inside <summary>, the hover/active is handled by .dv-tree-sum */
.dv-tree-sum .dv-tree-link{
    padding: 0;
    flex: 1 1 auto;
    min-width: 0;
}

/* Leaf items keep link-based hover */
.dv-tree-item.dv-tree-link:hover{ background:#f6f7fb; }
.dv-tree-item.dv-tree-link.active{
    background:#eef2ff;
    border: 1px solid var(--line);
}

.dv-tree-children{
    margin-left: 0;
    padding-left: 16px;
    border-left: 1px solid rgba(229,231,235,.9);
    display:flex;
    flex-direction:column;
    gap: 2px;
}

.dv-count{
    margin-left: auto;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width: 28px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #f6f7fb;
    color: var(--muted);
    font-weight: 900;
    font-size: 12px;
}

/* Custom chevron */
.dv-chev{
    width: 16px;
    height: 16px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex: 0 0 16px;
    color: var(--muted);
}
.dv-chev::before{
    content: "\25B6"; /* ▶ */
    font-size: 12px;
    line-height: 1;
    transform: translateX(1px);
}
.dv-tree-node[open] > .dv-tree-sum .dv-chev::before{
    transform: rotate(90deg) translateX(1px);
}

/* In leaf rows there's no chevron, so align icons */
.dv-tree-item .dv-dot{ margin-left: 16px; }
/* Main */
.dv-fm-main{
    border: 1px solid var(--line);
    background: var(--panel);
    padding: 10px;
}

.dv-fm-mhead{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding: 4px 2px 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
    font-weight: 900;
}

.dv-fm-count{
    font-size: 12px;
    color: var(--muted);
    font-weight: 800;
}

/* Table */
.dv-table-wrap{ width: 100%; overflow:auto; }

.dv-table{
    display:grid;
    grid-template-columns: 1.6fr 1.3fr .6fr .6fr;
    gap: 10px;
    align-items:center;
}

.dv-table-head{
    position: sticky;
    top: 0;
    background: var(--panel);
    z-index: 5;
    padding: 8px 8px;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--muted);
    font-weight: 900;
}

.dv-row{
    padding: 8px 8px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}
.dv-row:hover{ background: #f6f7fb; }

.dv-col-size, .dv-col-act{ justify-self:end; }
.dv-col-orig{ color: var(--muted); }

.dv-clip{
    display:inline-block;
    max-width: 100%;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    vertical-align: middle;
}

/* Download action */
.dv-dl{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--hi);
    color: var(--hi);
    text-decoration:none;
    font-weight: 900;
    font-size: 12px;
}
.dv-dl:hover{
    background: rgba(13,110,253,.08);
}

/* Empty */
.dv-fm-empty{
    color: var(--muted);
    font-size: 13px;
    padding: 10px 2px;
}
.dv-fm-empty-main{
    padding: 14px 8px;
    border-top: 1px solid var(--line);
}

/* File type badges */
.dv-file-ico{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width: 44px;
    height: 22px;
    padding: 0 6px;
    border: 1px solid var(--line);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .06em;
    margin-right: 10px;
    background: #f6f7fb;
    color: var(--text);
    vertical-align: middle;
}

.dv-ic-pdf{ border-color:#fecaca; background:#fff1f2; color:#9f1239; }
.dv-ic-zip{ border-color:#fde68a; background:#fffbeb; color:#92400e; }
.dv-ic-doc{ border-color:#bfdbfe; background:#eff6ff; color:#1d4ed8; }
.dv-ic-xls{ border-color:#bbf7d0; background:#f0fdf4; color:#166534; }
.dv-ic-ppt{ border-color:#fed7aa; background:#fff7ed; color:#9a3412; }
.dv-ic-img{ border-color:#ddd6fe; background:#f5f3ff; color:#5b21b6; }
.dv-ic-txt{ border-color:#e5e7eb; background:#f9fafb; color:#374151; }
.dv-ic-file{ border-color:#e5e7eb; background:#f9fafb; color:#111827; }

/* Safety: don’t inherit theme <pre> */
.dv-fm pre, .dv-fm code{
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    font-family: inherit !important;
    font-size: inherit !important;
}

/* ==== Download Vault: nicer folder tree (v1.0.4) ==== */
/* Panel look */
.dv-tree{
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 8px;
    max-height: 70vh;
}

/* Remove native markers, add our own */
.dv-tree summary::-webkit-details-marker{ display:none; }
.dv-tree summary{ list-style:none; }

/* Nodes */
.dv-tree-node{ margin: 0; }
.dv-tree-sum{
    display:flex;
    align-items:center;
    gap: 8px;
    border-radius: 12px;
    padding: 7px 8px;
}

/* Chevron */
.dv-tree-node > .dv-tree-sum::before{
    content: "▸";
    width: 14px;
    flex: 0 0 14px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1;
    transform-origin: 50% 50%;
    transition: transform .12s ease;
}
.dv-tree-node[open] > .dv-tree-sum::before{
    transform: rotate(90deg);
}

/* Leaf items should align with chevron width */
.dv-tree-item::before{
    content: "";
    width: 14px;
    flex: 0 0 14px;
}

/* Folder glyph */
.dv-dot{
    width: 14px;
    height: 11px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    border-radius: 3px;
    position: relative;
    flex: 0 0 auto;
}
.dv-dot::before{
    content:"";
    position:absolute;
    top: -3px;
    left: 2px;
    width: 7px;
    height: 4px;
    border: 1px solid #cbd5e1;
    border-bottom: 0;
    background: #f8fafc;
    border-radius: 3px 3px 0 0;
}

/* Links */
.dv-tree-link, .dv-tree-item{
    display:flex;
    align-items:center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border-radius: 10px;
}
.dv-tree-sum .dv-tree-link{
    padding: 0; /* padding lives on summary */
}
.dv-tree-link:hover, .dv-tree-item:hover{ background:#f6f7fb; }

/* Active state */
.dv-tree-link.active, .dv-tree-item.active{
    background: #eef2ff;
    box-shadow: inset 0 0 0 1px rgba(99,102,241,.25);
}

/* Count badge */
.dv-count{
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    min-width: 26px;
    padding: 0 7px;
    font-size: 12px;
    line-height: 1;
    color: var(--muted);
    background: #f3f4f6;
    border: 1px solid var(--line);
    border-radius: 10px;
    white-space: nowrap;
    flex: 0 0 auto;
}

/* Children indentation */
.dv-tree-children{
    margin-left: 18px;
    border-left: 1px solid rgba(229,231,235,.9);
    padding-left: 10px;
    margin-top: 2px;
    margin-bottom: 4px;
}
