/**
 * Empire Coupons Frontend Styles
 */

/* CSS Custom Properties - Defaults (overridden by inline styles from settings) */
:root {
    --ec-offer-card-bg: #f0f9f0;
    --ec-offer-card-border: #46b450;
    --ec-offer-card-radius: 8px;
    --ec-offer-card-text: #1d2327;
    --ec-badge-bg: #46b450;
    --ec-badge-text: #ffffff;
    --ec-selector-bg: #f0f9f0;
    --ec-selector-border: #46b450;
    --ec-selector-columns: 6;
    --ec-button-bg: #46b450;
    --ec-button-text: #ffffff;
    --ec-button-hover-bg: #3a9a42;
    --ec-offer-columns: 2;
}

/* BOGO Offers Section - Full Width */
.ec-bogo-offers-fullwidth {
    margin-bottom: 30px;
    background: linear-gradient(135deg, #f8fbff 0%, #f0f7ff 100%);
    border: 1px solid #d0e3f7;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.ec-bogo-offers-header {
    margin-bottom: 20px;
}

.ec-bogo-offers-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 18px;
    color: #1d2327;
}

.ec-bogo-offers-title .dashicons {
    color: #2271b1;
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.ec-bogo-offers-grid {
    display: grid;
    grid-template-columns: repeat(var(--ec-offer-columns), 1fr);
    gap: 16px;
}

/* Legacy sidebar version */
.ec-bogo-offers {
    margin-bottom: 30px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.ec-bogo-offers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ec-bogo-offer-card {
    display: flex;
    align-items: stretch;
    background: var(--ec-offer-card-bg);
    border: 2px dashed var(--ec-offer-card-border);
    border-radius: var(--ec-offer-card-radius);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--ec-offer-card-text);
}

.ec-bogo-offer-card:hover {
    border-color: var(--ec-offer-card-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Clickable offer link */
.ec-offer-link {
    display: contents;
    text-decoration: none;
    color: inherit;
}

.ec-bogo-offer-card:has(.ec-offer-link) {
    cursor: pointer;
}

.ec-bogo-offer-card:has(.ec-offer-link):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ec-bogo-offer-card:has(.ec-offer-link):hover .ec-offer-title {
    color: var(--ec-offer-active-color, #46b450);
}

/* Active offer - conditions met, coupon applied */
.ec-bogo-offer-card.ec-offer-is-active {
    border-color: var(--ec-offer-card-border);
    border-style: solid;
    background: var(--ec-offer-card-bg);
    box-shadow: 0 2px 8px rgba(70, 180, 80, 0.25);
}

.ec-bogo-offer-card.ec-offer-is-active .ec-offer-badge {
    background: var(--ec-badge-bg);
}

/* Pending offer - available but conditions not yet met */
.ec-bogo-offer-card.ec-offer-is-pending {
    border-color: #c3c4c7;
    border-style: dashed;
    background: #f6f7f7;
}

.ec-bogo-offer-card.ec-offer-is-pending .ec-offer-badge {
    background: #787c82;
}

.ec-bogo-offer-card.ec-offer-is-pending .ec-offer-title {
    color: #50575e;
}

.ec-bogo-offer-card.ec-offer-is-pending .ec-offer-description {
    color: #787c82;
}

.ec-bogo-offer-card.ec-offer-is-pending .ec-offer-summary {
    color: #787c82;
}

.ec-bogo-offer-card.ec-offer-is-pending:hover {
    border-color: #8c8f94;
    background: #f0f0f1;
}

.ec-offer-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    padding: 10px;
    background: var(--ec-badge-bg);
    color: var(--ec-badge-text);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
}

.ec-offer-is-active .ec-offer-badge {
    background: var(--ec-badge-bg);
}

.ec-offer-content {
    flex: 1;
    padding: 15px 20px;
}

.ec-offer-title {
    margin: 0 0 5px 0;
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
}

.ec-offer-description {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #646970;
    line-height: 1.4;
}

.ec-offer-details {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #50575e;
}

.ec-offer-buy {
    color: #1d2327;
}

.ec-offer-arrow {
    color: #2271b1;
    font-weight: bold;
}

.ec-offer-get {
    color: #00a32a;
}

.ec-offer-get strong {
    font-weight: 700;
}

.ec-offer-action {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0,0,0,0.02);
    border-left: 1px dashed #e0e0e0;
    min-width: 140px;
    justify-content: center;
}

.ec-offer-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 500;
}

.ec-offer-status .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.ec-offer-active {
    color: #00a32a;
}

.ec-offer-auto {
    color: #2271b1;
}

.ec-offer-code-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.ec-offer-code-label {
    font-size: 11px;
    color: #646970;
}

.ec-offer-code {
    display: inline-flex;
    align-items: center;
    background: #1d2327;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
}

.ec-copy-code {
    background: transparent;
    border: none;
    color: #2271b1;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
}

.ec-copy-code:hover {
    color: #135e96;
}

.ec-copy-code .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Find Discounts Button */
.ec-find-discounts {
    margin-bottom: 20px;
    text-align: left;
}

.ec-find-discounts-btn {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.ec-find-discounts-btn:hover {
    background: #135e96;
}

.ec-find-discounts-btn:disabled {
    background: #a7aaad;
    cursor: not-allowed;
}

.ec-find-discounts-result {
    display: inline-block;
    margin-left: 10px;
    font-size: 14px;
    color: #646970;
}

.ec-find-discounts-result.success {
    color: #00a32a;
}

.ec-find-discounts-result.error {
    color: #d63638;
}

/* BOGO Selector */
.ec-bogo-selector {
    background: var(--ec-selector-bg);
    border: 3px solid var(--ec-selector-border);
    border-radius: var(--ec-offer-card-radius);
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.ec-bogo-badge {
    display: inline-block;
    background: var(--ec-badge-bg);
    color: var(--ec-badge-text);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 10px;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(46, 125, 50, 0.3);
}

.ec-bogo-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(76, 175, 80, 0.2);
}

.ec-bogo-header h3 {
    margin: 0 0 8px 0;
    font-size: 22px;
    color: #1b5e20;
    font-weight: 700;
}

.ec-bogo-description {
    margin: 0;
    color: #2e7d32;
    font-size: 15px;
    font-weight: 500;
}

.ec-bogo-offer-description {
    margin: 10px 0 0 0;
    color: #50575e;
    font-size: 14px;
    font-style: italic;
}

/* Product Groups */
.ec-bogo-products {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ec-bogo-product-group {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.ec-bogo-product-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.ec-bogo-product-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.ec-bogo-product-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ec-bogo-product-name {
    font-weight: 600;
    font-size: 16px;
    color: #1d2327;
}

.ec-bogo-product-price {
    font-size: 14px;
    color: #00a32a;
    font-weight: 500;
}

/* Variants Grid */
.ec-bogo-variants {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 15px;
}

.ec-bogo-variant {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 8px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.15s;
}

.ec-bogo-variant:hover {
    border-color: #2271b1;
    background: #f0f7fc;
}

.ec-bogo-variant-name {
    font-size: 12px;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.3;
    min-height: 32px;
    display: flex;
    align-items: center;
}

.ec-bogo-variant-qty {
    display: flex;
    align-items: center;
    gap: 0;
}

.ec-qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ccc;
    background: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.ec-qty-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.ec-qty-btn:last-child {
    border-radius: 0 4px 4px 0;
}

.ec-qty-btn:hover {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.ec-qty-input {
    width: 36px;
    height: 28px;
    text-align: center;
    border: 1px solid #ccc;
    border-left: none;
    border-right: none;
    font-size: 13px;
    font-weight: 600;
    background: #fff;
    -moz-appearance: textfield;
}

.ec-qty-input::-webkit-outer-spin-button,
.ec-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ec-bogo-variant-qty-select {
    gap: 0;
}

select.ec-qty-input.ec-qty-select {
    width: auto;
    min-width: 52px;
    height: 28px;
    padding: 0 24px 0 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    background-color: #fff;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.ec-bogo-variant.has-qty select.ec-qty-input.ec-qty-select {
    border-color: #2271b1;
}

/* Responsive grid columns - 4 columns on desktop, 1 on mobile */
@media screen and (max-width: 768px) {
    .ec-bogo-variants {
        grid-template-columns: 1fr;
    }
}

/* Footer */
.ec-bogo-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.ec-bogo-summary {
    font-size: 16px;
    color: #1d2327;
}

.ec-bogo-summary strong {
    color: #2271b1;
}

.ec-bogo-save-btn {
    padding: 12px 24px !important;
    font-size: 15px !important;
}

.ec-bogo-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Discount Breakdown */
.ec-discount-breakdown td {
    padding: 15px 10px;
}

.ec-discount-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ec-discount-list li {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    padding: 5px 0;
    border-bottom: 1px dashed #ddd;
}

.ec-discount-list li:last-child {
    border-bottom: none;
}

.ec-discount-label {
    font-weight: 500;
}

.ec-discount-amount {
    color: #00a32a;
    font-weight: 600;
}

.ec-free-items-note {
    margin-top: 10px;
    font-size: 12px;
    color: #646970;
    font-style: italic;
}

/* Free Badge */
.ec-free-badge {
    display: inline-block;
    background: #00a32a;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* Loading Spinner */
.ec-loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: ec-spin 1s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes ec-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media screen and (max-width: 768px) {
    .ec-bogo-offers-fullwidth {
        padding: 15px;
        margin-bottom: 20px;
    }

    .ec-bogo-offers-grid {
        grid-template-columns: 1fr;
    }

    .ec-bogo-offers {
        padding: 15px;
    }

    .ec-bogo-offer-card {
        flex-direction: column;
    }

    .ec-offer-badge {
        writing-mode: horizontal-tb;
        transform: none;
        min-width: auto;
        padding: 8px 15px;
    }

    .ec-offer-content {
        padding: 12px 15px;
    }

    .ec-offer-details {
        flex-wrap: wrap;
    }

    .ec-offer-action {
        border-left: none;
        border-top: 1px dashed #e0e0e0;
        padding: 12px 15px;
    }

    .ec-bogo-selector {
        padding: 16px;
    }
    
    .ec-bogo-footer {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .ec-bogo-save-btn {
        width: 100%;
    }

    .ec-find-discounts {
        text-align: center;
    }
}

/* Highlight when qty > 0 */
.ec-bogo-variant.has-qty {
    background: var(--ec-selector-bg);
    border-color: var(--ec-selector-border);
    box-shadow: 0 0 0 2px rgba(70, 180, 80, 0.2);
}

.ec-bogo-variant.has-qty .ec-qty-input {
    background: #c8e6c9;
    font-weight: 700;
    color: #2e7d32;
}

.ec-bogo-variant.has-qty .ec-bogo-variant-name {
    color: #2e7d32;
    font-weight: 600;
}

/* Out of stock */
.ec-bogo-variant.out-of-stock {
    opacity: 0.5;
    background: #f5f5f5;
}

.ec-out-of-stock-label {
    font-size: 11px;
    color: #d32f2f;
    font-weight: 500;
}

/* In cart indicator */
.ec-in-cart {
    display: block;
    font-size: 10px;
    color: #666;
    font-weight: normal;
}

/* BOGO Free Item in Cart */
.woocommerce-cart-form .ec-free-item-row {
    background: linear-gradient(135deg, #f0fff4 0%, #e8f5e9 100%) !important;
}

.woocommerce-cart-form .ec-free-item-row td {
    border-color: rgba(76, 175, 80, 0.3) !important;
}

.ec-free-item-badge {
    display: inline-block;
    background: var(--ec-badge-bg);
    color: var(--ec-badge-text);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 8px;
    text-transform: uppercase;
    vertical-align: middle;
}

.ec-change-gift-link {
    display: inline-block;
    margin-left: 10px;
    font-size: 12px;
    color: #2271b1;
    text-decoration: none;
    vertical-align: middle;
}

.ec-change-gift-link:hover {
    color: #135e96;
    text-decoration: underline;
}

/* Cart Line Item Coupon Discount Badge */
.ec-item-discount-wrap {
    display: block;
    margin-top: 6px;
}

.ec-item-discount-badge {
    display: inline-flex;
    align-items: center;
    gap: 0;
    background: #fef3f2;
    border: 1px solid #fecdca;
    border-radius: 4px;
    overflow: hidden;
    font-size: 12px;
    line-height: 1;
    vertical-align: middle;
}

.ec-item-discount-code {
    display: inline-block;
    background: #fee4e2;
    color: #b42318;
    font-weight: 600;
    padding: 4px 8px;
    letter-spacing: 0.3px;
    font-size: 11px;
}

.ec-item-discount-amount {
    display: inline-block;
    color: #d92d20;
    font-weight: 700;
    padding: 4px 8px;
    white-space: nowrap;
}

.ec-item-discount-amount .woocommerce-Price-amount {
    color: inherit;
    font-weight: inherit;
}

.ec-free-item-original-price {
    text-decoration: line-through;
    color: #999;
    font-size: 12px;
    margin-right: 5px;
}

.ec-free-item-price {
    color: #2e7d32;
    font-weight: 700;
}

/* Locked Quantity for Free Items */
.ec-free-item-qty-locked {
    display: inline-block;
    padding: 6px 12px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #666;
    font-weight: 600;
    cursor: help;
    min-width: 40px;
    text-align: center;
}

.ec-free-item-qty-locked:hover {
    background: #f0f0f0;
}

/* Coupon Opt-Out UI */
.ec-coupon-opt-out-row th,
.ec-coupon-opt-out-row td {
    border-top: 2px dashed #dcdcde !important;
    padding-top: 15px !important;
}

.ec-auto-applied-coupons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ec-auto-coupon {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: linear-gradient(135deg, #e7f3ff 0%, #d4e9ff 100%);
    border: 1px solid #72aee6;
    border-radius: 6px;
    padding: 8px 12px;
}

.ec-coupon-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.ec-coupon-label {
    font-weight: 500;
    color: #1d2327;
}

.ec-coupon-amount {
    color: #00a32a;
    font-weight: 600;
}

.ec-opt-out-btn {
    background: transparent;
    border: none;
    color: #d63638;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ec-opt-out-btn:hover {
    background: #d63638;
    color: #fff;
}

.ec-opt-out-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.ec-opted-out-coupons {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #dcdcde;
}

.ec-opted-out-label {
    font-size: 12px;
    color: #646970;
    margin: 0 0 8px 0;
    font-style: italic;
}

.ec-opted-out-coupon {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #f6f7f7;
    border: 1px dashed #c3c4c7;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 6px;
}

.ec-opted-out-coupon .ec-coupon-label {
    color: #646970;
    text-decoration: line-through;
}

.ec-opt-in-btn {
    background: #2271b1;
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.ec-opt-in-btn:hover {
    background: #135e96;
}

.ec-opt-out-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Product Page BOGO Offers - Coupon Style */
.ec-product-bogo-offers {
    margin: 20px 0;
}

.ec-product-coupon {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 2px dashed var(--ec-offer-card-border, #46b450);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
}

.ec-product-coupon:last-child {
    margin-bottom: 0;
}

/* Coupon perforated edge effect */
.ec-product-coupon::before,
.ec-product-coupon::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    border: 2px dashed var(--ec-offer-card-border, #46b450);
}

.ec-product-coupon::before {
    left: 70px;
    top: -9px;
    border-top-color: transparent;
}

.ec-product-coupon::after {
    left: 70px;
    bottom: -9px;
    border-bottom-color: transparent;
}

.ec-product-coupon-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 75px;
    padding: 15px 10px;
    background: var(--ec-badge-bg, #46b450);
    color: #fff;
    text-align: center;
}

.ec-coupon-badge-text {
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 1px;
}

.ec-coupon-badge-sub {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.9;
    margin-top: 2px;
}

.ec-product-coupon-content {
    flex: 1;
    padding: 12px 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    border-right: 1px dashed #ddd;
}

.ec-product-coupon-title {
    font-size: 15px;
    font-weight: 700;
    color: #1d2327;
    line-height: 1.3;
}

.ec-product-coupon-details {
    font-size: 13px;
    color: #50575e;
    line-height: 1.4;
}

.ec-product-coupon-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 15px;
    min-width: 100px;
    background: #f9f9f9;
}

.ec-coupon-code-label {
    font-size: 10px;
    font-weight: 600;
    color: #787c82;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.ec-coupon-code-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--ec-badge-bg, #46b450);
    background: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--ec-badge-bg, #46b450);
}

.ec-coupon-auto-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ec-badge-bg, #46b450);
}

.ec-coupon-auto-badge .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Responsive for product page coupons */
@media screen and (max-width: 600px) {
    .ec-product-coupon {
        flex-direction: column;
    }

    .ec-product-coupon::before,
    .ec-product-coupon::after {
        display: none;
    }

    .ec-product-coupon-badge {
        flex-direction: row;
        gap: 6px;
        min-width: auto;
        padding: 10px 15px;
    }

    .ec-coupon-badge-sub {
        margin-top: 0;
    }

    .ec-product-coupon-content {
        border-right: none;
        border-bottom: 1px dashed #ddd;
    }

    .ec-product-coupon-action {
        flex-direction: row;
        gap: 8px;
        padding: 10px 15px;
    }

    .ec-coupon-code-label {
        margin-bottom: 0;
    }
}

/* Responsive for auto-applied discounts in cart totals */
@media screen and (max-width: 768px) {
    .ec-auto-coupon {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px;
    }

    .ec-coupon-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        width: 100%;
    }

    .ec-coupon-label {
        font-size: 13px;
        line-height: 1.4;
        word-wrap: break-word;
        max-width: 100%;
    }

    .ec-coupon-amount {
        font-size: 14px;
    }

    .ec-opt-out-btn {
        align-self: flex-end;
        margin-top: 4px;
    }

    .ec-opted-out-coupon {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .ec-opt-in-btn {
        align-self: flex-end;
    }
}

/* Even smaller screens */
@media screen and (max-width: 480px) {
    .ec-auto-coupon {
        padding: 8px;
    }

    .ec-coupon-label {
        font-size: 12px;
    }

    .ec-coupon-amount {
        font-size: 13px;
    }
}

/* ========================================
   Unclaimed Gifts Modal
   ======================================== */

body.ec-modal-open {
    overflow: hidden;
}

.ec-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    animation: ec-fadeIn 0.2s ease;
}

.ec-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 100000;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    animation: ec-slideIn 0.3s ease;
}

@keyframes ec-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ec-slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.ec-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.ec-modal-close:hover {
    color: #333;
}

.ec-modal-icon {
    text-align: center;
    margin-bottom: 15px;
}

.ec-modal-icon .dashicons {
    font-size: 60px;
    width: 60px;
    height: 60px;
    color: var(--ec-badge-bg, #46b450);
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 50%;
    padding: 15px;
    box-sizing: content-box;
}

.ec-modal-title {
    font-size: 22px;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 10px;
    text-align: center;
}

.ec-modal-message {
    font-size: 15px;
    color: #50575e;
    text-align: center;
    margin: 0 0 20px;
}

.ec-modal-offers {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px 20px;
    margin: 0 0 25px;
    list-style: none;
}

.ec-modal-offers li {
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    color: #333;
}

.ec-modal-offers li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ec-modal-offers li:first-child {
    padding-top: 0;
}

.ec-modal-offers strong {
    color: var(--ec-badge-bg, #46b450);
}

.ec-modal-offers small {
    display: block;
    color: #787c82;
    margin-top: 4px;
}

.ec-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ec-modal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ec-modal-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.ec-modal-pick-for-me {
    background: var(--ec-badge-bg, #46b450);
    color: #fff;
}

.ec-modal-pick-for-me:hover {
    background: var(--ec-button-hover-bg, #3a9a42);
}

.ec-modal-btn-secondary {
    background: #f0f0f1;
    color: #1d2327;
}

.ec-modal-btn-secondary:hover {
    background: #e0e0e0;
}

.ec-modal-btn-tertiary {
    background: transparent;
    color: #787c82;
    font-weight: 400;
    font-size: 13px;
    padding: 10px;
}

.ec-modal-btn-tertiary:hover {
    color: #50575e;
    text-decoration: underline;
}

/* Responsive modal */
@media screen and (max-width: 480px) {
    .ec-modal {
        padding: 25px 20px;
    }

    .ec-modal-icon .dashicons {
        font-size: 48px;
        width: 48px;
        height: 48px;
        padding: 12px;
    }

    .ec-modal-title {
        font-size: 18px;
    }

    .ec-modal-message {
        font-size: 14px;
    }

    .ec-modal-btn {
        padding: 12px 15px;
        font-size: 14px;
    }
}
