/* Override WooCommerce product list styles for grid layout */
/* IMPORTANT: The grid is applied to ul.products, NOT to .y-l-product-grid wrapper */
/* .y-l-product-grid is just a wrapper div - grid goes on the <ul> inside it */
.y-l-product-grid {
    /* Just a wrapper container when it's a div - no grid here */
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Remove ::before pseudo-element from products list that causes empty first grid position */
ul.products::before,
ul.products.columns-2::before,
ul.products.columns-3::before,
ul.products.columns-4::before,
ul.products.columns-5::before,
ul.products.columns-6::before,
.woocommerce ul.products::before,
.woocommerce ul.products.columns-2::before,
.woocommerce ul.products.columns-3::before,
.woocommerce ul.products.columns-4::before,
.woocommerce ul.products.columns-5::before,
.woocommerce ul.products.columns-6::before,
.y-l-product-grid ul.products::before,
.y-l-product-grid ul.products.columns-4::before {
    display: none !important;
    content: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* When .y-l-product-grid is directly on a <ul> (not a wrapper div), apply grid */
ul.y-l-product-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: var(--y-spacing-lg) !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}

/* Apply grid to the ul.products element */
.y-l-product-grid ul.products,
.y-l-product-grid ul.products.columns-4 {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: var(--y-spacing-lg) !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    clear: none !important;
    float: none !important;
}

/* Remove default list item styles */
.y-l-product-grid ul.products li,
.y-l-product-grid ul.products.columns-4 li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    float: none !important;
    clear: none !important;
    display: block !important;
    position: relative !important;
    z-index: 1 !important;
    /* Low z-index to ensure dropdowns appear above */
}

.y-c-card {
    background-color: var(--y-color-background-light);
    border-radius: var(--y-border-radius-lg);
    overflow: hidden;
    transition: var(--y-transition-default);
    box-shadow: var(--y-shadow-sm);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    /* Low z-index to ensure dropdowns appear above */
}

.y-c-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--y-shadow-md);
}

.y-c-card__link {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-decoration: none;
    color: inherit;
    z-index: 1;
}

.y-c-card__favorite {
    top: var(--y-spacing-lg);
    right: var(--y-spacing-lg);
    border-radius: var(--y-border-radius-full);
    width: var(--y-icon-size-md);
    height: var(--y-icon-size-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--y-transition-fast);
}

.y-c-card__top-actions {
    width: 95%;
    position: absolute;
    top: var(--y-spacing-md);
    right: var(--y-spacing-md);
    left: var(--y-spacing-md);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--y-spacing-sm);
    z-index: 2;
}

.y-c-card__discount {
    background-color: var(--y-color-primary);
    color: var(--y-color-secondary-text);
    padding: 2px var(--y-spacing-xs);
    font-size: var(--y-font-size-sm);
    font-weight: var(--y-font-weight-regular);
    display: flex;
    align-items: center;
    justify-content: center;
}

.y-c-card__favorite i {
    color: var(--y-color-third-text);
    font-size: var(--y-font-size-xl);
}

.y-c-card__favorite.active i {
    color: var(--y-color-primary);
}

.y-c-card__image-container {
    padding: var(--y-spacing-md);
    position: relative;
    min-height: calc(var(--y-spacing-3xl) * 3.6);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--y-color-background);
}

.y-c-card__image {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: calc(var(--y-spacing-3xl) * 3.6);
    max-height: calc(var(--y-spacing-3xl) * 3.6);
    object-fit: contain;
    display: block;
}

/* Out of Stock Badge */
.y-c-card__out-of-stock-badge {
    position: absolute;
    top: var(--y-spacing-md);
    left: var(--y-spacing-md);
    background-color: rgba(231, 76, 60, 0.9);
    color: var(--y-color-secondary-text);
    padding: var(--y-spacing-xs) var(--y-spacing-sm);
    border-radius: var(--y-border-radius-sm);
    font-size: var(--y-font-size-sm);
    font-weight: var(--y-font-weight-bold);
    z-index: 3;
}

/* Out of Stock Card Styling */
.y-c-card.out-of-stock {
    opacity: 0.7;
}

.y-c-card.out-of-stock .y-c-card__image {
    opacity: 0.6;
}

