/* YWFA Product Grid – ywfa-grid.css
   Author: Shaharia
   Version: 1.0.0
*/

:root {
    --ywfa-primary:     #3C9EFF;
    --ywfa-primary-dk:  #1a7de0;
    --ywfa-badge-bg:    #3C9EFF;
    --ywfa-text:        #111;
    --ywfa-muted:       #666;
    --ywfa-card-bg:     #fff;
    --ywfa-border:      #e8e8e8;
    --ywfa-radius:      10px;
    --ywfa-img-height:  260px;   /* uniform image height — change to taste */
    --ywfa-transition:  0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Grid layout ──────────────────────────────────────────────────── */

.ywfa-grid {
    display: grid;
    gap: 24px;
    width: 100%;
}

/* Column definitions */
.ywfa-cols-1 { grid-template-columns: repeat(1, 1fr); }
.ywfa-cols-2 { grid-template-columns: repeat(2, 1fr); }
.ywfa-cols-3 { grid-template-columns: repeat(3, 1fr); }
.ywfa-cols-4 { grid-template-columns: repeat(4, 1fr); }
.ywfa-cols-5 { grid-template-columns: repeat(5, 1fr); }
.ywfa-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* Tablet: max 3 columns */
@media (max-width: 1024px) {
    .ywfa-cols-4,
    .ywfa-cols-5,
    .ywfa-cols-6 { grid-template-columns: repeat(3, 1fr); }
    :root { --ywfa-img-height: 220px; }
}

/* Phablet: 2 columns */
@media (max-width: 767px) {
    .ywfa-grid { gap: 16px; }
    .ywfa-cols-3,
    .ywfa-cols-4,
    .ywfa-cols-5,
    .ywfa-cols-6 { grid-template-columns: repeat(2, 1fr); }
    :root { --ywfa-img-height: 180px; }
}

/* Mobile: 2 columns (keeps cards side-by-side on phone) */
@media (max-width: 479px) {
    .ywfa-grid { gap: 12px; }
    .ywfa-cols-1 { grid-template-columns: 1fr; }
    .ywfa-cols-2,
    .ywfa-cols-3,
    .ywfa-cols-4,
    .ywfa-cols-5,
    .ywfa-cols-6 { grid-template-columns: repeat(2, 1fr); }
    :root { --ywfa-img-height: 150px; }
}

/* ── Card ─────────────────────────────────────────────────────────── */

.ywfa-card {
    position: relative;
    background: var(--ywfa-card-bg);
    border: 1px solid var(--ywfa-border);
    border-radius: var(--ywfa-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: box-shadow var(--ywfa-transition), transform var(--ywfa-transition);
}

.ywfa-card:hover {
    box-shadow: 0 8px 32px rgba(60,158,255,.15);
    transform: translateY(-3px);
}

/* ── Discount badge ───────────────────────────────────────────────── */

.ywfa-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--ywfa-badge-bg);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 2;
    line-height: 1;
}

/* ── Product image — uniform height, cover fill ───────────────────── */

.ywfa-card-image-link {
    display: block;
    width: 100%;
    height: var(--ywfa-img-height);
    overflow: hidden;
    background: #f6f6f6;
    flex-shrink: 0;
}

.ywfa-card-image-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;       /* fills the box, same height every card */
    object-position: center;
    display: block;
    transition: transform var(--ywfa-transition);
}

.ywfa-card:hover .ywfa-card-image-link img {
    transform: scale(1.05);
}

/* ── Card body ────────────────────────────────────────────────────── */

.ywfa-card-body {
    padding: 14px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.ywfa-card-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .55px;
    color: var(--ywfa-text);
    text-decoration: none;
    line-height: 1.35;
    display: block;
    text-align: center;
    transition: color .2s;
}

.ywfa-card-title:hover { color: var(--ywfa-primary); }

/* ── Rating ───────────────────────────────────────────────────────── */

.ywfa-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
}

.ywfa-rating.ywfa-rating-hidden { display: none; }

.ywfa-rating .star-rating { font-size: 12px; }

.ywfa-rating-count {
    color: var(--ywfa-muted);
    font-size: 11px;
}

/* ── Card footer: price left, icon-button right ───────────────────── */

