/**
 * Category Blocks - Frontend Styles
 *
 * Horizontal row of rounded pills (image + name + count), matching the
 * prototype's `.sub-cats` / `.sub-cat-pill` treatment. Each pill may
 * optionally display a small green tick in the top-right of the image
 * when the thumbnail was resolved via the Soul Country category→image
 * mapping (data-mapped-image="1").
 *
 * Modifier `--no-products` bumps the image dramatically on pure parent
 * categories (those with subcategories but no direct products), where the
 * pills are the page's primary affordance rather than a secondary filter.
 *
 * @package IMS_by_Soul_Country
 */

/* ==========================================================================
   Container
   ========================================================================== */

.ims-category-blocks {
    display: block;
}

/* ==========================================================================
   Pill row
   ========================================================================== */

.ims-category-blocks__row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid #e8eaed;
}

/* ==========================================================================
   Pill
   ========================================================================== */

.ims-category-blocks__pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    border: 1.5px solid #e8eaed;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
    background: #ffffff;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    line-height: 1.2;
}

.ims-category-blocks__pill:hover,
.ims-category-blocks__pill:focus-visible {
    border-color: var(--gold, #FAB000);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    color: #1a1a1a;
}

/* Image */
.ims-category-blocks__pill-image {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    background: #f3f4f6;
    border-radius: 6px;
    overflow: hidden;
}

.ims-category-blocks__pill-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Green tick shown when the thumbnail comes from the mapped-category
   lookup — quick visual confirmation that a curated image is in use. */
.ims-category-blocks__pill-tick {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #16a34a;
    color: #ffffff;
    box-shadow: 0 0 0 2px #ffffff;
}

.ims-category-blocks__pill-tick svg {
    width: 8px;
    height: 8px;
}

/* Body (stacked name + meta line) */
.ims-category-blocks__pill-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ims-category-blocks__pill-name {
    white-space: nowrap;
}

.ims-category-blocks__pill-meta {
    font-size: 10.5px;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.3;
}

/* ==========================================================================
   --no-products modifier
   On pure parent categories the pills become a gallery-style picker: much
   larger images, chunkier label, aligned on a uniform grid so every card
   is the same width regardless of label length.
   ========================================================================== */

.ims-category-blocks--no-products .ims-category-blocks__row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    padding: 14px 0;
    border-bottom: 0;
}

.ims-category-blocks--no-products .ims-category-blocks__pill {
    display: flex;
    width: 100%;
    padding: 8px 16px 8px 8px;
    gap: 12px;
    border-radius: 10px;
    font-size: 13.5px;
}

.ims-category-blocks--no-products .ims-category-blocks__pill-body {
    flex: 1 1 auto;
}

.ims-category-blocks--no-products .ims-category-blocks__pill-name {
    white-space: normal;
    line-height: 1.3;
}

.ims-category-blocks--no-products .ims-category-blocks__pill-meta {
    font-size: 11.5px;
}

.ims-category-blocks--no-products .ims-category-blocks__pill-image {
    width: 104px;
    height: 104px;
    border-radius: 8px;
}

.ims-category-blocks--no-products .ims-category-blocks__pill-tick {
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
}

.ims-category-blocks--no-products .ims-category-blocks__pill-tick svg {
    width: 10px;
    height: 10px;
}

.ims-category-blocks--no-products .ims-category-blocks__pill-count {
    font-size: 12px;
}

/* ==========================================================================
   Editor Preview
   ========================================================================== */

.ims-category-blocks-editor .components-placeholder {
    min-height: auto;
}
