/* Sized in rem (root font = --font-size-base), like all shell chrome.
   Proportions traced from the Nautilus-on-Omarchy reference: sidebar
   ≈ 1/6 of the window, 0.5rem-radius place rows, a pill breadcrumb in
   a 3.3rem header, icon-grid cells ≈ 9rem with 4.7rem glyphs. */

.file-manager {
    height: 100%;
    display: flex;
    overflow: hidden;
    color: var(--color-foreground);
    background: color-mix(in srgb, var(--color-darker-background) 96%, transparent);
}

/* Places sidebar — a shade above the content, like Nautilus's
   translucent pane. */
.file-manager-sidebar {
    flex: none;
    width: 18rem;
    display: flex;
    flex-direction: column;
    padding: 0.6667rem;
    background: color-mix(in srgb, var(--color-background) 88%, transparent);
    overflow-y: auto;
}

.file-manager-sidebar-header {
    padding: 0.6667rem 0.8333rem 1rem;
    font-weight: 700;
    text-align: center;
}

.file-manager-places {
    margin: 0;
    padding: 0;
    list-style: none;
}

.file-manager-place {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0.8333rem;
    border-radius: 0.5rem;
    font-size: 1.0833rem;
    cursor: pointer;
    user-select: none;
}

.file-manager-place:hover {
    background: color-mix(in srgb, var(--color-foreground) 7%, transparent);
}

.file-manager-place-active {
    background: color-mix(in srgb, var(--color-foreground) 13%, transparent);
}

.file-manager-place-glyph {
    flex: none;
    width: 1.3333rem;
    text-align: center;
    color: color-mix(in srgb, var(--color-foreground) 80%, transparent);
}

.file-manager-separator {
    margin: 0.6667rem 0.8333rem;
    border-top: 1px solid color-mix(in srgb, var(--color-foreground) 12%, transparent);
}

/* Header: back/forward, the breadcrumb pill, search, view, close. */
.file-manager-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.file-manager-header {
    flex: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8333rem;
}

.file-manager-nav {
    flex: none;
    width: 2.3333rem;
    height: 2.3333rem;
    border: none;
    border-radius: 0.5rem;
    background: none;
    font-family: var(--font-mono);
    font-size: 1.1667rem;
    color: var(--color-foreground);
    cursor: pointer;
}

.file-manager-nav:hover:not(:disabled) {
    background: color-mix(in srgb, var(--color-foreground) 10%, transparent);
}

.file-manager-nav:disabled {
    opacity: 0.35;
    cursor: default;
}

.file-manager-crumbs {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.3333rem;
    height: 2.3333rem;
    padding: 0 0.8333rem;
    border-radius: 0.6667rem;
    background: color-mix(in srgb, var(--color-foreground) 8%, transparent);
    overflow: hidden;
    white-space: nowrap;
}

.file-manager-crumb {
    flex: none;
    padding: 0.1667rem 0.3333rem;
    border: none;
    border-radius: 0.3333rem;
    background: none;
    font-family: var(--font-mono);
    font-size: 1.0833rem;
    color: color-mix(in srgb, var(--color-foreground) 70%, transparent);
    cursor: pointer;
}

.file-manager-crumb:hover {
    background: color-mix(in srgb, var(--color-foreground) 10%, transparent);
}

.file-manager-crumb-current {
    color: var(--color-foreground);
    font-weight: 700;
    cursor: default;
}

.file-manager-crumb-sep {
    flex: none;
    font-size: 0.8333rem;
    color: color-mix(in srgb, var(--color-foreground) 40%, transparent);
}

.file-manager-search {
    flex: none;
    width: 16rem;
    height: 2.3333rem;
    padding: 0 0.8333rem;
    border: 2px solid var(--color-accent);
    border-radius: 0.6667rem;
    background: color-mix(in srgb, var(--color-foreground) 8%, transparent);
    color: var(--color-foreground);
    font-family: var(--font-mono);
    font-size: 1.0833rem;
    outline: none;
}

/* Content: the icon grid (or list rows) and the empty states. */
.file-manager-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1.3333rem;
}

.file-manager-entries {
    margin: 0;
    padding: 0;
    list-style: none;
}

.file-manager-entries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 0.6667rem;
}

.file-manager-entries-grid .file-manager-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6667rem;
    padding: 1rem 0.5rem;
    border-radius: 0.6667rem;
    cursor: pointer;
    user-select: none;
}

.file-manager-entries-grid .file-manager-entry-glyph {
    font-size: 4.6667rem;
    line-height: 1;
    color: color-mix(in srgb, var(--color-foreground) 82%, transparent);
}

.file-manager-entries-grid .file-manager-entry-name {
    max-width: 100%;
    font-size: 1.0833rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-manager-entries-list .file-manager-entry {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.4167rem 0.8333rem;
    border-radius: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.file-manager-entries-list .file-manager-entry-glyph {
    flex: none;
    width: 1.6667rem;
    text-align: center;
    font-size: 1.3333rem;
    color: color-mix(in srgb, var(--color-foreground) 82%, transparent);
}

.file-manager-entries-list .file-manager-entry-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-manager-entries-list .file-manager-entry-size {
    flex: none;
    margin-left: auto;
    color: color-mix(in srgb, var(--color-foreground) 55%, transparent);
}

.file-manager-entry:hover {
    background: color-mix(in srgb, var(--color-foreground) 7%, transparent);
}

.file-manager-entry-selected {
    background: var(--color-selection) !important;
    color: var(--color-bright-foreground);
}

/* Empty states — Nautilus's centered icon + title + hint. */
.file-manager-message {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8333rem;
    text-align: center;
    padding: 1.5rem;
}

.file-manager-message p {
    margin: 0;
}

.file-manager-message-icon {
    font-size: 5rem;
    line-height: 1;
    color: var(--color-muted);
}

.file-manager-message-title {
    font-size: 1.3333rem;
    color: var(--color-foreground);
}

.file-manager-message-hint {
    color: color-mix(in srgb, var(--color-foreground) 55%, transparent);
}

.file-manager-grant {
    margin-top: 0.6667rem;
    padding: 0.5rem 1.3333rem;
    border: var(--border-width) solid var(--color-accent);
    border-radius: var(--radius);
    background: none;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--color-accent);
    cursor: pointer;
}

.file-manager-grant:hover {
    background: var(--color-selection);
    color: var(--color-bright-foreground);
}
