/**
 * Fab Product Grid
 *
 * Styles for the [fab_product_grid] shortcode.
 * Grid layout, 3:4 thumbnails, custom cursor, hover add-to-cart.
 *
 * @package FabUI
 */

/* ==========================================================================
   Grid Layout
   ========================================================================== */

/* Override WooCommerce default styles on our grid container */
.woocommerce ul.fab-product-grid,
.woocommerce-page ul.fab-product-grid,
ul.fab-product-grid {
    display: grid !important;
    gap: 28px;
    width: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Remove WooCommerce clearfix pseudo-elements that break CSS Grid */
.woocommerce ul.fab-product-grid::before,
.woocommerce ul.fab-product-grid::after,
.woocommerce-page ul.fab-product-grid::before,
.woocommerce-page ul.fab-product-grid::after,
ul.fab-product-grid::before,
ul.fab-product-grid::after {
    content: none !important;
    display: none !important;
}

.fab-product-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.fab-product-grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

/* Tablet: 2 columns */
@media (min-width: 768px) and (max-width: 1024px) {
    .fab-product-grid[data-columns="3"],
    .fab-product-grid[data-columns="4"] {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile: 1 column */
@media (max-width: 767px) {
    .fab-product-grid[data-columns="3"],
    .fab-product-grid[data-columns="4"] {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ==========================================================================
   Product Card
   ========================================================================== */

/* Override WooCommerce + Divi default float layout on our grid items */
.woocommerce ul.fab-product-grid li.fab-product-card,
.woocommerce-page ul.fab-product-grid li.fab-product-card,
.woocommerce ul.fab-product-grid li.fab-product-card:nth-child(n),
.woocommerce-page ul.fab-product-grid li.fab-product-card:nth-child(n),
ul.fab-product-grid li.fab-product-card {
    position: relative;
    list-style: none;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    width: 100% !important;
    display: block;
    clear: none !important;
}

.fab-product-card__link {
    display: block;
    text-decoration: none !important;
    color: inherit !important;
}

.fab-product-card__link:hover,
.fab-product-card__link:focus {
    text-decoration: none !important;
    color: inherit !important;
}

/* ==========================================================================
   Thumbnail — strict 3:4 ratio
   ========================================================================== */

.fab-product-card__thumb {
    position: relative;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.fab-product-card__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.4s ease;
}

.fab-product-card:hover .fab-product-card__thumb img {
    transform: scale(1.03);
}

/* ==========================================================================
   Out of Stock Badge
   ========================================================================== */

.fab-product-card__badge--oos {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 4px;
    z-index: 2;
}

/* ==========================================================================
   Add to Cart / Select Options Button (hover overlay)
   ========================================================================== */

.fab-product-card__atc {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3;
    display: block;
    width: 100%;
    background: #000;
    color: #fff !important;
    border: none;
    padding: 16px 20px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    text-decoration: none !important;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.fab-product-card:hover .fab-product-card__atc {
    transform: translateY(0);
}

/* Button states */
.fab-product-card__atc:hover {
    background: #222;
    color: #fff !important;
}

.fab-product-card__atc:active {
    background: #333;
}

/* Loading state (WooCommerce adds .loading class) */
.fab-product-card__atc.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Added state (WooCommerce adds .added class) */
.fab-product-card__atc.added {
    background: #1a7d1a;
}

/* ==========================================================================
   Product Info (below thumb)
   ========================================================================== */

.fab-product-card__info {
    padding: 14px 2px 0;
}

.fab-product-card__title {
    line-height: 1.4;
    margin: 0 0 4px;
}

.fab-product-card__price {
    line-height: 1.4;
}

.fab-product-card__price del {
    margin-right: 6px;
}

.fab-product-card__price ins {
    text-decoration: none;
}

/* ==========================================================================
   Custom Cursor — "DETAILS" black circle
   ========================================================================== */

.fab-cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99999;
    pointer-events: none;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, opacity;
}

.fab-cursor--visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Hide default cursor over thumbnails only (desktop only) */
@media (hover: hover) and (pointer: fine) {
    .fab-product-card__thumb {
        cursor: none;
    }

    .fab-product-card__thumb * {
        cursor: none !important;
    }
}

/* ==========================================================================
   Touch / Small Screens — no custom cursor, always-visible ATC
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    .fab-cursor {
        display: none !important;
    }
}

/* Mobile: hide ATC button and custom cursor */
@media (max-width: 767px) {
    .fab-cursor {
        display: none !important;
    }

    .fab-product-card__atc {
        display: none !important;
    }
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.fab-product-grid__pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 40px;
    padding: 0;
}

.fab-product-grid__pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.fab-product-grid__pagination .page-numbers:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}

.fab-product-grid__pagination .page-numbers.current {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.fab-product-grid__empty {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 16px;
}
