/**
 * ePAL Plugin Frontend Styles
 * Bright and colorful styling for ePAL-calculated fields to distinguish them from regular WooCommerce fields
 */

/* ePAL Product-level fields in cart and checkout */
.woocommerce-cart-form .cart_item .product-name dl.variation dt,
.woocommerce-checkout .shop_table .cart_item .product-name dl.variation dt,
.woocommerce-cart .cart_item .product-name dl.variation dt {
    /* Target ePAL fields specifically by checking if they contain ePAL-related text */
}

/* ePAL Tax fields - bright purple/magenta theme */
.woocommerce dl.variation dt:contains("Tax"),
.woocommerce dl.variation dt[data-epal-field],
.epal-tax-field {
    background: linear-gradient(135deg, #e91e63, #9c27b0) !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    display: inline-block !important;
    margin-right: 5px !important;
    box-shadow: 0 2px 4px rgba(233, 30, 99, 0.3) !important;
    border: none !important;
}

/* ePAL Customs Duty fields - bright orange theme */
.woocommerce dl.variation dt:contains("Customs"),
.epal-customs-field {
    background: linear-gradient(135deg, #ff5722, #ff9800) !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    display: inline-block !important;
    margin-right: 5px !important;
    box-shadow: 0 2px 4px rgba(255, 87, 34, 0.3) !important;
    border: none !important;
}

/* ePAL B2B Excluded Tax fields - exact strikethrough like discount pricing */
.epal-b2b-excluded-value,
.epal-b2b-excluded-price {
    text-decoration: line-through !important;
    color: #666 !important;
    font-weight: normal !important;
}

/* ePAL Shipping Tax fields - bright teal theme */
.woocommerce dl.variation dt:contains("Shipping Tax"),
.epal-shipping-tax-field {
    background: linear-gradient(135deg, #009688, #00bcd4) !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    display: inline-block !important;
    margin-right: 5px !important;
    box-shadow: 0 2px 4px rgba(0, 150, 136, 0.3) !important;
    border: none !important;
}

/* ePAL Cart fees styling */
.woocommerce-cart-form .cart-subtotal tr.fee-line td:contains("Tax"),
.woocommerce-checkout-review-order .order-total tr.fee-line td:contains("Tax"),
.woocommerce-cart .cart-subtotal tr.fee-line td:contains("Customs"),
.woocommerce-checkout-review-order .order-total tr.fee-line td:contains("Customs"),
.epal-fee-label {
    position: relative;
}

.epal-fee-label::before {
    content: "ePAL";
    background: linear-gradient(135deg, #4caf50, #8bc34a) !important;
    color: white !important;
    padding: 2px 6px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 9px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin-right: 6px !important;
    vertical-align: middle !important;
    box-shadow: 0 1px 3px rgba(76, 175, 80, 0.4) !important;
}

/* General ePAL field styling for any field marked with epal_field */
.epal-calculated-field {
    background: linear-gradient(135deg, #673ab7, #3f51b5) !important;
    color: white !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    display: inline-block !important;
    margin-right: 5px !important;
    box-shadow: 0 2px 4px rgba(103, 58, 183, 0.3) !important;
    border: none !important;
    animation: epal-glow 2s ease-in-out infinite alternate;
}

/* Subtle glow animation for ePAL fields */
@keyframes epal-glow {
    from {
        box-shadow: 0 2px 4px rgba(103, 58, 183, 0.3);
    }
    to {
        box-shadow: 0 2px 8px rgba(103, 58, 183, 0.6);
    }
}

/* ePAL badge for values */
.epal-value-badge {
    background: linear-gradient(135deg, #ff4081, #e91e63) !important;
    color: white !important;
    padding: 2px 6px !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    font-size: 10px !important;
    margin-left: 4px !important;
    vertical-align: middle !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .epal-calculated-field,
    .epal-tax-field,
    .epal-customs-field,
    .epal-shipping-tax-field {
        font-size: 10px !important;
        padding: 3px 6px !important;
        margin-right: 3px !important;
    }
    
    .epal-fee-label::before {
        font-size: 8px !important;
        padding: 1px 4px !important;
        margin-right: 4px !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .epal-calculated-field,
    .epal-tax-field,
    .epal-customs-field,
    .epal-shipping-tax-field {
        background: #000 !important;
        color: #fff !important;
        border: 2px solid #fff !important;
    }
    
    .epal-fee-label::before {
        background: #000 !important;
        color: #fff !important;
        border: 1px solid #fff !important;
    }
}

/* Print styles */
@media print {
    .epal-calculated-field,
    .epal-tax-field,
    .epal-customs-field,
    .epal-shipping-tax-field {
        background: #000 !important;
        color: #fff !important;
        box-shadow: none !important;
        animation: none !important;
    }
}

/* ePAL Tax Toggle Button Styling */
.epal-toggle {
    display: inline-block !important;
    float: right !important;
    clear: both !important;
    margin-bottom: 8px !important;
    margin-top: 4px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 12px !important;
    font-weight: bold !important;
    color: #666 !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    transition: all 0.2s ease !important;
}

.epal-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
    color: #333 !important;
}

.epal-toggle:focus {
    outline: 2px solid #0073aa !important;
    outline-offset: 2px !important;
}

/* Ensure proper spacing after toggle buttons */
.epal-toggle + ul,
.epal-toggle + div {
    clear: both !important;
    margin-top: 4px !important;
}

/* ENHANCED FIX: Hide redundant prices under product titles comprehensively */
/* Target all possible price displays that appear under product titles */

/* Standard WooCommerce Classic Checkout */
.cart_item .product-name .woocommerce-Price-amount,
.checkout-review-order-table .product-name .woocommerce-Price-amount,
.cart_item .product-name .amount,
.checkout-review-order-table .product-name .amount,
.cart_item .product-name .price,
.checkout-review-order-table .product-name .price {
    display: none !important;
    visibility: hidden !important;
}

/* Block Checkout Selectors */
.wc-block-cart-item__product .wc-block-formatted-money-amount,
.wc-block-review-order-table .wc-block-cart-item__product .wc-block-formatted-money-amount,
.wc-block-cart-item__product-name .wc-block-formatted-money-amount {
    display: none !important;
    visibility: hidden !important;
}

/* Theme-specific common patterns */
.cart-item .entry-title .price,
.cart-item .product-title .price,
.order-review .product-name .price,
.checkout-product-title .price,
.product-info .product-name .price,
tr.cart_item td.product-name .price,
tr.cart_item td.product-name span.amount,
.shop_table .product-name .woocommerce-Price-amount,
.shop_table .product-name .amount {
    display: none !important;
    visibility: hidden !important;
}

/* Additional patterns for different themes */
.cart_item .product-title .woocommerce-Price-amount,
.cart_item .item-name .woocommerce-Price-amount,
.checkout-review-order-table .item-name .woocommerce-Price-amount,
.woocommerce-cart-form .product-name .woocommerce-Price-amount,
.woocommerce-checkout-review-order .product-name .woocommerce-Price-amount {
    display: none !important;
    visibility: hidden !important;
}

/* Ensure main prices on the right side remain visible and prominent */
.cart_item .product-subtotal,
.cart_item .product-total,
.checkout-review-order-table .product-subtotal,
.checkout-review-order-table .product-total,
.cart-item-price,
.item-total,
.wc-block-cart-item__total,
.wc-block-cart-item__price {
    display: table-cell !important;
    visibility: visible !important;
}

/* Ensure right-side price amounts are visible */
.cart_item .product-subtotal .woocommerce-Price-amount,
.cart_item .product-total .woocommerce-Price-amount,
.checkout-review-order-table .product-subtotal .woocommerce-Price-amount,
.checkout-review-order-table .product-total .woocommerce-Price-amount,
.product-subtotal .amount,
.product-total .amount {
    display: inline !important;
    visibility: visible !important;
    font-weight: bold !important;
}

/* Block checkout right-side prices */
.wc-block-cart-item__total .wc-block-formatted-money-amount,
.wc-block-cart-item__price .wc-block-formatted-money-amount {
    display: inline !important;
    visibility: visible !important;
}

/* Override any theme-specific hiding */
.checkout-review-order-table .product-total,
.cart_item .product-total {
    opacity: 1 !important;
    width: auto !important;
    max-width: none !important;
}
