/* ═══════════════════════════════════════════════════════════════
   MEGAFAX Products Widget — Circular Card Layout
   Version: 1.0.0
   ═══════════════════════════════════════════════════════════════ */

/* ── Grid ─────────────────────────────────────────────────────── */
.mfx-products-widget {
    width: 100%;
    font-family: inherit;
}

.mfx-products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* overridden by Elementor responsive controls */
    column-gap: 24px;
    row-gap: 40px;
    padding-top: 60px; /* space for overflowing image */
}

/* ── Card ──────────────────────────────────────────────────────── */
.mfx-product-card {
    background-color: #ffffff;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.28s ease;
    overflow: visible; /* allow image to overflow top */
}

.mfx-product-card.mfx-hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.15);
}

/* ── Image Area ────────────────────────────────────────────────── */
.mfx-card-image-area {
    display: flex;
    justify-content: center;
    /* Image overflows upward — controlled by .mfx-product-img-wrap margin-top */
}

.mfx-product-img-link {
    display: block;
    line-height: 0;
    text-decoration: none;
}

.mfx-product-img-wrap {
    width: 190px;
    height: 190px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #ffffff;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
    margin-top: -50px; /* default overflow — overridden by Elementor control */
    background-color: #f4f6f9;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    transition: transform 0.28s ease;
}

.mfx-product-card.mfx-hover-lift:hover .mfx-product-img-wrap {
    transform: scale(1.04);
}

.mfx-product-img-wrap .mfx-product-img,
.mfx-product-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.36s ease;
}

.mfx-product-card.mfx-hover-lift:hover .mfx-product-img-wrap img {
    transform: scale(1.07);
}

/* ── Card Body ─────────────────────────────────────────────────── */
.mfx-card-body {
    padding: 16px 22px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ── Badges ────────────────────────────────────────────────────── */
.mfx-badges-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.mfx-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 50px;
    line-height: 1.5;
}

.mfx-badge-sale {
    background-color: #E31E24;
    color: #ffffff;
}

.mfx-badge-featured {
    background-color: #F5A623;
    color: #ffffff;
}

/* ── Title Row (title + description + wishlist) ─────────────────── */
.mfx-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.mfx-title-desc {
    flex: 1;
    min-width: 0; /* prevent flex overflow */
}

/* ── Title ─────────────────────────────────────────────────────── */
.mfx-product-title {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
    color: #1A1A2E;
    margin: 0 0 6px;
    word-break: break-word;
}

.mfx-product-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.mfx-product-title a:hover {
    color: #E31E24;
}

/* ── Description ───────────────────────────────────────────────── */
.mfx-product-desc {
    font-size: 13px;
    font-weight: 400;
    color: #6B7A99;
    line-height: 1.55;
    margin-bottom: 14px;
}

.mfx-product-desc p:last-child {
    margin-bottom: 0;
}

/* ── Rating ────────────────────────────────────────────────────── */
.mfx-product-rating {
    margin-bottom: 10px;
}

.mfx-product-rating .star-rating {
    font-size: 13px;
}

/* ── Wishlist Button ───────────────────────────────────────────── */
.mfx-btn-wish {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: #EBEBEB;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background-color 0.22s, transform 0.22s;
    outline: none;
}

.mfx-btn-wish:hover {
    background-color: #dde0e6;
    transform: scale(1.08);
}

.mfx-btn-wish svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #9099A8;
    stroke-width: 2;
    transition: fill 0.22s, stroke 0.22s, transform 0.22s;
    pointer-events: none;
}

.mfx-btn-wish.is-wishlisted svg {
    fill: #E31E24;
    stroke: #E31E24;
    transform: scale(1.15);
}

.mfx-btn-wish.mfx-wish-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ── Card Footer (price + cart button) ─────────────────────────── */
.mfx-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 12px;
}

/* ── Price ─────────────────────────────────────────────────────── */
.mfx-product-price {
    font-size: 24px;
    font-weight: 900;
    color: #1A1A2E;
    line-height: 1;
}

.mfx-product-price .woocommerce-Price-amount {
    color: inherit;
}