.y-c-card__body {
    padding: var(--y-spacing-md);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.y-c-card__category {
    font-size: var(--y-font-size-lg);
    font-weight: var(--y-font-weight-bold);
    color: var(--y-color-primary);
    margin-bottom: var(--y-spacing-sm);
}

.y-c-card__title {
    font-size: var(--y-font-size-lg);
    font-weight: var(--y-font-weight-regular);
    color: var(--y-color-text-primary);
    margin-bottom: var(--y-spacing-sm);
}

.y-c-card__footer {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    margin-top: auto;
    padding-left: calc(var(--y-icon-size-md) + var(--y-spacing-lg));
}

.y-c-card__actions {
    position: absolute;
    bottom: var(--y-spacing-sm);
    left: var(--y-spacing-sm);
    z-index: 2;
    display: flex;
    flex-direction: row;
}

.y-c-card__price {
    font-size: var(--y-font-size-lg);
    color: var(--y-color-primary);
    font-weight: var(--y-font-weight-regular);
    margin-bottom: var(--y-spacing-md);
    display: flex;
    align-items: center;
    gap: var(--y-spacing-xs);
    text-align: right;
}

.y-c-card__old-price {
    font-size: var(--y-font-size-sm);
    color: var(--y-color-third-text);
    text-decoration: line-through;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
}

.y-c-price-icon {
    width: var(--y-font-size-md);
    height: var(--y-font-size-md);
    margin-left: var(--y-spacing-xs);
    margin-right: 0;
    order: 1;
}

.y-c-price-icon-through {
    width: var(--y-font-size-sm);
    height: var(--y-font-size-sm);
    margin-left: var(--y-spacing-xs);
    margin-right: 0;
    order: 1;
}

.y-c-card__price--new {
    color: var(--y-color-primary-hover);
}

.y-c-card__favorite--primary i {
    color: var(--y-color-primary);
}

.y-c-card__favorite--primary:hover i {
    color: var(--y-color-primary-hover);
}

.y-c-category-card {
    margin-top: var(--y-spacing-lg);
    transition: var(--y-transition-default);
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}

.y-c-category-card:hover {
    transform: translateY(-5px);
    text-decoration: none;
    color: inherit;
}

.y-c-category-card img {
    display: block;
    width: 100%;
    height: auto;
}

.y-c-category-card h3 {
    margin: var(--y-spacing-md) 0 0 0;
    text-align: center;
    color: var(--y-color-primary-text);
}

.y-c-product-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--y-spacing-lg);
}

.y-c-product-list .y-c-card {
    height: 100%;
}

@media (max-width: 768px) {
    .y-c-product-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 2fr));
    }
}

@media (max-width: 480px) {
    .y-c-product-list {
        grid-template-columns: 1fr;
    }
}

/* Responsive styles for WooCommerce product grid */
@media (max-width: 991px) {
    .y-l-product-grid ul.products,
    .y-l-product-grid ul.products.columns-4 {
        grid-template-columns: repeat(3, 1fr) !important;
        display: grid !important;
    }
}

@media (max-width: 768px) {
    .y-l-product-grid ul.products,
    .y-l-product-grid ul.products.columns-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--y-spacing-md) !important;
        display: grid !important;
    }

    .y-c-card {
        margin-bottom: var(--y-spacing-md);
    }

    .y-c-card:hover {
        transform: none;
        box-shadow: var(--y-shadow-sm);
    }

    .y-c-card__image {
        height: calc(var(--y-spacing-3xl) * 3);
    }

    .y-c-card__body {
        padding: var(--y-spacing-sm);
    }

    .y-c-card__title {
        font-size: var(--y-font-size-md);
        margin-bottom: var(--y-spacing-xs);
    }

    .y-c-card__price {
        font-size: var(--y-font-size-sm);
        margin-bottom: var(--y-spacing-sm);
    }

    .y-c-card__old-price {
        font-size: var(--y-font-size-sm);
    }

    .y-c-price-icon {
        width: var(--y-font-size-sm);
        height: var(--y-font-size-sm);
    }

    .y-c-price-icon-through {
        width: calc(var(--y-font-size-sm) * 0.9);
        height: calc(var(--y-font-size-sm) * 0.9);
    }

}

@media (max-width: 480px) {
    .y-l-product-grid ul.products,
    .y-l-product-grid ul.products.columns-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--y-spacing-sm) !important;
        display: grid !important;
    }

    .y-c-card__image {
        height: calc(var(--y-spacing-3xl) * 2.4);
    }

    .y-c-card__title {
        font-size: var(--y-font-size-sm);
    }

    .y-c-price-icon {
        width: calc(var(--y-font-size-sm) * 0.9);
        height: calc(var(--y-font-size-sm) * 0.9);
    }

    .y-c-price-icon-through {
        width: calc(var(--y-font-size-sm) * 0.8);
        height: calc(var(--y-font-size-sm) * 0.8);
    }
}

.y-c-cart-summary-card {
    background-color: var(--y-color-background);
    border-radius: var(--y-border-radius-lg);
    padding: var(--y-spacing-lg);
    box-shadow: var(--y-shadow-sm);
}

