/* ==========================================
   METAKATA CLICK ORDER STYLES
   Combined styles for Simple & External Products
   ========================================== */

/* Common Button Styles */
.metakata-whatsapp-button-shop,
.metakata-external-button-shop {
    display: block;
    margin-bottom: 10px;
    text-align: center;
    width: 100%;
}

.metakata-whatsapp-button-shop a,
.metakata-external-button-shop a {
    display: inline-block;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 4px;
    transition: all 0.3s ease;
    min-width: 160px;
    text-align: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.metakata-whatsapp-button-single,
.metakata-external-button-single {
    margin: 20px 0;
    text-align: center;
}

.metakata-whatsapp-button-single a,
.metakata-external-button-single a {
    display: inline-block;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    padding: 12px 30px;
    border-radius: 6px;
    transition: all 0.3s ease;
    min-width: 220px;
    text-align: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* WhatsApp Button Specific Styles */
.metakata-whatsapp-button-shop a {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white !important;
}

.metakata-whatsapp-button-shop a:hover {
    background: linear-gradient(135deg, #128C7E 0%, #075E54 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.metakata-whatsapp-button-single a {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white !important;
    font-size: 18px;
    padding: 15px 40px;
}

.metakata-whatsapp-button-single a:hover {
    background: linear-gradient(135deg, #128C7E 0%, #075E54 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

/* External/Affiliate Button Specific Styles */
.metakata-external-button-shop a {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white !important;
}

.metakata-external-button-shop a:hover {
    background: linear-gradient(135deg, #005a87 0%, #004466 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.metakata-external-button-single a {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white !important;
    font-size: 18px;
    padding: 15px 40px;
}

.metakata-external-button-single a:hover {
    background: linear-gradient(135deg, #005a87 0%, #004466 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

/* Icons */
.whatsapp-icon,
.external-icon {
    margin-right: 8px;
    font-size: 18px;
    vertical-align: middle;
}

.external-icon {
    font-size: 16px;
}

/* Product Type Specific Adjustments */
.products .product.product-type-external .price,
.products .product.product-type-external .woocommerce-loop-product__title,
.products .product.product-type-external .star-rating {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.products .product.product-type-simple .price,
.products .product.product-type-simple .woocommerce-loop-product__title,
.products .product.product-type-simple .star-rating {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/* Center buttons in product loop */
.woocommerce ul.products li.product {
    text-align: center;
    position: relative;
}

.woocommerce ul.products li.product .metakata-whatsapp-button-shop,
.woocommerce ul.products li.product .metakata-external-button-shop {
    margin-top: 10px;
    margin-bottom: 15px;
}

/* Single Product Page Adjustments */
.single-product.product-type-external .product_title,
.single-product.product-type-external .price,
.single-product.product-type-external .woocommerce-product-details__short-description {
    text-align: center;
}

.single-product.product-type-simple .product_title,
.single-product.product-type-simple .price,
.single-product.product-type-simple .woocommerce-product-details__short-description {
    text-align: center;
}

/* Hide default WooCommerce buttons for external products when YITH Catalog Mode is active */
.yith-catalog-mode .product-type-external .single_add_to_cart_button,
.yith-catalog-mode .product-type-external .add_to_cart_button {
    display: none !important;
}

/* Ensure our buttons are visible */
.yith-catalog-mode .metakata-whatsapp-button-shop,
.yith-catalog-mode .metakata-whatsapp-button-single,
.yith-catalog-mode .metakata-external-button-shop,
.yith-catalog-mode .metakata-external-button-single {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* ==========================================
   YITH CATALOG MODE COMPATIBILITY
   ========================================== */

/* Hide WooCommerce elements when YITH Catalog Mode is active */
.yith-catalog-mode .price,
.yith-catalog-mode .woocommerce-variation-price,
.yith-catalog-mode .woocommerce-variation-add-to-cart,
.yith-catalog-mode .quantity,
.yith-catalog-mode .single_add_to_cart_button,
.yith-catalog-mode .add_to_cart_button {
    display: none !important;
}

/* Adjust product display for catalog mode */
.products .product {
    position: relative;
    text-align: center;
}

/* ==========================================
   CART & CHECKOUT PAGES HANDLING
   ========================================== */

/* Hide cart, checkout, and my account pages when catalog mode is active */
body.yith-catalog-mode .woocommerce-cart,
body.yith-catalog-mode .woocommerce-checkout,
body.yith-catalog-mode .woocommerce-account {
    display: none !important;
}

/* Hide cart/checkout menu items */
.menu-item-object-page[href*="cart"],
.menu-item-object-page[href*="checkout"],
.menu-item-object-page[href*="my-account"] {
    display: none !important;
}

/* ==========================================
   PRODUCT PAGE ADJUSTMENTS
   ========================================== */

/* Adjust spacing for single product page */
.single-product .product_meta,
.single-product .woocommerce-tabs,
.single-product .related {
    margin-top: 20px;
}

/* Center buttons on single product */
.single-product .metakata-whatsapp-button-single,
.single-product .metakata-external-button-single {
    text-align: center;
}

/* ==========================================
   RESPONSIVE ADJUSTMENTS
   ========================================== */

@media (max-width: 768px) {
    .metakata-whatsapp-button-single a,
    .metakata-external-button-single a {
        padding: 12px 25px !important;
        font-size: 16px !important;
        min-width: 180px !important;
    }
    
    .metakata-whatsapp-button-shop a,
    .metakata-external-button-shop a {
        padding: 7px 12px !important;
        font-size: 13px !important;
        min-width: 140px !important;
    }
    
    .whatsapp-icon,
    .external-icon {
        font-size: 16px;
        margin-right: 5px;
    }
}

@media (max-width: 480px) {
    .metakata-whatsapp-button-single a,
    .metakata-external-button-single a {
        padding: 10px 20px !important;
        font-size: 14px !important;
        min-width: 160px !important;
    }
    
    .metakata-whatsapp-button-shop a,
    .metakata-external-button-shop a {
        padding: 6px 10px !important;
        font-size: 12px !important;
        min-width: 120px !important;
    }
    
    .products .product .metakata-whatsapp-button-shop,
    .products .product .metakata-external-button-shop {
        margin-top: 8px;
        margin-bottom: 12px;
    }
}

/* ==========================================
   ANIMATIONS & TRANSITIONS
   ========================================== */

.metakata-whatsapp-button-shop a,
.metakata-external-button-shop a,
.metakata-whatsapp-button-single a,
.metakata-external-button-single a {
    transition: all 0.3s ease-in-out;
}

/* Hover effects */
.metakata-whatsapp-button-shop a:hover,
.metakata-external-button-shop a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ==========================================
   COMPATIBILITY STYLES (Backward Compatibility)
   ========================================== */

/* Support for old class names */
.occto-whatsapp-button {
    composes: metakata-whatsapp-button-shop;
}

.occto-whatsapp-button a {
    color: #fff;
    text-decoration: none;
}

.occto-whatsapp-button a:hover {
    color: #fff;
    text-decoration: none;
}

/* Ensure compatibility with various themes */
.woocommerce .metakata-whatsapp-button-shop a,
.woocommerce .metakata-external-button-shop a,
.woocommerce .metakata-whatsapp-button-single a,
.woocommerce .metakata-external-button-single a {
    border: none;
    cursor: pointer;
}

/* ==========================================
   ACCESSIBILITY ENHANCEMENTS
   ========================================== */

.metakata-whatsapp-button-single a:focus,
.metakata-whatsapp-button-shop a:focus,
.metakata-external-button-single a:focus,
.metakata-external-button-shop a:focus {
    outline: 3px solid rgba(37, 211, 102, 0.5);
    outline-offset: 2px;
}

/* Screen reader text */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================
   BUTTON ALIGNMENT FIXES
   ========================================== */

/* Center align all buttons */
.woocommerce .metakata-whatsapp-button-shop,
.woocommerce .metakata-external-button-shop,
.woocommerce .metakata-whatsapp-button-single,
.woocommerce .metakata-external-button-single {
    text-align: center;
}

/* Product loop items should center their content */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product .price,
.woocommerce ul.products li.product .star-rating {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/* Make sure buttons don't break layout */
.metakata-whatsapp-button-shop,
.metakata-external-button-shop {
    clear: both;
    float: none;
}

/* ==========================================
   PRODUCT TYPE VISUAL INDICATORS (Optional)
   ========================================== */

.product-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 10;
}

.product-type-badge.simple {
    background: rgba(37, 211, 102, 0.9);
    color: white;
}

.product-type-badge.external {
    background: rgba(0, 115, 170, 0.9);
    color: white;
}