/* Host-app admin CSS. Most chrome comes from stupendous_admin; this
   file is for app-specific layout that doesn't belong in the library. */

/* ---- Icon section (apps + games edit pages) -------------------- */
.icon-section__head {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.icon-section__preview {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.icon-section__meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xxs);
    font-size: var(--font-size-sm);
}

.icon-section__meta a {
    word-break: break-all;
}

.icon-section__universal {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}


/* Crawl-item panel: 2-column card grid of upstream screenshots, each
   with a per-image Copy button (or "Linked" badge when already
   imported). The header carries a "Copy all" action. */
.crawl-item-panel__screenshots {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
}

.crawl-item-panel__screenshot {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.crawl-item-panel__screenshot img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
}

.crawl-item-panel__screenshot-action,
.crawl-item-panel__screenshot .badge {
    position: absolute;
    bottom: var(--spacing-xs);
    right: var(--spacing-xs);
}

/* Pages that opt into a wider body (e.g. /admin/apps/:slug/edit's
   two-column shell) pass `body_class="admin-page--full"` to
   `<MacatlasWeb.AdminLayouts.app>`. The body breaks out of the
   parent `.container` via negative viewport margins, leaving the
   top-nav, sub-nav, and footer at the library's default width. */
.admin-body:has(.admin-page--full) {
    overflow-x: clip;
}

.admin-page--full {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding: 0 var(--spacing-xl);
    box-sizing: border-box;
}

/* Crawl-item icon thumbnails inside the diff table: cap the height
   so the row stays the same size as text rows. */
.crawl-item-panel__icon {
    height: 40px;
    width: auto;
}

/* Drag handle for sortable rows. Pointer-driven via initSortable() in
   admin.js — no native HTML5 drag, so we only need cursor styling and
   a faint visual on the row being dragged. */
.sort-handle {
    display: inline-flex;
    align-items: center;
    cursor: grab;
    user-select: none;
    color: var(--text-color-3);
    touch-action: none;
}

.sort-handle:active {
    cursor: grabbing;
}

.is-sort-dragging {
    opacity: 0.3;
}

/* Floating clone of the row being dragged. Inherits the source table's
   class so column widths/typography match; positioned by JS. */
.sort-ghost {
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--background-color-1);
}

/* Crawl-item Fields: each <.key_value> row's value cell is laid out
   as [diff-value | Apply button], with the Apply pinned to the right
   so the diff text gets the rest of the available width. */
.crawl-item-panel__kv-cell {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-sm);
}

.crawl-item-panel__kv-cell > :first-child {
    flex: 1;
    min-width: 0;
}

/* ---- Popover: lazy picker anchored to a trigger button ---- */
.popover-host {
    position: relative;
    display: inline-block;
}

.popover {
    position: absolute;
    top: calc(100% + var(--spacing-xs));
    right: 0;
    z-index: 50;
    min-width: 280px;
    padding: var(--spacing-sm);
    background-color: var(--background-color-0);
    border: 1px solid var(--border-color-2);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.popover[hidden] {
    display: none;
}

/* ---- Home sections: two-column grid of section cards ---- */
.home-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

@media (max-width: 720px) {
    .home-sections {
        grid-template-columns: 1fr;
    }
}

.home-section {
    /* Wells default to no margin in a grid; the gap handles spacing. */
    margin: 0;
}
