/* File tree: toolbar, breadcrumbs, the listing as table or grid, the loading skeleton. */

/* Toolbar + Breadcrumbs */
.toolbar { display: flex; align-items: center; gap: 8px; margin: 6px 0 14px; min-height: 40px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; font-size: 18px; font-weight: 600; min-width: 0; flex-wrap: wrap; color: rgb(var(--fg)); }
.crumbs a, .crumbs span { padding: 4px 8px; border-radius: 8px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--muted); font-weight: 500; }
.crumbs a:hover { background: var(--hover); color: var(--text); }
.crumbs .sep { color: var(--faint); padding: 0; }
.crumbs .sep svg { width: 16px; height: 16px; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--divider); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; width: 40px; height: 36px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--selected); color: rgb(var(--fg)); }
.seg svg { width: 18px; height: 18px; }

/* File list */
.files { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--divider); border-radius: 16px; overflow: hidden; }
.files tbody tr:last-child td { border-bottom: 0; }
.files th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--divider); white-space: nowrap; }
.files td { padding: 0 12px; height: 52px; border-bottom: 1px solid var(--divider); white-space: nowrap; }
.files tr.row { cursor: pointer; }
.files tr.row:hover td { background: var(--hover); }
.files td.name { width: 100%; max-width: 0; }
.files .name-cell { display: flex; align-items: center; gap: 14px; min-width: 0; }
.files .name-cell span { overflow: hidden; text-overflow: ellipsis; font-weight: 500; color: rgb(var(--fg)); }
.files .name-cell small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.files .name-stack { display: flex; flex-direction: column; min-width: 0; }
.files td.meta { color: var(--muted); font-size: 13px; }
.files td.act { width: 1%; text-align: right; }
.files td.act .icon-btn { opacity: 0; width: 34px; height: 34px; }
.files tr.row:hover td.act .icon-btn, .files td.act .icon-btn:focus { opacity: 1; }

.ficon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.ficon svg { width: 20px; height: 20px; }
.ficon.dir { background: rgb(var(--primary) / .18); color: rgb(var(--primary-dark)); }
.ficon.dir svg { fill: rgb(var(--primary) / .55); stroke: rgb(var(--primary-dark)); }
.ficon.image { color: #d6336c; }
.ficon.video { color: #7a55ea; }
.ficon.audio { color: #e8590c; }
.ficon.pdf { color: #e03131; }
.ficon.doc { color: #1c7ed6; }
.ficon.sheet { color: #2b8a3e; }
.ficon.code { color: var(--muted); background: var(--inset); }
.ficon.archive { color: #b7791f; }
.ficon.file, .ficon.link { background: var(--inset); color: var(--muted); }
.ficon.image, .ficon.video, .ficon.audio, .ficon.pdf, .ficon.doc, .ficon.sheet, .ficon.archive { background: color-mix(in srgb, currentColor 13%, transparent); }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.grid .tile { border: 1px solid var(--divider); border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--surface); display: flex; flex-direction: column; }
.grid .tile:hover { box-shadow: var(--shadow); }
.tile .thumb { aspect-ratio: 4 / 3; background: var(--inset); display: grid; place-items: center; overflow: hidden; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .thumb .ficon { width: 56px; height: 56px; border-radius: 14px; }
.tile .thumb .ficon svg { width: 28px; height: 28px; }
.tile .cap { padding: 10px 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .cap small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
td.act { white-space: nowrap; }
td.act .icon-btn { display: inline-flex; }
.files tr.row:focus-visible { outline: none; }
.files tr.row:focus-visible td { background: var(--selected); }
.files tr.row:focus-visible td.act .icon-btn { opacity: 1; }

/* Skeleton: the shape of a listing while a folder loads – drawn the moment a folder is clicked */
.files.skeleton { display: block; }
.sk-row { display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 12px; border-bottom: 1px solid var(--divider); }
.sk-row:last-child { border-bottom: 0; }
.sk-ico, .sk-bar { background: var(--inset); border-radius: 8px; animation: sk 1.2s ease-in-out infinite; }
.sk-ico { width: 36px; height: 36px; border-radius: 9px; flex: none; }
.sk-bar { height: 12px; width: 38%; }
.sk-bar.w1 { width: 52%; } .sk-bar.w2 { width: 28%; }
.sk-bar.meta { width: 64px; margin-left: auto; }
@keyframes sk { 50% { opacity: .55; } }
.loading-hint { padding: 14px 4px; font-size: 13px; min-height: 1em; }
@media (prefers-reduced-motion: reduce) { .sk-ico, .sk-bar { animation: none; } }
@media (max-width: 860px) {
  .files th.hide-m, .files td.hide-m { display: none; }
  .files td.act .icon-btn { opacity: 1; }
  .toolbar { flex-wrap: nowrap; }
  .crumbs { flex-wrap: nowrap; overflow: hidden; }
  .crumbs a, .crumbs span { max-width: 140px; }
  .crumbs > :not(:nth-last-child(-n+3)) { display: none; }
  .crumbs { font-size: 16px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