.mfx-product-price del {
    font-size: 0.65em;
    font-weight: 400;
    color: #9099A8;
    text-decoration: line-through;
    margin-right: 4px;
}

.mfx-product-price ins {
    text-decoration: none;
    color: #E31E24;
}

/* ── Cart Button ───────────────────────────────────────────────── */
.mfx-btn-cart {
    width: 56px;
    height: 56px;
    border-radius: 50% 50% 0 50%; /* top-left, top-right, bottom-right, bottom-left */
    background-color: #2D7D6F;
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    text-decoration: none;
    transition: background-color 0.22s, transform 0.22s, box-shadow 0.22s;
    outline: none;
    position: relative;
}

.mfx-btn-cart:hover {
    background-color: #1f5c52;
    transform: scale(1.08) rotate(-4deg);
    box-shadow: 0 6px 18px rgba(45, 125, 111, 0.4);
}

.mfx-btn-cart:active {
    transform: scale(0.96);
}

.mfx-btn-cart:disabled,
.mfx-btn-cart[disabled] {
    background-color: #c0c8d0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.mfx-btn-cart svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    pointer-events: none;
    transition: transform 0.22s;
}

.mfx-btn-cart.mfx-adding svg {
    animation: mfx-spin 0.6s linear infinite;
}

.mfx-btn-cart.mfx-added {
    background-color: #1f5c52;
}

@keyframes mfx-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Cart button with text */
.mfx-btn-cart:not(:empty):not(:has(svg)) {
    border-radius: 50px;
    padding: 0 20px;
    width: auto;
    font-size: 13px;
    font-weight: 800;
    gap: 6px;
    height: 44px;
}

/* ── No products ───────────────────────────────────────────────── */
.mfx-no-products {
    text-align: center;
    color: #6B7A99;
    font-size: 15px;
    padding: 40px;
}

/* ── Pagination ────────────────────────────────────────────────── */
.mfx-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 48px;
    flex-wrap: wrap;
}

.mfx-pagination a,
.mfx-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    color: #1B2B4B;
    background-color: #EEF2F7;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s, transform 0.15s;
    border: none;
}

.mfx-pagination a:hover {
    background-color: #1B2B4B;
    color: #ffffff;
    transform: translateY(-1px);
}

.mfx-pagination .current {
    background-color: #1B2B4B;
    color: #ffffff;
    font-weight: 800;
}

.mfx-pagination .dots {
    background: transparent;
    cursor: default;
}

.mfx-pag-prev a,
.mfx-pag-next a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 18px;
    border-radius: 50px;
}

/* Load more button */
.mfx-btn-load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 36px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 800;
    color: #1B2B4B;
    background-color: #EEF2F7;
    border: 2px solid #DDE4EF;
    cursor: pointer;
    transition: all 0.25s;
    gap: 8px;
}

.mfx-btn-load-more:hover {
    background-color: #1B2B4B;
    color: #ffffff;
    border-color: #1B2B4B;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(27, 43, 75, 0.2);
}

.mfx-btn-load-more.mfx-loading {
    opacity: 0.7;
    pointer-events: none;
}

.mfx-btn-load-more.mfx-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2.5px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: mfx-spin 0.7s linear infinite;
}

/* ── Feedback Toast ────────────────────────────────────────────── */
.mfx-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background-color: #1B2B4B;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s ease;
    white-space: nowrap;
    max-width: 90vw;
}

.mfx-toast.mfx-toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.mfx-toast.mfx-toast-success::before { content: '✓  '; }
.mfx-toast.mfx-toast-error::before   { content: '✕  '; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .mfx-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .mfx-products-grid {
        grid-template-columns: 1fr;
    }

    .mfx-product-img-wrap {
        width: 160px;
        height: 160px;
    }

    .mfx-product-title {
        font-size: 16px;
    }

    .mfx-product-price {
        font-size: 20px;
    }

    .mfx-btn-cart {
        width: 48px;
        height: 48px;
    }

    .mfx-btn-cart svg {
        width: 18px;
        height: 18px;
    }
}

/* ── Elementor Editor Overrides ────────────────────────────────── */
.elementor-editor-active .mfx-product-card {
    transition: none;
}
