/**
 * Enhanced Ajial Product Card Styling
 * 
 * Modern styling for Ajial water bottles product cards with improved visual hierarchy
 */

/* Main Product Card Container */
.ajial-product-card {
    position: relative;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 86, 90, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    /* Add a pseudo-element for the top border effect */
    border-top: 3px solid transparent;
}

.ajial-product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0px 10px 30px rgb(142 209 252 / 60%);
    border-top: 3px solid #fcb900; /* Gold color for top border */
    background-image: linear-gradient(to bottom, rgba(252, 185, 0, 0.05) 0%, rgba(252, 185, 0, 0) 50%);
}

.ajial-product-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at top right, rgba(0, 86, 90, 0.05) 0%, rgba(0, 86, 90, 0) 70%);
    z-index: 0;
    transition: all 0.3s ease;
}

.ajial-product-card:hover::after {
    background: radial-gradient(circle at top right, rgba(252, 185, 0, 0.15) 0%, rgba(252, 185, 0, 0) 70%);
    width: 150px;
    height: 150px;
}

/* Gold corner accent */
.ajial-product-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 30px 30px 0;
    border-color: transparent transparent transparent transparent;
    transition: all 0.3s ease;
    z-index: 1;
}

.ajial-product-card:hover::before {
    border-color: transparent #fcb900 transparent transparent;
}

/* Product Header */
.ajial-product-header {
    text-align: center;
    position: relative;
    z-index: 1;
}

/* List view specific header styles */
.products-grid.list-view .ajial-product-header {
    text-align: left;
}

.ajial-product-title {
    color: #00565A;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.2;
    letter-spacing: 0.5px;
    position: relative;
    display: inline-block;
}

.ajial-product-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background-color: #fcb900;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.ajial-product-card:hover .ajial-product-title::after {
    width: 60px;
}

.ajial-product-subtitle {
    color: #555555;
    font-size: 15px;
    margin: 0;
    font-weight: 500;
}

/* Product Attributes */
.ajial-product-attributes {
    margin-top: 8px;
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.product-attribute {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.attribute-value {
    color: #fcb900;
    font-size: 18px;
    font-weight: bold;
    transition: color 0.3s ease;
}

.ajial-product-card:hover .attribute-value {
    color: #e6a800;
}

/* Product Attribute and Category */
.product-attribute-category {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    color: #555;
    font-size: 14px;
    background-color: rgba(0, 86, 90, 0.05);
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.ajial-product-card:hover .product-attribute-category {
    background-color: rgba(0, 86, 90, 0.08);
}

.product-attribute-category .attribute-value {
    color: #00565A;
    font-size: 14px;
    font-weight: 600;
}

.product-attribute-category .separator {
    margin: 0 5px;
    color: #777;
}

.product-attribute-category .category-value {
    color: #555;
    font-size: 14px;
    font-weight: 500;
}

/* Product Image */
.ajial-product-image {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 220px;
    padding: 15px;
    z-index: 1;
    margin: 10px 0 20px;
}

.ajial-product-image::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 160px;
    height: 160px;
    background-color: rgba(0, 86, 90, 0.03);
    border-radius: 50%;
    z-index: -1;
    transition: all 0.3s ease;
}

.ajial-product-card:hover .ajial-product-image::before {
    width: 180px;
    height: 180px;
    background-color: rgba(0, 86, 90, 0.05);
}

.ajial-product-image img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    transition: transform 0.5s ease;
    max-height: 220px;
    display: block;
    margin: 0 auto;
    /* filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.05)); */
}

.ajial-product-card:hover .ajial-product-image img {
    transform: scale(1.05);
}

/* Product Footer */
.ajial-product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
    z-index: 1;
    padding: 5px 0;
}

/* List view specific footer styles */
.products-grid.list-view .ajial-product-footer {
    margin: 15px 0;
    width: 100%;
}

/* Quantity Controls */
.ajial-product-quantity {
    display: flex;
    align-items: center;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
}

.ajial-product-card:hover .ajial-product-quantity {
    border-color: #d8d8d8;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
}

.ajial-quantity-btn {
    background: #f8f8f8;
    border: none;
    color: #333;
    font-size: 18px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ajial-quantity-btn:hover {
    background: #f0f0f0;
    color: #00565A;
}

.ajial-quantity-btn.decrease {
    border-right: 1px solid #e8e8e8;
}

.ajial-quantity-btn.increase {
    border-left: 1px solid #e8e8e8;
}

.ajial-quantity-input {
    width: 45px;
    height: 40px;
    border: none;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
    background-color: #fff;
    transition: border-color 0.3s, background-color 0.3s;
}

.ajial-quantity-input:focus {
    border-color: #00a8ff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 168, 255, 0.2);
}

.ajial-quantity-input::-webkit-outer-spin-button,
.ajial-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Price Display */
.ajial-product-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.price-currency {
    display: flex;
    align-items: center;
    color: #00565A;
    font-weight: 700;
    background-color: rgba(0, 86, 90, 0.05);
    padding: 5px 12px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.ajial-product-card:hover .price-currency {
    background-color: rgba(0, 86, 90, 0.08);
}

.currency-symbol {
    font-size: 18px;
    margin-right: 4px;
}

.price-amount {
    font-size: 24px;
    letter-spacing: 0.5px;
}

.price-discount {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 5px;
    font-weight: 600;
}

/* Product Buttons Container */
.ajial-product-buttons {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-top: 15px;
    padding: -1px;
    position: relative;
    z-index: 1;
    width: 100%;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: stretch;
}

/* List view specific button styles */
.products-grid.list-view .ajial-product-buttons {
    margin-top: 15px;
    justify-content: flex-start;
    gap: 15px;
    width: auto;
}

/* Add to Cart Button */
.ajial-add-to-cart {
    background-color: #fcb900;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 12px 48px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(252, 185, 0, 0.2);
    position: relative;
    overflow: hidden;
    text-transform: sentence;
    letter-spacing: 0.5px;
    flex: 1;
    min-height: 44px;
    transition: all 0.3s ease;
    transform: translateY(0);
}

.ajial-add-to-cart::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.4s ease;
}

.ajial-add-to-cart:hover {
    background-color: #e0a500;
    box-shadow: 0 6px 15px rgba(252, 185, 0, 0.3);
    transform: translateY(-2px);
}

.ajial-add-to-cart:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(252, 185, 0, 0.2);
}