.y-c-cart-summary-card h3 {
    margin-bottom: var(--y-spacing-md);
    color: var(--y-color-primary);
    font-weight: var(--y-font-weight-bold);
}

.y-c-cart-summary__row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--y-spacing-sm);
    padding-bottom: var(--y-spacing-xs);
    border-bottom: 1px solid var(--y-color-border);
}

.y-c-cart-summary__row--total {
    font-weight: var(--y-font-weight-bold);
    border-bottom: none;
    margin-top: var(--y-spacing-md);
    font-size: var(--y-font-size-lg);
    color: var(--y-color-primary-text);
}

.y-c-cart-summary__label {
    color: var(--y-color-text-primary);
}

.y-c-cart-summary__value {
    font-weight: var(--y-font-weight-semibold);
}

.y-c-cart-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--y-spacing-lg);
    padding: var(--y-spacing-md);
    border: 2px solid var(--y-color-primary);
    border-radius: var(--y-border-radius-md);
    background-color: var(--y-color-background);
    margin-bottom: var(--y-spacing-md);
    box-shadow: var(--y-shadow-sm);
}

.y-c-cart-item__product {
    flex: 0 0 120px;
}

.y-c-cart-item__image {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.y-c-cart-item__details {
    flex: 1;
}

.y-c-cart-item__details h2 {
    color: var(--y-color-primary);
    margin-bottom: var(--y-spacing-sm);
}

.y-c-cart-item__name {
    max-width: 300px;
    margin-bottom: var(--y-spacing-md);
}

.y-c-cart-item__price {
    display: flex;
    align-items: center;
    font-weight: var(--y-font-weight-semibold);
    font-size: var(--y-font-size-lg);
    color: var(--y-color-primary-text);
}

.y-c-cart-item__price img {
    width: var(--y-font-size-md);
    height: var(--y-font-size-md);
    margin-right: var(--y-spacing-xs);
}

.y-c-cart-item__actions {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--y-spacing-md);
}

.y-c-cart-item__remove-btn {
    background-color: transparent;
    padding: var(--y-spacing-xxs);
    border: 1px solid var(--y-color-error);
    border-radius: var(--y-border-radius-full);
    cursor: pointer;
    transition: var(--y-transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    min-width: 32px;
    min-height: 32px;
}

.y-c-cart-item__remove-btn:hover {
    color: var(--y-color-danger);
    text-decoration: none;
}

.y-c-cart-item__remove-btn i {
    color: var(--y-color-error);
    font-size: var(--y-font-size-lg);
}

@media (max-width: 768px) {
    .y-c-cart-summary-card {
        padding: var(--y-spacing-md);
    }

    .y-c-cart-summary-card h3 {
        font-size: var(--y-font-size-lg);
        margin-bottom: var(--y-spacing-sm);
    }

    .y-c-cart-summary__row {
        margin-bottom: var(--y-spacing-xs);
        padding-bottom: var(--y-spacing-xs);
    }

    .y-c-cart-summary__row--total {
        font-size: var(--y-font-size-md);
        margin-top: var(--y-spacing-sm);
    }

    .y-c-cart-item {
        padding: var(--y-spacing-sm);
        gap: var(--y-spacing-sm);
    }

    .y-c-cart-item__product {
        width: 100%;

        margin-bottom: var(--y-spacing-sm);
    }

    .y-c-cart-item__image {
        max-width: 150px;
    }

    .y-c-cart-item__details h2 {
        font-size: var(--y-font-size-lg);
    }

    .y-c-cart-item__name {
        font-size: var(--y-font-size-sm);
        margin-bottom: var(--y-spacing-sm);
    }

    .y-c-cart-item__price {
        font-size: var(--y-font-size-md);
    }

    .y-c-cart-item__actions {
        gap: var(--y-spacing-6xl);
    }
}

@media (max-width: 480px) {
    .y-c-cart-item__image {
        max-width: 120px;
    }

    .y-c-cart-item__details h2 {
        font-size: var(--y-font-size-md);
    }

    .y-c-cart-item__name {
        font-size: calc(var(--y-font-size-sm) - 1px);
    }

    .y-c-cart-item__remove-btn {
        font-size: var(--y-font-size-md);
    }
}

.y-c-auth-card {
    border-radius: var(--y-border-radius-lg);
    padding: var(--y-spacing-2xl);
    display: flex;
    flex-direction: column;
    gap: var(--y-spacing-xl);
}

.y-c-auth-card__title {
    font-size: var(--y-font-size-2xl);
    font-weight: var(--y-font-weight-bold);
    color: var(--y-color-primary);
    margin-bottom: var(--y-spacing-xl);
}