/* ============================================================================
   Laymoun styling for the theme's "Product in category tabs" element
   ([ftc_products_category_tabs], themeftc-core) — the home "Featuring
   Products" section (Feedback 2 §8; replaces the ftc_products_slider there).
   Pairs with js/category-tabs-loop-fix.js (correct column counts, no
   loop-clone duplicates, sparse-tab flattening).

   The theme only styles this element in is_slider="1" mode (170px icon rail
   + AJAX product slider). These rules brand it and fix its rough edges; they
   were proven on the draft pages (17941/17942) before shipping here.
   ========================================================================== */

/* Layout: rail + products side by side via flex. The theme floats them with
   width 170px + 85% + 18px margin — that only fits in containers ≥ ~1185px,
   so inside the home row's 1170px container the products WRAPPED BELOW the
   rail. Flex always fits (the content flexes to the remaining width) and
   mirrors automatically in RTL. Float/width/margin props on the children are
   ignored/neutralized in the flex context. */
.ftc-products-category {
    display: flex;
    align-items: flex-start;
    gap: 18px;
}
.ftc-products-category .row-tabs {
    float: none;
    flex: 0 0 170px;
    width: 170px;
}
.ftc-products-category .row-content {
    float: none;
    flex: 1 1 auto;
    min-width: 0;      /* let the owl slider shrink inside the flex item */
    width: auto;
}
body:not(.fullwidth-template-padding) .ftc-products-category .row-content {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
}

/* Rail card: site radius token on all 4 corners, top-aligned with the content
   beside it (the theme gives the list a 10px top margin, and the rail itself
   -70px for a demo layout that pairs it with a heading block we don't use). */
.ftc-products-category .row-tabs { margin-top: 0; }
.ftc-products-category .row-tabs ul {
    border: 1px solid #ebebeb;
    border-radius: var(--radius, 24px);
    overflow: hidden;
    margin-top: 0;
}
.ftc-products-category ul.tabs li:last-child { border-bottom: 0; }

/* Every card fills its slide, whatever columns="N" says (3 since app repo
   docs/plans/77). The theme's GRID rule `.woocommerce.columns-3 .products
   .product { max-width: calc(33.33% - 30px) }` also matches these cards, and
   in the slider their parent is one slide, so a card shrank to a third of it.
   columns="4" has no such rule. The slider sizes the slides itself. */
.ftc-products-category .column-products.woocommerce .owl-carousel .product {
    max-width: none;
}

/* Equal round icons + title beside them, inside the 170px rail. The theme
   lays icon/title as table-cells with fixed +18/+33px offsets sized for its
   tiny demo icons — bigger icons pushed titles out of the rail. */
.ftc-products-category ul.tabs li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
}
.ftc-products-category ul.tabs li span.icon  { position: static; left: auto; flex: 0 0 auto; display: block; }
.ftc-products-category ul.tabs li span.title { position: static; left: auto; display: block; }
.ftc-products-category .tab-item img.size-thumbnail {
    display: block;
    width: 56px;                      /* normalize: attachments differ in size */
    height: 56px;
    object-fit: cover;
    background: #186034;              /* brand green — theme hardcodes lime */
    border-radius: 50% !important;    /* the Customizer blob forces 24px on img */
}

/* Brand green for the active/hovered tab (theme hardcodes old lime #82b440). */
.ftc-products-category ul.tabs li.current,
.ftc-products-category ul.tabs li.current span.title,
.ftc-products-category ul.tabs li:hover span.title { color: #186034; }

/* The white AJAX-loading panel gets the same radius as the rail card. */
.ftc-products-category .row-content.loading .column-products:before {
    border-radius: var(--radius, 24px);
}

/* First product-card row sits exactly on the rail's top line (cards carry a
   20px top margin of their own). */
.ftc-products-category .row-content ul.products { margin-top: 0; }
.ftc-products-category .ftc-products .ftc-product:first-child { margin-top: 0; }

/* NOTE: the always-visible action-icon row (add-to-cart + wishlist + quick
   view) and the removal of the grey divider bar are now UNIFIED across ALL
   product cards site-wide — moved to style.css (search "product-card action
   icons"), not scoped to this section anymore. */

/* RTL: nothing to do — the flex row above mirrors automatically (the theme's
   rtl.css never flips this element, which is why the old float layout needed
   manual RTL overrides on the draft pages). */

/* ── Mobile (<768px): categories ON TOP, products below (owner 2026-07-15) ──
   The 170px side rail doesn't work on phones. The flex row becomes a column;
   the tab list becomes a 2-per-row grid inside the same rounded card. With an
   odd number of categories the last tile spans both columns (the
   :last-child:nth-child(odd) pair only matches on odd counts, so this
   activates by itself when a 5th category is added). Divider lines: right
   border on the first column, bottom border everywhere except the last row —
   for both odd and even counts. Grid follows the writing direction, so RTL
   mirrors automatically. */
@media (max-width: 767px) {
    .ftc-products-category {
        flex-direction: column;
        gap: 16px;
    }
    .ftc-products-category .row-tabs {
        flex: 0 0 auto;
        width: 100%;
    }
    .ftc-products-category .row-tabs ul {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .ftc-products-category ul.tabs li {
        margin-top: 0;                       /* theme's -1px list overlap */
        border-bottom: 1px solid #e5e5e5;
    }
    /* the theme's own mobile rule pads these li 18px 30% (sized for its
       full-width vertical rail) — inside a 2-per-row tile that shoves the
       icon inward and pushes the title past the edge; extra selector weight
       to beat it, tile-sized metrics */
    .ftc-products-category .row-tabs ul.tabs li {
        padding: 12px 10px;
        gap: 10px;
    }
    .ftc-products-category .row-tabs ul.tabs li span.title {
        font-size: 14px;
        min-width: 0;                        /* long names wrap, never overflow */
    }
    .ftc-products-category .row-tabs .tab-item img.size-thumbnail {
        width: 44px;
        height: 44px;
    }
    .ftc-products-category ul.tabs li:nth-child(odd) {
        border-inline-end: 1px solid #e5e5e5;
    }
    /* last row loses its bottom divider: the last tile always, plus its row
       neighbour when the count is even */
    .ftc-products-category ul.tabs li:last-child,
    .ftc-products-category ul.tabs li:nth-last-child(2):nth-child(odd) {
        border-bottom: 0;
    }
    /* odd count: the final tile takes the full width, no column divider */
    .ftc-products-category ul.tabs li:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        border-inline-end: 0;
        justify-content: center;
    }
}
