.wewoo-product-grid,
.wewoo-product-grid *,
.wewoo-price-note,
.wewoo-price-note * {
    box-sizing: border-box;
}

.wewoo-product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 24px;
    width: 100%;
}

.wewoo-product-card {
    container-type: inline-size;
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #dedede;
    border-radius: 15px;
    background: #ffffff;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.wewoo-product-card:hover {
    transform: translateY(-2px);
    border-color: #ffc000;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.09);
}

.wewoo-product-image-wrap {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 88%, rgba(0, 0, 0, 0.07), transparent 48%),
        #fafafa;
}

.wewoo-product-image-link {
    display: block;
    width: 100%;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.wewoo-product-image-wrap .wewoo-main-product-image {
    display: block;
    width: 100%;
    height: 100%;
    padding: 34px 28px 18px;
    object-fit: contain;
    object-position: center;
    transition: transform 0.3s ease;
}

.wewoo-product-card:hover .wewoo-main-product-image {
    transform: scale(1.025);
}

.wewoo-deal-badge {
    position: absolute;
    z-index: 2;
    top: 16px;
    right: 18px;
    display: block;
    width: 126px;
    max-width: 31%;
    height: auto;
    pointer-events: none;
    object-fit: contain;
}

.wewoo-product-content {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    padding: 18px 24px 20px;
}

.wewoo-product-title {
    margin: 0 0 10px;
    color: #111111;
    font-size: 21px;
    font-weight: 800;
    line-height: 1.28;
    letter-spacing: -0.25px;
}

.wewoo-product-title a {
    color: inherit;
    text-decoration: none;
}

.wewoo-product-title a:hover {
    color: inherit;
}

.wewoo-product-meta-row {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 18px;
}

.wewoo-product-subtitle {
    min-width: 0;
    color: #171717;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.45;
}

.wewoo-rating {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    overflow: hidden;
    font-size: 20px;
    line-height: 1;
    letter-spacing: 1px;
    white-space: nowrap;
}

.wewoo-rating-base {
    display: block;
    color: #e2e2e2;
}

.wewoo-rating-fill {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    overflow: hidden;
    color: #ffc400;
    white-space: nowrap;
}

.wewoo-product-quantity {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 20px;
    color: #111111;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.4;
}

.wewoo-box-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
}

