/**
 * Product Card CSS
 * Styles for WooCommerce product cards (content-product.php)
 *
 * @package AC_Child
 */

/* ========================================
   PRODUCT CARD - BASE STYLES
   ======================================== */

/* Product Card Container */
.ac-product-card {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ac-product-card-inner {
    position: relative;
    background-color: #f5f5f5;
}

/* ========================================
   PRODUCT BADGES
   ======================================== */

/* Product Badges Wrapper - Top Left */
.ac-product-badges-wrapper {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

/* Product Badge Styles */
.ac-product-badge {
    display: inline-block;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

/* Nuovo Badge - White background with black border */
.ac-badge-nuovo {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #000000;
}

/* Usato Badge - Brown/Orange background with white text */
.ac-badge-usato {
    background-color: #c45a3b;
    color: #ffffff;
}

/* Usato-vintage Badge - Brown/Orange background with white text */
.ac-badge-usato_vintage {
    background-color: #01a189;
    color: #ffffff;
}

/* Ex-demo Badge - Gray background with white text */
.ac-badge-ex_demo {
    background-color: #666666;
    color: #ffffff;
}

/* Sale Badge */
.ac-badge-sale {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #000000;
}

/* Legacy badge styles for compatibility */
.ac-product-badge.badge-new {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #000000;
}

.ac-product-badge.badge-used {
    background-color: #c45a3b;
    color: #ffffff;
}

.ac-product-badge.badge-ex-demo {
    background-color: #f5f5f5;
    color: #000000;
}

.ac-product-badge.badge-bestseller {
    background-color: #c45a3b;
    color: #ffffff;
}

.ac-product-badge.badge-back-in-stock {
    background-color: #c45a3b;
    color: #ffffff;
}

/* ========================================
   CART STATUS ICON
   ======================================== */

/* Cart Status Icon - Top Right */
.ac-product-cart-status {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ac-product-cart-status svg {
    width: 33px;
    height: 33px;
    color: #000000;
}

/* ========================================
   PRODUCT IMAGE
   ======================================== */

/* Product Image Link */
.ac-product-image-link {
    display: block;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    overflow: hidden;
    background-color: #f5f5f5;
    position: relative;
}

.ac-product-image-link img,
.ac-product-image-link img.ac-product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.ac-product-card:hover .ac-product-image-link img {
    transform: scale(1.02);
}

/* ========================================
   PRODUCT INFO
   ======================================== */

/* Product Info */
.ac-product-info {
    padding: 20px 0 0 0;
    background-color: #ffffff;
}

/* ========================================
   PRODUCT INFO LAYOUT (Unified)
   ======================================== */

/* Unified layout - applies to all screen sizes */
.ac-product-info-layout {
    display: block;
    padding: 12px 0 0 0;
}

/* Row layout - flex with space-between */
.ac-info-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

/* Product title styles */
.ac-info-row .ac-product-title {
    font-family: "Delight", sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #000000;
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

.ac-info-row .ac-product-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.ac-info-row .ac-product-title a:hover {
    color: #c45a3b;
}

/* Final price styles */
.ac-product-final-price {
    font-family: "Delight", sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #000000;
    white-space: nowrap;
    flex-shrink: 0;
}

.ac-product-final-price ins {
    text-decoration: none;
}

/* Category styles */
.ac-info-row .ac-product-category {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: #666666;
    margin: 0;
    flex: 1;
}

/* Original price styles */
.ac-product-original-price {
    font-family: "Delight", sans-serif;
    font-size: 12px;
    font-weight: 400;
    color: #999999;
    white-space: nowrap;
    flex-shrink: 0;
}

.ac-product-original-price del {
    text-decoration: line-through;
}

/* Legacy styles - hide old layout elements */
.ac-product-title-row,
.ac-category-desktop,
.ac-price-desktop {
    display: none !important;
}

/* ========================================
   PRODUCT CARD - ARCHIVE CONTEXT
   ======================================== */

/* Product card in archive grid */
.ac-product-archive .products .product {
    margin: 0 !important;
    margin-bottom: 10px !important;
    padding: 0;
    width: 100% !important;
    float: none !important;
    clear: none !important;
    position: relative;
}

.ac-product-archive .products .product .woocommerce-LoopProduct-link {
    display: block;
    text-decoration: none;
}

/* Product Image - Default WooCommerce image styling */
.ac-product-archive .products .product .woocommerce-loop-product__link {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #f5f5f5;
}

.ac-product-archive .products .product .woocommerce-loop-product__link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
}

.ac-product-archive .products .product:hover .woocommerce-loop-product__link img {
    transform: scale(1.02);
}

/* Legacy WooCommerce title styles */
.ac-product-archive .products .product .woocommerce-loop-product__title {
    font-family: "Delight", sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #000000;
    margin: 0 0 5px 0;
    line-height: 1.3;
    text-transform: none;
}

/* Legacy product category/subtitle */
.ac-product-archive .products .product .product-category-subtitle,
.ac-product-archive .products .product .product-subtitle {
    font-size: 13px;
    font-weight: 400;
    color: #666666;
    margin: 0 0 5px 0;
    display: block;
}

/* Legacy price styles */
.ac-product-archive .products .product .price {
    font-family: "Delight", sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #000000;
    margin: 0;
}

.ac-product-archive .products .product .price del {
    font-size: 14px;
    font-weight: 400;
    color: #999999;
    margin-left: 10px;
}

.ac-product-archive .products .product .price ins {
    text-decoration: none;
}

/* Product Badges */
.ac-product-archive .products .product .onsale {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #c45a3b;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 3px;
    z-index: 5;
}

/* Hide default WooCommerce button */
.ac-product-archive .products .product .button {
    display: none;
}

/* ========================================
   RELATED PRODUCTS - SINGLE PRODUCT
   ======================================== */

/* Related products grid */
.ac-sp-sidebar-related .products {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ac-sp-sidebar-related .products .ac-product-card {
    width: 100%;
}

.ac-sp-sidebar-related .products .ac-product-card-inner {
    position: relative;
    background-color: #f5f5f5;
}

.ac-sp-sidebar-related .products .ac-product-badges-wrapper {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 10;
}

.ac-sp-sidebar-related .products .ac-product-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.ac-sp-sidebar-related .products .ac-badge-nuovo {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #000000;
}

.ac-sp-sidebar-related .products .ac-badge-usato {
    background-color: #c45a3b;
    color: #ffffff;
}

.ac-sp-sidebar-related .products .ac-badge-usato_vintage {
    background-color: #c45a3b;
    color: #ffffff;
}

.ac-sp-sidebar-related .products .ac-badge-ex_demo {
    background-color: #666666;
    color: #ffffff;
}

.ac-sp-sidebar-related .products .ac-product-cart-status {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ac-sp-sidebar-related .products .ac-product-cart-status svg {
    width: 24px;
    height: 24px;
    color: #000000;
}

.ac-sp-sidebar-related .products .ac-product-image-link {
    display: block;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    overflow: hidden;
    background-color: #f5f5f5;
    position: relative;
}

.ac-sp-sidebar-related .products .ac-product-image-link img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.ac-sp-sidebar-related .products .ac-product-info {
    padding: 12px 0 0 0;
    background-color: #ffffff;
}

.ac-sp-sidebar-related .products .ac-info-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.ac-sp-sidebar-related .products .ac-product-title {
    font-family: 'Delight', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #000000;
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

.ac-sp-sidebar-related .products .ac-product-title a {
    color: inherit;
    text-decoration: none;
}

.ac-sp-sidebar-related .products .ac-product-final-price {
    font-family: 'Delight', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #000000;
    white-space: nowrap;
    flex-shrink: 0;
}

.ac-sp-sidebar-related .products .ac-product-category {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #666666;
    margin: 0;
    flex: 1;
}

.ac-sp-sidebar-related .products .ac-product-original-price {
    font-family: 'Delight', sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #999999;
    white-space: nowrap;
    flex-shrink: 0;
}

.ac-sp-sidebar-related .products .ac-product-original-price del {
    text-decoration: line-through;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

/* Desktop specific adjustments */
@media (min-width: 769px) {
    .ac-product-info-layout {
        padding: 0 10px 10px 10px;
    }

    .ac-info-row .ac-product-title {
        font-size: 16px;
    }

    .ac-product-final-price {
        font-size: 16px;
    }

    .ac-info-row .ac-product-category {
        font-size: 13px;
    }

    .ac-product-original-price {
        font-size: 13px;
    }

    .ac-product-badges-wrapper {
        top: 15px;
        left: 15px;
    }

    .ac-product-cart-status {
        top: 15px;
        right: 15px;
    }

    .ac-product-cart-status svg {
        width: 33px;
        height: 33px;
    }
}

/* Mobile styles */
@media (max-width: 768px) {
    .ac-product-info {
        padding: 0 12px 12px 12px !important;
    }

    /* Mobile Product Card Styles */
    .ac-product-badges-wrapper {
        top: 10px;
        left: 10px;
        gap: 5px;
    }

    .ac-product-badge {
        padding: 4px 10px;
        font-size: 10px !important;
    }

    .ac-product-cart-status {
        top: 10px;
        right: 10px;
    }

    .ac-product-cart-status svg {
        width: 27px !important;
        height: 27px !important;
    }

    .ac-product-title {
        font-size: 14px;
    }

    .ac-product-category {
        font-size: 12px;
    }

    .ac-product-archive .products .product {
        display: flex;
        flex-direction: column;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .ac-product-archive .products .product * {
        box-sizing: border-box;
    }

    /* Prevent text from overflowing */
    .ac-product-archive .products .product .ac-product-title,
    .ac-product-archive .products .product .ac-product-category,
    .ac-product-archive .products .product .ac-product-final-price,
    .ac-product-archive .products .product .ac-product-original-price {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ac-product-archive .products .product .ac-product-card-inner {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    /* Ensure product images have equal aspect ratio and size on mobile */
    .ac-product-archive .products .product .ac-product-image-link,
    .ac-product-archive .products .product .woocommerce-loop-product__link {
        aspect-ratio: 1 / 1;
        height: calc(50vw - 15px);
        width: 100%;
        overflow: hidden;
        flex-shrink: 0;
        padding-bottom: 0 !important;
    }
}

@media (max-width: 480px) {
    .ac-product-archive .products .product .woocommerce-loop-product__title {
        font-size: 14px;
    }

    .ac-product-archive .products .product .price {
        font-size: 16px;
    }

    /* Ensure product images have equal aspect ratio and size on mobile (480px) */
    .ac-product-archive .products .product .ac-product-image-link,
    .ac-product-archive .products .product .woocommerce-loop-product__link {
        aspect-ratio: 1 / 1;
        height: calc(50vw - 12px);
        width: 100%;
        overflow: hidden;
        flex-shrink: 0;
        padding-bottom: 0 !important;
    }
}
