/**
 * Public Styles for Elafhouse Offers
 * 
 * @package Elafhouse_Offers
 */

/* =====================================================
   Offer Messages
   ===================================================== */

.elafhouse-offer-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    animation: elafhouse-slideIn 0.4s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.elafhouse-offer-message.elafhouse-message-promo {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-right: 4px solid #2ecc71;
}

.elafhouse-offer-message.elafhouse-message-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-right: 4px solid #28a745;
}

.elafhouse-offer-message.elafhouse-message-info {
    background: linear-gradient(135deg, #e7f3ff 0%, #cce5ff 100%);
    border-right: 4px solid #0d6efd;
}

.elafhouse-offer-message .offer-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.elafhouse-offer-message .offer-text {
    flex: 1;
}

/* Fade out animation */
.elafhouse-offer-message.elafhouse-fade-out {
    animation: elafhouse-fadeOut 0.5s ease-out forwards;
}

/* =====================================================
   Gift Badge
   ===================================================== */

.elafhouse-gift-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    margin-right: 8px;
    /* Background color is set dynamically via inline style */
    background: #2ecc71 !important;
    color: #fff !important;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    animation: elafhouse-pulse 2s infinite;
}

.elafhouse-gift-badge::before {
    content: "🎁";
    font-size: 12px;
}

/* =====================================================
   Product Offers Section
   ===================================================== */

.elafhouse-product-offers {
    margin: 20px 0;
}

.elafhouse-product-offers .elafhouse-offer-message {
    margin-bottom: 10px;
}

/* Force LTR direction for offer messages (English style) */
.elafhouse-ltr-message,
.elafhouse-offer-message.elafhouse-ltr-message {
    direction: ltr !important;
    text-align: left !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    border-left: none !important;
    border-right: 4px solid #2ecc71 !important;
}

.elafhouse-ltr-message.elafhouse-message-success {
    border-right-color: #28a745 !important;
}

.elafhouse-ltr-message.elafhouse-message-info {
    border-right-color: #0d6efd !important;
}

.elafhouse-ltr-message .offer-text {
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: normal !important;
}

/* =====================================================
   Message Styles Variants
   ===================================================== */