.ajial-add-to-cart:hover::before {
    left: 100%;
}

.ajial-add-to-cart.disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
}

.cart-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #00a8ff;
    animation: spin 0.6s ease-in-out infinite;
}

/* Zero quantity styling */
.ajial-quantity-input.zero-quantity {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.05);
    border-color: rgba(231, 76, 60, 0.3);
}

/* Remove button styling */
.ajax-add-to-cart.is-update {
    background-color: #004a61;
    box-shadow: 0 2px 5px #a9ebff73;
    color: #ffffff;
}

/* Special styling for remove button */
.ajax-add-to-cart.is-removing {
    background-color: #e74c3c;
}

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

/* View Product Link */
.ajial-view-product {
    background-color: rgba(0, 86, 90, 0.05);
    color: #00565A;
    border: 1px solid rgba(0, 86, 90, 0.1);
    border-radius: 4px;
    padding: 12px 0;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: sentence;
    letter-spacing: 0.5px;
    min-height: 44px;
}

.ajial-view-product::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background-color: rgba(0, 86, 90, 0.1);
    transition: width 0.3s ease;
    z-index: -1;
}

.ajial-view-product:hover {
    background-color: rgba(0, 86, 90, 0.1);
    color: #003c3f;
    transform: translateY(-2px);
}

.ajial-view-product:active {
    transform: translateY(0);
    background-color: rgba(0, 86, 90, 0.08);
    color: #00565A;
}

.ajial-view-product:hover::before {
    width: 100%;
}

/* View Cart Button State */
.ajial-view-product.view-cart-active {
    background-color: rgba(252, 185, 0, 0.1);
    color: #e0a500;
    border: 1px solid rgba(252, 185, 0, 0.2);
}

.ajial-view-product.view-cart-active::before {
    background-color: rgba(252, 185, 0, 0.1);
}

.ajial-view-product.view-cart-active:hover {
    background-color: rgba(252, 185, 0, 0.15);
    color: #d69b00;
}

.ajial-view-product.view-cart-active:active {
    background-color: rgba(252, 185, 0, 0.1);
    color: #e0a500;
}

/* Hide WooCommerce default quantity input and use our custom one */
.ajial-product-card form.cart .quantity {
    display: none;
}

/* Shop Page Specific Styles */
.woocommerce ul.products li.ajial-shop-product {
    margin-bottom: 30px;
    padding: 0;
    list-style: none;
    float: none !important;
    width: auto !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
}

.woocommerce ul.products li.ajial-shop-product .ajial-product-card {
    height: 100%;
    margin-bottom: 0;
    max-width: none;
    width: 100%;
}

/* Adjust shop page grid layout */
.woocommerce ul.products {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
    width: 100%;
    clear: both;
}

/* Remove default WooCommerce borders and shadows */
.woocommerce ul.products li.product, 
.woocommerce-page ul.products li.product {
    border: none;
    box-shadow: none;
    background: transparent;
}

/* Ensure consistent styling with featured products */
.woocommerce ul.products li.product .price,
.woocommerce ul.products li.product .star-rating {
    display: none;
}

.woocommerce ul.products li.product .button {
    display: none;
}

.woocommerce ul.products li.product a img {
    margin: 0;
}

/* Responsive Adjustments */
@media (max-width: 991px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    /* Featured products grid - tablet view */
    .ajial-products-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

@media (max-width: 767px) {
    .ajial-product-card {
        max-width: 100%;
    }
    
    .woocommerce ul.products {
        grid-template-columns: repeat(1, 1fr);
        gap: 20px;
    }
    
    .woocommerce ul.products li.ajial-shop-product .ajial-product-card {
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* Featured products grid - mobile view (one per row) */
    .ajial-products-grid {
        display: block !important;
        grid-template-columns: unset !important;
        gap: 0 !important;
        width: 100% !important;
    }
    
    .ajial-products-grid > * {
        margin-bottom: 20px;
    }
    
    /* Center the product cards on mobile */
    .ajial-products-grid .ajial-product-card {
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
        display: block;
    }
    
    .ajial-product-card {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .price-amount {
        font-size: 20px;
    }
    
    .ajial-product-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .ajax-add-to-cart {
        width: 100%;
    }
}

/* Base styles for ajial-products-grid */
.ajial-products-grid {
    display: grid;
    gap: 30px;
    width: 100%;
}

/* Column configurations based on the shortcode attribute */
.ajial-products-grid.ajial-columns-1 { grid-template-columns: 1fr; }
.ajial-products-grid.ajial-columns-2 { grid-template-columns: repeat(2, 1fr); }
.ajial-products-grid.ajial-columns-3 { grid-template-columns: repeat(3, 1fr); }
.ajial-products-grid.ajial-columns-4 { grid-template-columns: repeat(4, 1fr); }

/* RTL Support */
.rtl .ajial-product-price {
    align-items: flex-start;
}

.rtl .currency-symbol {
    margin-right: 0;
    margin-left: 2px;
}

.rtl .cart-icon {
    margin-right: 0;
    margin-left: 8px;
}