.wewoo-box-icon svg {
    display: block;
    width: 29px;
    height: 29px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wewoo-product-footer {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 1px minmax(150px, 1.15fr) 72px;
    align-items: center;
    gap: 20px;
    margin-top: auto;
    padding-top: 21px;
    border-top: 1px solid #d8d8d8;
}

.wewoo-product-footer.wewoo-no-old-price {
    grid-template-columns: minmax(0, 1fr) 72px;
}

.wewoo-price-block {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
}

.wewoo-price-label {
    color: #181818;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.2;
}

.wewoo-current-price,
.wewoo-old-price {
    display: block;
    min-width: 0;
    font-family: inherit;
}

.wewoo-current-price {
    color: #07842f;
    font-size: 31px;
    font-weight: 800;
    line-height: 1.05;
    white-space: nowrap;
}

.wewoo-old-price {
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    color: #e10000;
    font-size: 28px;
    font-weight: 500;
    line-height: 1.05;
    text-decoration-color: #111111;
    text-decoration-line: line-through;
    text-decoration-thickness: 2px;
    white-space: nowrap;
}

.wewoo-current-price .woocommerce-Price-amount,
.wewoo-old-price .woocommerce-Price-amount {
    color: inherit;
    font: inherit;
    line-height: inherit;
}

.wewoo-current-price .woocommerce-Price-currencySymbol,
.wewoo-old-price .woocommerce-Price-currencySymbol {
    color: inherit;
}

.wewoo-price-divider {
    display: block;
    width: 1px;
    height: 66px;
    background: #d8d8d8;
}

.wewoo-cart-button {
    display: inline-flex;
    width: 72px;
    height: 72px;
    min-width: 72px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #ffc000;
    color: #080808;
    text-decoration: none;
    transition: transform 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.wewoo-cart-button:hover,
.wewoo-cart-button:focus {
    background: #ffad00;
    color: #080808;
    transform: translateY(-2px);
}

.wewoo-cart-button.loading {
    opacity: 0.65;
    pointer-events: none;
}

.wewoo-cart-button.added {
    opacity: 1;
}

.wewoo-cart-button svg {
    display: block;
    width: 38px;
    height: 38px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wewoo-cart-button + .added_to_cart {
    display: none !important;
}

.wewoo-price-note {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 22px;
    margin-top: 16px;
    padding: 0 8px;
    color: #111111;
    font-size: 15px;
    line-height: 1.5;
    text-align: center;
}

.wewoo-note-current {
    color: #07842f;
}

.wewoo-note-old {
    color: #e10000;
}

.wewoo-note-separator {
    color: #111111;
    font-weight: 700;
}

.wewoo-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 28px;
}

.wewoo-pagination .page-numbers {
    display: inline-flex;
    min-width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    padding: 0 11px;
    border: 1px solid #dedede;
    border-radius: 7px;
    background: #ffffff;
    color: #111111;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.wewoo-pagination .page-numbers.current,
.wewoo-pagination .page-numbers:hover {
    border-color: #ffc000;
    background: #ffc000;
    color: #000000;
}

.wewoo-empty-message {
    padding: 18px;
    border: 1px solid #dedede;
    border-radius: 10px;
    background: #ffffff;
    color: #555555;
    font-size: 14px;
}

@container (max-width: 470px) {
    .wewoo-product-content {
        padding: 16px;
    }

    .wewoo-product-title {
        font-size: 18px;
    }

    .wewoo-product-subtitle,
    .wewoo-product-quantity {
        font-size: 15px;
    }

    .wewoo-rating {
        font-size: 17px;
    }

    .wewoo-product-footer {
        grid-template-columns: minmax(90px, 1fr) 1px minmax(108px, 1.08fr) 56px;
        gap: 10px;
    }

    .wewoo-product-footer.wewoo-no-old-price {
        grid-template-columns: minmax(0, 1fr) 56px;
    }

    .wewoo-price-label {
        font-size: 13px;
    }

    .wewoo-current-price {
        font-size: 22px;
    }

    .wewoo-old-price {
        font-size: 18px;
    }

    .wewoo-price-divider {
        height: 56px;
    }

    .wewoo-cart-button {
        width: 56px;
        height: 56px;
        min-width: 56px;
    }

    .wewoo-cart-button svg {
        width: 30px;
        height: 30px;
    }
}

@container (max-width: 355px) {
    .wewoo-product-footer {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 50px;
    }

    .wewoo-product-footer.wewoo-no-old-price {
        grid-template-columns: minmax(0, 1fr) 50px;
    }

    .wewoo-price-divider {
        display: none;
    }

    .wewoo-current-price {
        font-size: 20px;
    }

    .wewoo-old-price {
        font-size: 16px;
    }

    .wewoo-cart-button {
        width: 50px;
        height: 50px;
        min-width: 50px;
    }
}

@media (max-width: 1024px) {
    .wewoo-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .wewoo-product-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .wewoo-product-image-wrap {
        aspect-ratio: 16 / 9;
    }

    .wewoo-deal-badge {
        top: 12px;
        right: 12px;
        width: 105px;
    }

    .wewoo-price-note {
        flex-direction: column;
        gap: 4px;
        font-size: 13px;
    }

    .wewoo-note-separator {
        display: none;
    }
}

/* Version 2.1: compact mobile layout that preserves the desktop card structure. */
@media (max-width: 767px) {
    .wewoo-product-grid.wewoo-mobile-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .wewoo-product-grid.wewoo-mobile-single {
        grid-template-columns: 1fr !important;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-card {
        border-radius: 10px;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-image-wrap {
        aspect-ratio: 16 / 9 !important;
        min-height: 0;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-image-wrap .wewoo-main-product-image {
        padding: 10px 8px 4px !important;
        transform: scale(var(--wewoo-mobile-image-scale, 1.22)) !important;
        transform-origin: center center;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-card:hover .wewoo-main-product-image {
        transform: scale(var(--wewoo-mobile-image-scale, 1.22)) !important;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-deal-badge {
        top: 6px !important;
        right: 6px !important;
        width: 72px !important;
        max-width: 42%;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-content {
        padding: 10px !important;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-title {
        margin-bottom: 5px;
        font-size: 12px !important;
        line-height: 1.28 !important;
        letter-spacing: -0.1px;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-meta-row {
        align-items: center;
        gap: 3px 4px;
        margin-bottom: 8px;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-subtitle {
        font-size: 10px !important;
        line-height: 1.3 !important;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-rating {
        font-size: 10px !important;
        letter-spacing: 0;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-quantity {
        gap: 5px;
        margin-bottom: 8px;
        font-size: 10.5px !important;
        line-height: 1.25 !important;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-box-icon svg {
        width: 18px;
        height: 18px;
        stroke-width: 1.8;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-footer {
        grid-template-columns: minmax(44px, 0.88fr) 1px minmax(58px, 1.12fr) 34px !important;
        gap: 5px !important;
        padding-top: 8px;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-footer.wewoo-no-old-price {
        grid-template-columns: minmax(0, 1fr) 34px !important;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-price-block {
        gap: 2px;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-price-label {
        overflow: visible;
        font-size: 8px !important;
        line-height: 1.1 !important;
        white-space: nowrap;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-current-price {
        overflow: visible;
        font-size: 15px !important;
        line-height: 1 !important;
        letter-spacing: -0.25px;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-old-price {
        overflow: visible;
        font-size: 12px !important;
        line-height: 1 !important;
        letter-spacing: -0.2px;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-price-divider {
        display: block !important;
        height: 34px;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-cart-button {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        border-radius: 7px !important;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-cart-button svg {
        width: 20px;
        height: 20px;
        stroke-width: 1.8;
    }

    .wewoo-product-grid.wewoo-mobile-compact + .wewoo-price-note,
    .wewoo-product-grid.wewoo-mobile-compact ~ .wewoo-price-note {
        gap: 3px;
        margin-top: 10px;
        font-size: 10px !important;
        line-height: 1.35;
    }
}

@media (max-width: 390px) {
    .wewoo-product-grid.wewoo-mobile-compact {
        gap: 8px !important;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-content {
        padding: 9px !important;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-title {
        font-size: 11.5px !important;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-footer {
        grid-template-columns: minmax(42px, 0.85fr) 1px minmax(56px, 1.15fr) 32px !important;
        gap: 4px !important;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-product-footer.wewoo-no-old-price {
        grid-template-columns: minmax(0, 1fr) 32px !important;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-cart-button {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
    }

    .wewoo-product-grid.wewoo-mobile-compact .wewoo-cart-button svg {
        width: 18px;
        height: 18px;
    }
}

/* AJAX add-to-cart feedback */
.wewoo-cart-button[aria-disabled="true"] {
    cursor: wait;
}

.wewoo-cart-button.loading,
.wewoo-cart-button.added,
.wewoo-cart-button.wewoo-add-error {
    transform: none;
    pointer-events: none;
}

.wewoo-cart-button.loading {
    opacity: 0.78;
}

.wewoo-cart-button.added {
    background: #159447;
    color: #ffffff;
    opacity: 1;
}

.wewoo-cart-button.wewoo-add-error {
    background: #d63638;
    color: #ffffff;
    opacity: 1;
}

.wewoo-button-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: wewoo-button-spin .65s linear infinite;
}

.wewoo-button-check,
.wewoo-button-error {
    display: block;
    width: 34px !important;
    height: 34px !important;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4 !important;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.wewoo-button-status-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@keyframes wewoo-button-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .wewoo-button-spinner {
        animation-duration: 1.4s;
    }
}

.wewoo-cart-button {
    position: relative;
}