/* Style: Classic (Default) - حدود جانبية ملونة */
.elafhouse-style-classic {
    border-radius: 8px;
    border-right: 4px solid #2ecc71;
    border-left: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Style: Modern - ظل وزوايا دائرية كبيرة */
.elafhouse-style-modern {
    border-radius: 16px;
    border: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 18px 24px;
}

.elafhouse-style-modern .offer-icon {
    font-size: 28px;
}

/* Style: Minimal - خلفية شفافة مع حدود خفيفة */
.elafhouse-style-minimal {
    background: transparent !important;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    box-shadow: none;
    padding: 12px 16px;
}

.elafhouse-style-minimal .offer-icon {
    opacity: 0.8;
}

/* Style: Rounded - أيقونة دائرية مميزة */
.elafhouse-style-rounded {
    border-radius: 12px;
    border: none;
    padding: 16px 20px;
    position: relative;
    padding-left: 60px;
}

.elafhouse-style-rounded .offer-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

/* Style: Banner - شريط عريض ملون بالكامل */
.elafhouse-style-banner {
    border-radius: 0;
    border: none;
    padding: 20px 24px;
    margin-left: -20px;
    margin-right: -20px;
    width: calc(100% + 40px);
    text-align: center !important;
    justify-content: center !important;
}

.elafhouse-style-banner .offer-icon {
    font-size: 26px;
}

.elafhouse-style-banner .offer-text {
    font-weight: 600;
    font-size: 1.1em;
}

/* =====================================================
   Cart Item Styling
   ===================================================== */

/* Strikethrough price */
.cart_item .product-price del {
    color: #999;
    font-size: 0.9em;
    margin-left: 5px;
}

.cart_item .product-price ins {
    text-decoration: none;
    color: #2ecc71;
    font-weight: 600;
}

/* Free item row highlight */
.cart_item.elafhouse-free-item {
    background-color: rgba(46, 204, 113, 0.05);
}

/* =====================================================
   Animations
   ===================================================== */

@keyframes elafhouse-slideIn {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes elafhouse-fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes elafhouse-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* =====================================================
   Offer Button
   ===================================================== */

.elafhouse-offer-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

.elafhouse-offer-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
    color: #fff;
}

.elafhouse-offer-button:active {
    transform: translateY(0);
}

/* =====================================================
   Mini Cart Styles
   ===================================================== */

.widget_shopping_cart .elafhouse-gift-badge {
    font-size: 9px;
    padding: 2px 6px;
}

/* =====================================================
   Responsive Design
   ===================================================== */

@media screen and (max-width: 768px) {
    .elafhouse-offer-message {
        flex-direction: row;
        padding: 12px 15px;
        font-size: 13px;
    }

    .elafhouse-offer-message .offer-icon {
        font-size: 20px;
    }

    .elafhouse-gift-badge {
        font-size: 10px;
        padding: 2px 8px;
    }

    .elafhouse-product-offers {
        margin: 15px 0;
    }
}

@media screen and (max-width: 480px) {
    .elafhouse-offer-message {
        padding: 10px 12px;
        font-size: 12px;
        gap: 8px;
    }

    .elafhouse-offer-message .offer-icon {
        font-size: 18px;
    }

    .elafhouse-offer-button {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }
}

/* =====================================================
   RTL Support
   ===================================================== */

[dir="rtl"] .elafhouse-offer-message,
html[lang="ar"] .elafhouse-offer-message,
body.rtl .elafhouse-offer-message {
    direction: rtl;
    text-align: right;
    border-right: none;
    border-left: 4px solid #2ecc71;
    flex-direction: row-reverse;
}

[dir="rtl"] .elafhouse-offer-message .offer-text,
html[lang="ar"] .elafhouse-offer-message .offer-text,
body.rtl .elafhouse-offer-message .offer-text {
    direction: rtl;
    text-align: right;
    unicode-bidi: embed;
}

[dir="rtl"] .elafhouse-message-success,
html[lang="ar"] .elafhouse-message-success,
body.rtl .elafhouse-message-success {
    border-left-color: #28a745;
}

[dir="rtl"] .elafhouse-message-promo,
html[lang="ar"] .elafhouse-message-promo,
body.rtl .elafhouse-message-promo {
    border-left-color: #2ecc71;
}

[dir="rtl"] .elafhouse-message-info,
html[lang="ar"] .elafhouse-message-info,
body.rtl .elafhouse-message-info {
    border-left-color: #0d6efd;
}

[dir="rtl"] .elafhouse-gift-badge,
html[lang="ar"] .elafhouse-gift-badge,
body.rtl .elafhouse-gift-badge {
    margin-right: 0;
    margin-left: 8px;
    direction: rtl;
}

[dir="rtl"] .cart_item .product-price del,
html[lang="ar"] .cart_item .product-price del,
body.rtl .cart_item .product-price del {
    margin-left: 0;
    margin-right: 5px;
}

/* =====================================================
   Woodmart Theme Compatibility
   ===================================================== */

.woodmart-cart-design-1 .elafhouse-offer-message,
.woodmart-cart-design-2 .elafhouse-offer-message,
.woodmart-cart-design-3 .elafhouse-offer-message {
    margin: 0 0 20px;
}

.woodmart-shopping-cart .elafhouse-gift-badge {
    margin-top: 5px;
    display: block;
    width: fit-content;
}

/* Mini cart in Woodmart */
.wd-dropdown-cart .elafhouse-gift-badge {
    font-size: 9px;
    margin-top: 3px;
}

/* Product page in Woodmart */
.single-product .elafhouse-product-offers {
    clear: both;
    margin-top: 25px;
}

/* Checkout page */
.woocommerce-checkout .elafhouse-offer-message {
    margin-bottom: 25px;
}

/* Order received page */
.woocommerce-order-received .elafhouse-gift-badge {
    vertical-align: middle;
}

/* =====================================================
   Print Styles
   ===================================================== */

@media print {
    .elafhouse-offer-message {
        border: 1px solid #ccc;
        box-shadow: none;
    }

    .elafhouse-gift-badge {
        background: #eee;
        color: #333;
        box-shadow: none;
    }
}

/* =====================================================
   Shop Page - Free Eligible Badge
   ===================================================== */

.elafhouse-free-badge-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

span.elafhouse-free-eligible-badge,
.elafhouse-free-badge-wrapper .elafhouse-free-eligible-badge,
.elafhouse-free-eligible-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: linear-gradient(135deg, #722F37 0%, #8B1A1A 50%, #A52A2A 100%) !important;
    color: #fff !important;
    padding: 8px 16px !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    border-radius: 25px !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    box-shadow:
        0 4px 15px rgba(114, 47, 55, 0.5),
        0 0 20px rgba(139, 26, 26, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
    animation: elafhouse-badge-glow 2s ease-in-out infinite !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    position: relative !important;
    overflow: hidden !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    text-decoration: none !important;
}

/* Badge icon is now included in HTML for better compatibility */

.elafhouse-free-eligible-badge::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 70%
    );
    animation: elafhouse-shine 3s ease-in-out infinite;
}

@keyframes elafhouse-badge-glow {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 4px 15px rgba(114, 47, 55, 0.5),
            0 0 20px rgba(139, 26, 26, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow:
            0 6px 20px rgba(114, 47, 55, 0.6),
            0 0 30px rgba(139, 26, 26, 0.5);
    }
}

@keyframes elafhouse-shine {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }
    30%, 100% {
        transform: translateX(100%) rotate(45deg);
    }
}

/* Price Display in Shop */
.elafhouse-price-wrapper {
    display: block;
}

.elafhouse-original-price {
    color: #999 !important;
    font-size: 0.9em;
    text-decoration: line-through;
}

.elafhouse-free-text {
    color: #2ecc71 !important;
    font-weight: 700 !important;
    font-size: 1.1em;
    text-decoration: none !important;
    display: block;
    margin-top: 5px;
}

/* RTL Support for Shop Badge */
[dir="rtl"] .elafhouse-free-badge-wrapper,
html[lang="ar"] .elafhouse-free-badge-wrapper,
body.rtl .elafhouse-free-badge-wrapper {
    right: auto;
    left: 10px;
}

/* Woodmart Theme Compatibility */
.woodmart-products .elafhouse-free-badge-wrapper {
    top: 15px;
    right: 15px;
}

.woodmart-products .product-element-top {
    position: relative;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .elafhouse-free-eligible-badge {
        padding: 6px 12px;
        font-size: 10px;
        letter-spacing: 0.5px;
    }

    .elafhouse-free-eligible-badge::before {
        font-size: 12px;
    }

    .elafhouse-free-text {
        font-size: 1em;
    }
}

@media screen and (max-width: 480px) {
    .elafhouse-free-badge-wrapper {
        top: 5px;
        right: 5px;
    }

    .elafhouse-free-eligible-badge {
        padding: 5px 10px;
        font-size: 9px;
        gap: 4px;
    }

    .elafhouse-free-eligible-badge::before {
        font-size: 11px;
    }
}