/**
 * Custom Offers Frontend Styles
 *
 * Designed to match Mahi Organics / Mahi Max premium skincare aesthetic
 * with WoodMart theme compatibility.
 *
 * @package CustomOffers
 */

/* Container */
.custom-offers-container {
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    font-family: inherit;
}

.custom-offers-title {
    margin: 0 0 16px 0;
    padding: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cards Container */
.custom-offers-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Individual Card */
.custom-offers-card {
    position: relative;
    background: #fafafa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-offers-card:hover {
    border-color: #c9a227;
    background: #fffdf5;
}

.custom-offers-card.selected {
    border-color: #c9a227;
    background: #fffdf5;
    box-shadow: 0 2px 8px rgba(201, 162, 39, 0.15);
}

/* Best Value Badge */
.custom-offers-badge {
    position: absolute;
    top: -10px;
    right: 16px;
    background: linear-gradient(135deg, #c9a227 0%, #b8941f 100%);
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Card Header */
.custom-offers-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.custom-offers-quantity {
    font-size: 15px;
    font-weight: 600;
    color: #333333;
    flex-shrink: 0;
    min-width: 55px;
}

/* Product Mini Thumbnails */
.custom-offers-product-images {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.custom-offers-mini-thumb {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    background: #fff;
}

.custom-offers-plus {
    font-size: 12px;
    font-weight: 600;
    color: #999;
    line-height: 1;
}

/* Custom Radio Button */
.custom-offers-radio {
    width: 20px;
    height: 20px;
    border: 2px solid #cccccc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.custom-offers-card.selected .custom-offers-radio {
    border-color: #c9a227;
}

.custom-offers-radio-inner {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.2s ease;
}

.custom-offers-card.selected .custom-offers-radio-inner {
    background: #c9a227;
}

/* Card Body */
.custom-offers-card-body {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
}

.custom-offers-price {
    font-size: 18px;
    font-weight: 700;
    color: #c9a227;
}

.custom-offers-price .woocommerce-Price-amount {
    color: inherit;
}

.custom-offers-price-note {
    font-size: 12px;
    font-weight: 400;
    color: #666666;
    margin-left: 2px;
}

/* Savings */
.custom-offers-savings {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Per Unit Price for 3+ */
.custom-offers-per-unit {
    font-size: 12px;
    color: #666666;
    width: 100%;
    margin-top: 4px;
}

/* Dynamic Total Display */
.custom-offers-dynamic-total {
    background: #f5f5f5;
    border-radius: 6px;
    padding: 12px 16px;
    margin-top: 16px;
    border: 1px solid #e0e0e0;
}

.custom-offers-dynamic-total-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.custom-offers-dynamic-qty {
    font-weight: 600;
    color: #333333;
}

.custom-offers-dynamic-price {
    font-size: 18px;
    font-weight: 700;
    color: #c9a227;
}

.custom-offers-dynamic-savings {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Cart Label */
.custom-offers-cart-label {
    display: inline-block;
    background: #fffdf5;
    border: 1px solid #c9a227;
    color: #c9a227;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}

/* Checkout Label */
.custom-offers-checkout-label {
    color: #c9a227;
    font-weight: 600;
}

/* Order Item Meta (Admin) */
.custom-offers-order-item-meta {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e0e0e0;
}

.custom-offers-order-item-meta strong {
    color: #c9a227;
}

.custom-offers-order-item-meta .custom-offers-savings {
    margin-left: 8px;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .custom-offers-container {
        padding: 16px;
        margin: 16px 0;
    }

    .custom-offers-title {
        font-size: 14px;
    }

    .custom-offers-cards {
        gap: 10px;
    }

    .custom-offers-card {
        padding: 14px;
    }

    .custom-offers-quantity {
        font-size: 14px;
        min-width: 50px;
    }

    .custom-offers-price {
        font-size: 16px;
    }

    .custom-offers-badge {
        font-size: 9px;
        padding: 3px 10px;
    }

    .custom-offers-mini-thumb {
        width: 24px;
        height: 24px;
    }

    .custom-offers-plus {
        font-size: 10px;
    }
}

/* Small Mobile */
@media screen and (max-width: 480px) {
    .custom-offers-container {
        padding: 12px;
        margin: 12px 0;
        border-radius: 6px;
    }

    .custom-offers-card {
        padding: 12px;
    }

    .custom-offers-card-body {
        flex-direction: column;
        gap: 4px;
    }

    .custom-offers-dynamic-total-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .custom-offers-mini-thumb {
        width: 20px;
        height: 20px;
    }

    .custom-offers-product-images {
        gap: 2px;
    }

    .custom-offers-plus {
        font-size: 9px;
    }

    .custom-offers-quantity {
        min-width: 45px;
        font-size: 13px;
    }
}

/* Accessibility */
.custom-offers-card:focus {
    outline: 2px solid #c9a227;
    outline-offset: 2px;
}

.custom-offers-card:focus:not(:focus-visible) {
    outline: none;
}

/* Animation */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.4);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(201, 162, 39, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(201, 162, 39, 0);
    }
}

.custom-offers-card.best-value.selected {
    animation: pulse 1.5s ease-out;
}

/* WoodMart Theme Compatibility */
.woodmart-product-summary .custom-offers-container {
    margin-top: 15px;
    margin-bottom: 15px;
}

/* Hide offer cards inside sticky add-to-cart bar */
.wd-sticky-add-to-cart .custom-offers-container,
.sticky-add-to-cart .custom-offers-container,
.product-sticky-bar .custom-offers-container,
.wd-add-to-cart-fixed .custom-offers-container,
.wd-product-add-to-cart .custom-offers-container,
div[class*="sticky"] .custom-offers-container,
div[class*="floating"] .custom-offers-container,
div[id*="sticky"] .custom-offers-container {
    display: none !important;
}

/* Variation Support */
.custom-offers-container.variation-loading {
    opacity: 0.6;
    pointer-events: none;
}

.custom-offers-container.variation-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid #e0e0e0;
    border-top-color: #c9a227;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Print Styles */
@media print {
    .custom-offers-container {
        border: 1px solid #000;
        box-shadow: none;
    }

    .custom-offers-badge {
        background: #000;
        color: #fff;
    }

    .custom-offers-price {
        color: #000;
    }
}