.ywfa-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 10px;
    transition: opacity var(--ywfa-transition), transform var(--ywfa-transition);
}

.ywfa-card:hover .ywfa-card-footer {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}

/* ── Price ────────────────────────────────────────────────────────── */

.ywfa-price { font-size: 14px; line-height: 1.2; }

.ywfa-price .woocommerce-Price-amount { font-weight: 700; color: var(--ywfa-text); }

.ywfa-price del .woocommerce-Price-amount {
    color: var(--ywfa-muted);
    font-weight: 400;
    font-size: 12px;
}

.ywfa-price ins { text-decoration: none; }

/* ── Cart button (compact icon — inside footer) ───────────────────── */

.ywfa-card-footer .ywfa-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: var(--ywfa-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    flex-shrink: 0;
    transition: background .2s;
}

.ywfa-card-footer .ywfa-cart-btn:hover { background: var(--ywfa-primary-dk); }

.ywfa-card-footer .ywfa-cart-btn svg {
    width: 17px;
    height: 17px;
}

.ywfa-card-footer .ywfa-cart-btn .ywfa-cart-label { display: none; }

/* ── Hover full-width bar ─────────────────────────────────────────── */

.ywfa-hover-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    display: flex;
    align-items: stretch;
    transform: translateY(100%);
    transition: transform var(--ywfa-transition);
    z-index: 3;
}

.ywfa-card:hover .ywfa-hover-bar {
    transform: translateY(0);
}

.ywfa-hover-bar .ywfa-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    height: 100%;
    background: var(--ywfa-primary);
    color: #fff;
    border: none;
    border-radius: 0;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    padding: 0 16px;
    transition: background .2s;
}

.ywfa-hover-bar .ywfa-cart-btn:hover { background: var(--ywfa-primary-dk); }

.ywfa-hover-bar .ywfa-cart-btn svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

.ywfa-hover-bar .ywfa-cart-btn .ywfa-cart-label { display: inline; }

/* Added feedback */
.ywfa-hover-bar .ywfa-cart-btn.ywfa-adding {
    background: #28a745;
    pointer-events: none;
}

/* ── Slider wrap ──────────────────────────────────────────────────── */

.ywfa-slider-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 44px;
}

.ywfa-slider-wrap .swiper { overflow: hidden; }

.ywfa-slider-wrap .swiper-slide {
    height: auto;
    display: flex;
}

.ywfa-slider-wrap .swiper-slide .ywfa-card {
    width: 100%;
}

