/* App-owned SiteManager styles. The SmartAdmin SCSS stays untouched so a future template update
   does not overwrite product changes; see docs/design-docs/smv3-smartadmin-shell.md. */

/* SiteManager logo (706 x 219). The template sizes .app-logo images as a square mark, so the
   width is released here and the height sets the size. */
.app-logo > img.app-logo-image {
    width: auto;
    min-width: 0;
    height: 2.25rem;
    max-width: 100%;
}

/* The minified navigation is too narrow for the full logo. */
.set-nav-minified .app-logo > img.app-logo-image {
    display: none;
}

.auth-logo-image {
    height: 2.5rem;
    width: auto;
}

/* Site and content-language selectors. A Super Admin can see well over a hundred sites, so the
   list scrolls on its own, and reaching either end does not scroll the page behind it. The
   heading stays visible while the list scrolls. */
.shell-context-menu {
    max-height: min(70vh, 32rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    /* No top padding, or scrolled items show in the gap above the sticky heading. */
    padding-top: 0;
}

/* The site's SiteManager version, as a small badge after its name; v.3 sites stand out. */
.site-version-badge {
    background-color: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    font-size: 0.6875rem;
    font-weight: 500;
}

.site-version-badge-current {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    border-color: rgba(var(--bs-primary-rgb), 0.35);
    color: var(--bs-primary);
}

.shell-context-menu > .dropdown-header {
    position: sticky;
    top: 0;
    /* Above the item buttons, which the theme positions and would otherwise paint over it. */
    z-index: 3;
    padding-top: 0.75rem;
    background-color: var(--bs-dropdown-bg, var(--bs-body-bg));
}

/* Content browser (Task 7 step 1): compact category tree beside the content list. */
.category-tree ul {
    padding-left: 1rem;
}

.category-tree-line {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.375rem;
    border-radius: 0.375rem;
    list-style: none;
    cursor: default;
    min-width: 0;
}

.category-tree summary.category-tree-line {
    cursor: pointer;
}

.category-tree summary.category-tree-line::-webkit-details-marker {
    display: none;
}

.category-tree-line:hover {
    background-color: var(--bs-tertiary-bg);
}

.category-tree-chevron {
    flex: 0 0 1rem;
    width: 1rem;
    height: 1rem;
    transition: transform 0.15s ease;
}

.category-tree details[open] > summary > .category-tree-chevron {
    transform: rotate(90deg);
}

.category-tree-icon {
    flex: 0 0 auto;
    color: var(--bs-secondary-color);
}

.category-tree-link,
.category-tree-container {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.category-tree-link.active {
    font-weight: 600;
}

.category-tree-container {
    color: var(--bs-secondary-color);
}

.category-tree-count {
    flex: 0 0 auto;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

.category-tree li[hidden] {
    display: none;
}

/* Hiding the tree gives the list the full width on large screens. */
@media (min-width: 992px) {
    .content-browser--tree-hidden .content-browser-tree-column {
        display: none;
    }

    .content-browser--tree-hidden .content-browser-list-column {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .content-browser--tree-hidden .content-browser-tree-show {
        display: inline-flex !important;
    }
}

/* Icon buttons keep the icon beside the label; the template icon is otherwise laid out on its own line. */
.btn:has(> .sa-icon) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.content-list-title {
    text-decoration: none;
}

/* Long titles and underscore-joined internal names wrap, so the actions column stays in view. */
.content-list-title-cell {
    min-width: 12rem;
    overflow-wrap: anywhere;
}

.content-quick-view {
    --bs-offcanvas-width: min(36rem, 100vw);
}

.content-quick-view-html img {
    max-width: 100%;
    height: auto;
}

/* Media library dialog (_MediaLibraryAssets, media-library.js). Folders reuse the website tree's
   .category-tree styles; files are template cards. */
.media-library-body {
    min-height: min(34rem, 70vh);
}

.media-library-tree {
    background-color: var(--bs-tertiary-bg);
    overflow-y: auto;
    max-height: 70vh;
}

.media-library-toggle {
    color: inherit;
    line-height: 1;
}

/* A lazily loaded folder rotates its chevron as the website tree's <details> does. */
.category-tree li[aria-expanded="true"] > .category-tree-line .category-tree-chevron {
    transform: rotate(90deg);
}

.category-tree li.media-library-leaf > .category-tree-line .media-library-toggle {
    visibility: hidden;
}

.media-library-source > .category-tree-line .category-tree-link {
    font-weight: 500;
}

.media-library .category-tree-link {
    color: var(--bs-body-color);
    text-decoration: none;
}

.media-library .category-tree-link.active {
    color: var(--bs-primary);
}

.media-library-filter {
    width: 12rem;
}

.media-library-prompt-input {
    width: 16rem;
}

.media-library-files {
    border: 2px dashed transparent;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.media-library-files.media-library-drop,
.category-tree-line.media-library-drop {
    background-color: rgba(var(--bs-primary-rgb), 0.08);
    border-color: var(--bs-primary);
}

.media-library-loading {
    opacity: 0.6;
    pointer-events: none;
}

.media-library-item {
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.media-library-item:hover {
    border-color: rgba(var(--bs-primary-rgb), 0.5);
    box-shadow: var(--bs-box-shadow-sm);
}

.media-library-item-selected,
.media-library-item-selected:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

.media-library-item-muted {
    opacity: 0.55;
}

/* Bootstrap's d-flex is !important, so [hidden] needs the same weight inside the dialog. */
.media-library [hidden] {
    display: none !important;
}

/* Thumbnails on a checkerboard, so transparent images stay visible in both themes. The box is a
   Bootstrap .ratio, so every card has the same height whatever the image's shape. */
.media-library-thumb {
    background-color: var(--bs-body-bg);
    background-image:
        linear-gradient(45deg, var(--bs-tertiary-bg) 25%, transparent 25%),
        linear-gradient(-45deg, var(--bs-tertiary-bg) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--bs-tertiary-bg) 75%),
        linear-gradient(-45deg, transparent 75%, var(--bs-tertiary-bg) 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
    border-bottom: 1px solid var(--bs-border-color);
}

.media-library-thumb > img {
    object-fit: contain;
}

.media-library-thumb > .media-library-thumb-icon {
    align-items: center;
    display: flex;
    justify-content: center;
}

.media-library-file-icon {
    color: var(--bs-secondary-color);
    height: 2.5rem;
    width: 2.5rem;
}

/* Catalog list: a small product thumbnail, as the template's avatar-sized images. */
.catalog-list-thumb-column {
    width: 3.5rem;
}

.catalog-list-thumb {
    align-items: center;
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    display: inline-flex;
    height: 2.5rem;
    justify-content: center;
    object-fit: contain;
    width: 2.5rem;
}

.catalog-quick-view-image {
    background-color: var(--bs-tertiary-bg);
    max-height: 16rem;
    object-fit: contain;
    width: 100%;
}

/* Configuration > Categories: a long site tree scrolls on its own beside the editor. */
@media (min-width: 992px) {
    .configuration-category-tree {
        max-height: 75vh;
        overflow-y: auto;
    }
}
