/* ── catalog-admin.css ────────────────────────────────────────────────────────
   Scoped styles for the location-scoped Catalog tab inside Event Management
   and the per-event catalog selection panel inside EventChecklistDialog.

   No new colors. All colors come from existing variables defined upstream
   (lws-, eem-, eec-, jbf-rb-, cum-). Layout/spacing only.
   ─────────────────────────────────────────────────────────────────────────── */

.catalog-admin-shell {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
}

/* .jbf-toolbar base does not set display:flex (only --stack does), so the
   align-items/justify-content rules here would otherwise be inert and the
   meta + Add button would stack vertically left-aligned. Force flex so the
   primary action sits hard-right of the toolbar. */
.catalog-admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.catalog-admin-toolbar-meta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-right: auto;
}

.catalog-admin-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}

.catalog-admin-body--panel-open .catalog-admin-grid {
    pointer-events: none;
    user-select: none;
}

.catalog-admin-grid {
    width: 100%;
}

.catalog-admin-thumb-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: var(--lws-surface-muted, #f3f4f6);
    color: var(--cum-muted, #6b7280);
    font-size: 11px;
}

/* Larger preview-panel variant: the preview head reserves a sizable square so the
   hero image doesn't look tiny next to the title block. The placeholder has to
   match that footprint when no image is provided. */
.catalog-admin-thumb-placeholder--lg {
    width: 96px;
    height: 96px;
    font-size: 12px;
    padding: 8px;
    text-align: center;
    line-height: 1.25;
}

/* The default placeholder hides overflow because it only holds a single lowercase
   word. When we render real copy like "No image provided" we need the glyphs to
   wrap rather than clip. */
.catalog-admin-thumb-placeholder--text {
    white-space: normal;
    overflow: hidden;
}

.catalog-admin-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ── Edit panel (CatalogItemEditPanel) ──────────────────────────────────── */

/* Override the rule-builder width inheritance. The catalog item form is a single-column
   layout with one 2-up row (price/inventory) - 1080px (rule-builder default) leaves a
   massive empty corridor between fields and makes the description textarea read as
   broken whitespace. ~640px keeps the form compact and matches the fee-edit panel. */
.catalog-admin-edit-panel.eem-side-panel--rule-builder {
    width: min(100%, min(96vw, 640px));
    max-height: min(86vh, 760px);
}

/* Scrim styling: the shared .eem-checklist-side-panel-scrim CSS is scoped to
   .jbf-event-checklist-fullscreen, so the scrim div renders invisibly in this
   tab and the toolbar/grid behind the panel show through. Provide an equivalent
   rule scoped to the catalog body and lift the panel above it. */
.catalog-admin-body .eem-checklist-side-panel-scrim {
    position: absolute;
    inset: 0;
    z-index: 40;
    background: rgba(2, 25, 34, 0.18);
    pointer-events: auto;
}

.catalog-admin-body .eem-side-panel.catalog-admin-edit-panel {
    z-index: 50;
}

.catalog-admin-edit-panel .catalog-admin-image-row {
    display: flex;
    justify-content: flex-start;
}

.catalog-admin-pack-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--lws-border-muted, #e5e7eb);
}

.catalog-admin-pack-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.catalog-admin-pack-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.catalog-admin-pack-row {
    display: grid;
    grid-template-columns: 110px 140px 1fr 36px;
    gap: 8px;
    align-items: end;
    padding: 8px;
    border-radius: 6px;
    background: var(--lws-surface-muted, #f9fafb);
}

.catalog-admin-pack-cell {
    margin: 0;
}

.catalog-admin-pack-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    padding-bottom: 2px;
}

/* TODO(responsive): 720px is off-tier (between sm=767 and md=768). Either
   shift to 767.98 (xs/sm collapses pack row into 2-col) or 1023.98 (md+
   collapses too). Choose based on visual review at iPad mini portrait. */
@media (max-width: 720px) {
    .catalog-admin-pack-row {
        grid-template-columns: 1fr 1fr;
    }

    .catalog-admin-pack-cell--label {
        grid-column: 1 / -1;
    }

    .catalog-admin-pack-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

/* ── Catalog grid in Event Setup (PaginatedTable cells) ─────────────────── */

/* Compact name cell: thumbnail beside the catalog item name. The thumbnail
   cell is a fixed square so rows align even when items have no image. */
.eecg-name-cell {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.eecg-thumb {
    flex: 0 0 auto;
    display: inline-flex;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--lws-surface-muted, #f3f4f6);
}

.eecg-thumb :global(img),
.eecg-thumb :global(.image-upload-with-crop) {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.eecg-name {
    font-weight: 600;
    color: var(--cum-foreground, #021922);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Drag handle column - cursor + muted color so it reads as an affordance
   without competing visually with the row content. */
.eecg-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: var(--cum-muted, #6b7280);
    cursor: grab;
}

.eecg-drag-handle:active {
    cursor: grabbing;
}

.eecg-row-action {
    text-align: right;
}

/* ── Add-panel catalog item picker (EventCatalogAddPanel) ───────────────── */

.eecap-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.eecap-help {
    margin: 0;
}

.eecap-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.eecap-card {
    border: 1px solid var(--lws-border-muted, #e5e7eb);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--cum-surface, #ffffff);
    transition: border-color 120ms ease, background 120ms ease;
}

.eecap-card--selected {
    border-color: var(--cum-accent, #7d5b81);
    background: var(--lws-surface-muted, #f9fafb);
}

.eecap-card-row {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 10px;
    align-items: center;
}

.eecap-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--lws-surface-muted, #f3f4f6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.eecap-thumb :global(img),
.eecap-thumb :global(.image-upload-with-crop) {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.eecap-card-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    background: transparent;
    border: 0;
    padding: 0;
    text-align: left;
    cursor: pointer;
    min-width: 0;
}

.eecap-card-name {
    font-weight: 600;
    color: var(--cum-foreground, #021922);
}

.eecap-card-meta {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--cum-muted, #6b7280);
}

.eecap-overrides {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--lws-border-muted, #e5e7eb);
}

/* ── Override edit panel (EventCatalogItemOverridePanel) ────────────────── */

.eecop-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.eecop-base-meta {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
}