/* Nav arrows */
.ywfa-slider-wrap .swiper-button-prev,
.ywfa-slider-wrap .swiper-button-next {
    color: #fff;
    background: var(--ywfa-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    top: calc(var(--ywfa-img-height) / 2);
}

.ywfa-slider-wrap .swiper-button-prev::after,
.ywfa-slider-wrap .swiper-button-next::after {
    font-size: 13px;
    font-weight: 700;
}

.ywfa-slider-wrap .swiper-button-prev:hover,
.ywfa-slider-wrap .swiper-button-next:hover { background: var(--ywfa-primary-dk); }

/* Pagination dots */
.ywfa-slider-wrap .swiper-pagination-bullet-active { background: var(--ywfa-primary); }

/* Mobile: hide arrows on very small screens */
@media (max-width: 479px) {
    .ywfa-slider-wrap .swiper-button-prev,
    .ywfa-slider-wrap .swiper-button-next { display: none; }
    .ywfa-slider-wrap { padding-bottom: 36px; }
}

/* ── Misc ─────────────────────────────────────────────────────────── */

.ywfa-no-products {
    color: var(--ywfa-muted);
    padding: 20px;
    text-align: center;
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .ywfa-card,
    .ywfa-hover-bar,
    .ywfa-card-footer,
    .ywfa-card-image-link img { transition: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   YWFA Category Filter — Tabs & Sidebar
   ═══════════════════════════════════════════════════════════════════ */

/* ── Shared wrap ──────────────────────────────────────────────────── */

.ywfa-filter-wrap { width: 100%; }

/* ── TAB layout ───────────────────────────────────────────────────── */

.ywfa-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
    align-items: center;
}

.ywfa-tab {
    display: inline-flex;
    align-items: center;
    padding: 9px 22px;
    border: 2px solid var(--ywfa-border);
    border-radius: 50px;
    background: #fff;
    color: var(--ywfa-muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .3px;
    cursor: pointer;
    transition: border-color .22s, background .22s, color .22s, box-shadow .22s;
    white-space: nowrap;
    line-height: 1;
}

.ywfa-tab:hover {
    border-color: var(--ywfa-primary);
    color: var(--ywfa-primary);
}

.ywfa-tab.ywfa-tab-active {
    background: var(--ywfa-primary);
    border-color: var(--ywfa-primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(60,158,255,.28);
}

/* ── SIDEBAR layout ───────────────────────────────────────────────── */

.ywfa-filter-sidebar {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 32px;
    align-items: start;
}

.ywfa-sidebar {
    background: #fff;
    border: 1px solid var(--ywfa-border);
    border-radius: var(--ywfa-radius);
    padding: 20px 0 16px;
    position: sticky;
    top: 90px;
}

.ywfa-sidebar-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--ywfa-muted);
    padding: 0 20px 12px;
    margin: 0;
    border-bottom: 1px solid var(--ywfa-border);
}

.ywfa-sidebar-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}

.ywfa-sidebar-list li { margin: 0; }

.ywfa-sidebar-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 20px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    color: var(--ywfa-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: color .2s, background .2s, border-color .2s;
    gap: 8px;
}

.ywfa-sidebar-btn:hover {
    background: #f0f7ff;
    color: var(--ywfa-primary);
    border-left-color: var(--ywfa-primary);
}

.ywfa-sidebar-btn.ywfa-sidebar-btn-active {
    background: #e8f3ff;
    color: var(--ywfa-primary);
    border-left-color: var(--ywfa-primary);
    font-weight: 700;
}

.ywfa-sidebar-count {
    font-size: 11px;
    font-weight: 600;
    background: var(--ywfa-border);
    color: var(--ywfa-muted);
    border-radius: 20px;
    padding: 2px 7px;
    flex-shrink: 0;
    transition: background .2s, color .2s;
}

.ywfa-sidebar-btn.ywfa-sidebar-btn-active .ywfa-sidebar-count,
.ywfa-sidebar-btn:hover .ywfa-sidebar-count {
    background: var(--ywfa-primary);
    color: #fff;
}

/* ── Card hide animation ──────────────────────────────────────────── */

.ywfa-filter-grid .ywfa-card {
    transition: opacity .25s ease, transform .25s ease,
                box-shadow var(--ywfa-transition), transform var(--ywfa-transition);
}

.ywfa-filter-grid .ywfa-card[style*="display: none"] { display: none !important; }

/* ── Responsive: sidebar collapses to tabs-like on mobile ─────────── */

@media (max-width: 900px) {
    .ywfa-filter-sidebar {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .ywfa-sidebar {
        position: static;
        padding: 14px 0 10px;
    }

    .ywfa-sidebar-title { display: none; }

    /* Turn sidebar list into horizontal pill row */
    .ywfa-sidebar-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 0 14px;
        margin: 0;
    }

    .ywfa-sidebar-list li { flex: 0 0 auto; }

    .ywfa-sidebar-btn {
        display: inline-flex;
        padding: 8px 16px;
        border: 2px solid var(--ywfa-border);
        border-left: 2px solid var(--ywfa-border);
        border-radius: 50px;
        font-size: 13px;
        background: #fff;
        width: auto;
    }

    .ywfa-sidebar-btn:hover,
    .ywfa-sidebar-btn.ywfa-sidebar-btn-active {
        border-color: var(--ywfa-primary);
        background: var(--ywfa-primary);
        color: #fff;
    }

    .ywfa-sidebar-btn.ywfa-sidebar-btn-active .ywfa-sidebar-count,
    .ywfa-sidebar-btn:hover .ywfa-sidebar-count {
        background: rgba(255,255,255,.25);
        color: #fff;
    }
}

@media (max-width: 479px) {
    .ywfa-tabs { gap: 6px; }
    .ywfa-tab  { padding: 7px 14px; font-size: 12px; }
}
