@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

/**
 * WooCommerce Upsell Offers Pro - Quad Pharma Edition
 * Tailored to match https://quadpharm.com/ Visual Identity
 * RTL & Mobile High-Conversion Optimized
 * Typography: Google Font 'Cairo'
 */

:root {
    --qp-navy: #1d2d5e;
    --qp-teal: #0cb8b6;
    --qp-teal-hover: #0aa3a1;
    --qp-teal-light: #e6f8f8;
    --qp-orange: #ffa04b;
    --qp-orange-light: #fff5eb;
    --qp-border: #e2e8f0;
    --qp-bg-surface: #ffffff;
    --qp-bg-ice: #f7f9fc;
    --qp-text-primary: #1d2d5e;
    --qp-text-muted: #5e6d8a;
    --qp-radius-pill: 50px;
    --qp-radius-card: 16px;
    --wc-upsell-primary: #0cb8b6;
    --wc-upsell-primary-hover: #0aa3a1;
}

/* Enforce Cairo Font */
.wc-upsell-offers-container,
.wc-upsell-offers-container * {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Theme Flex Conflict Resolution & Container Breakout (Codevz / Xtra / Astra) */
.codevz-woo-add-to-cart,
.codevz-woo-add-to-cart-flex,
form.cart {
    flex-wrap: wrap !important;
}

.wc-upsell-offers-container,
.wc-upsell-tiers-wrapper {
    direction: rtl;
    text-align: right;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    flex-basis: 100% !important;
    clear: both !important;
    display: block !important;
    margin: 25px 0 !important;
    padding: 24px;
    background: var(--qp-bg-surface);
    border: 1.5px solid var(--qp-border);
    border-radius: var(--qp-radius-card);
    box-shadow: 0 6px 20px rgba(29, 45, 94, 0.05);
    box-sizing: border-box !important;
    transition: all 0.3s ease;
}

/* ========================================================
   Theme Sticky Bar Conflict Resolution
   Never render Upsell Box inside theme sticky add-to-cart bars
   (e.g., Codevz/Xtra .cz-sticky-add-to-cart or any floating bar)
   ======================================================== */
.cz-sticky-add-to-cart .wc-upsell-offers-container,
.cz-sticky-add-to-cart .wc-upsell-tiers-wrapper,
.cz-sticky-add-to-cart .wc-upsell-bundle-container,
.cz-sticky-add-to-cart-show .wc-upsell-offers-container,
.cz-sticky-add-to-cart-show .wc-upsell-tiers-wrapper,
[class*="sticky-add-to-cart"] .wc-upsell-offers-container,
[class*="sticky-add-to-cart"] .wc-upsell-tiers-wrapper,
[class*="sticky-add-to-cart"] .wc-upsell-bundle-container,
[class*="sticky_add_to_cart"] .wc-upsell-offers-container,
[class*="sticky_add_to_cart"] .wc-upsell-tiers-wrapper,
.codevz-sticky-cart .wc-upsell-offers-container,
.codevz-sticky-cart .wc-upsell-tiers-wrapper,
.cz-sticky-add-to-cart .wc-egypt-fc-wrapper,
[class*="sticky-add-to-cart"] .wc-egypt-fc-wrapper {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.wc-upsell-offers-container:hover {
    border-color: #cbd5e1;
    box-shadow: 0 8px 25px rgba(29, 45, 94, 0.08);
}

/* Header */
.wc-upsell-header {
    margin-bottom: 18px;
    position: relative;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--qp-border);
}

.wc-upsell-badge-fire {
    display: inline-block;
    background: linear-gradient(135deg, #ffa04b 0%, #ff7730 100%);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: var(--qp-radius-pill);
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(255, 160, 75, 0.35);
}

.wc-upsell-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--qp-navy);
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.wc-upsell-subtitle {
    font-size: 13.5px;
    color: var(--qp-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Items List */
.wc-upsell-items-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.wc-upsell-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--qp-bg-ice);
    border: 1.5px solid #e5eaf2;
    border-radius: 12px;
    flex: 1 1 calc(50% - 20px);
    min-width: 260px;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

.wc-upsell-item:hover {
    background: #f0f4fa;
    border-color: #cbd5e1;
}

.wc-upsell-item.wc-upsell-main-item {
    background: var(--qp-teal-light);
    border-color: #bbf0ef;
}

.wc-upsell-separator {
    font-size: 22px;
    font-weight: 800;
    color: var(--qp-teal);
    user-select: none;
    text-align: center;
}

/* Custom Checkbox */
.wc-upsell-checkbox-label {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    margin: 0;
}

.wc-upsell-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.wc-upsell-custom-checkbox {
    height: 22px;
    width: 22px;
    background-color: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    display: inline-block;
    position: relative;
    transition: all 0.2s ease;
}

.wc-upsell-checkbox-label input:checked ~ .wc-upsell-custom-checkbox {
    background-color: var(--qp-teal);
    border-color: var(--qp-teal);
}

.wc-upsell-custom-checkbox:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.wc-upsell-checkbox-label input:checked ~ .wc-upsell-custom-checkbox:after,
.wc-upsell-custom-checkbox.checked:after {
    display: block;
}

.wc-upsell-custom-checkbox.disabled {
    cursor: not-allowed;
    opacity: 0.85;
}

/* Thumbnails */
.wc-upsell-thumb {
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.wc-upsell-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Details */
.wc-upsell-details {
    flex: 1;
    min-width: 0;
}

.wc-upsell-badge-main {
    display: inline-block;
    font-size: 11px;
    background: #e6f8f8;
    color: var(--qp-teal-hover);
    padding: 2px 8px;
    border-radius: var(--qp-radius-pill);
    font-weight: 700;
    margin-bottom: 4px;
}

.wc-upsell-badge-discount {
    display: inline-block;
    font-size: 11px;
    background: var(--qp-orange-light);
    color: #c25e00;
    padding: 2px 8px;
    border-radius: var(--qp-radius-pill);
    font-weight: 700;
    margin-bottom: 4px;
}

.wc-upsell-product-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--qp-navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.wc-upsell-product-name a {
    color: inherit;
    text-decoration: none;
}

.wc-upsell-product-name a:hover {
    color: var(--qp-teal);
}

.wc-upsell-product-pricing {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.wc-upsell-del-price {
    color: #94a3b8;
    font-size: 13px;
}

.wc-upsell-price-active {
    font-weight: 800;
    color: var(--qp-teal);
}

/* Summary Bar */
.wc-upsell-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0fbfb;
    padding: 12px 18px;
    border-radius: 12px;
    border: 1.5px solid #c2eceb;
    gap: 12px;
    flex-wrap: wrap;
}

.wc-upsell-pricing-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wc-upsell-total-label {
    font-size: 12px;
    color: var(--qp-text-muted);
}

.wc-upsell-total-figures {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.wc-upsell-total-regular {
    color: #94a3b8;
    font-size: 13.5px;
}

.wc-upsell-total-discounted {
    font-size: 19px;
    font-weight: 900;
    color: var(--qp-navy);
}

.wc-upsell-savings-amount {
    font-size: 12px;
    font-weight: 800;
    color: var(--qp-teal);
}

/* Pill Button - Refined Compact Size */
.wc-upsell-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.wc-upsell-btn-icon svg {
    display: block;
    stroke: currentColor;
    width: 15px;
    height: 15px;
}

.wc-upsell-add-all-btn {
    background: linear-gradient(135deg, #0cb8b6 0%, #0aa3a1 100%);
    color: #ffffff !important;
    border: none;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(12, 184, 182, 0.25);
    line-height: 1.2;
    white-space: nowrap;
    width: auto;
    max-width: 260px;
    box-sizing: border-box;
}

.wc-upsell-add-all-btn:hover {
    background: linear-gradient(135deg, #0aa3a1 0%, #088a88 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(12, 184, 182, 0.35);
}

.wc-upsell-add-all-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.wc-upsell-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: wc-upsell-spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes wc-upsell-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notice Box */
.wc-upsell-notice-box {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.wc-upsell-notice-box.success {
    background: #e6f8f8;
    border: 1px solid #bbf0ef;
    color: #0b7e7c;
}

.wc-upsell-notice-box.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.wc-upsell-notice-link {
    background: var(--qp-navy);
    color: #ffffff !important;
    padding: 6px 14px;
    border-radius: var(--qp-radius-pill);
    font-size: 12px;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.wc-upsell-notice-link:hover {
    background: var(--qp-teal);
}

/* ========================================================
   Mobile-Specific Responsive Tweaks (Screens < 768px)
   ======================================================== */
@media (max-width: 768px) {
    .wc-upsell-offers-container {
        padding: 18px 14px;
        margin: 18px 0;
        border-radius: 14px;
    }

    .wc-upsell-title {
        font-size: 17px;
    }

    .wc-upsell-items-list {
        flex-direction: column;
        gap: 8px;
    }

    .wc-upsell-item {
        width: 100%;
        flex: 1 1 100%;
        padding: 10px 12px;
    }

    .wc-upsell-separator {
        width: 100%;
        font-size: 18px;
    }

    .wc-upsell-summary-bar {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 12px 14px;
        gap: 10px;
    }

    .wc-upsell-pricing-info {
        align-items: center;
    }

    .wc-upsell-action-btn-wrapper {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    .wc-upsell-add-all-btn {
        width: auto;
        max-width: 240px;
        font-size: 12.5px;
        padding: 7px 16px;
        white-space: nowrap;
        border-radius: 18px;
    }
}

/* ========================================================
   Quantity Tiers Styling (عروض الكميات والتوفير)
   ======================================================== */
.wc-upsell-tiers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.wc-upsell-tier-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.wc-upsell-tier-card:hover {
    border-color: #94a3b8;
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.wc-upsell-tier-card.is-selected {
    border-color: var(--qp-teal);
    background: #f0fdfa;
    box-shadow: 0 4px 16px rgba(12, 184, 182, 0.15);
}

.wc-upsell-tier-card.is-popular {
    border-color: #38bdf8;
}

.wc-upsell-tier-card.is-popular.is-selected {
    border-color: var(--qp-teal);
    background: #f0fdfa;
}

.wc-upsell-tier-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1 1 auto;
    min-width: 0;
}

/* Custom Radio Dot */
.wc-upsell-tier-radio {
    width: 22px;
    height: 22px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.wc-upsell-tier-card.is-selected .wc-upsell-tier-radio {
    border-color: var(--qp-teal);
}

.wc-upsell-radio-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.2s ease;
}

.wc-upsell-tier-card.is-selected .wc-upsell-radio-circle {
    background: var(--qp-teal);
}

.wc-upsell-tier-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.wc-upsell-tier-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.wc-upsell-tier-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--qp-navy);
    white-space: nowrap !important;
}

.wc-upsell-tier-badge {
    background: linear-gradient(135deg, #ffa04b 0%, #ff7730 100%);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: var(--qp-radius-pill);
    box-shadow: 0 2px 6px rgba(255, 160, 75, 0.3);
    white-space: nowrap !important;
    display: inline-block;
    flex-shrink: 0;
}

.wc-upsell-tier-desc {
    font-size: 12.5px;
    color: var(--qp-text-muted);
    line-height: 1.4;
}

.wc-upsell-tier-left {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex-shrink: 0;
    min-width: 110px;
}

.wc-upsell-tier-pricing {
    display: flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
}

.wc-upsell-tier-del {
    color: #94a3b8;
    font-size: 13px;
    text-decoration: line-through;
}

.wc-upsell-tier-total {
    font-size: 18px;
    font-weight: 900;
    color: var(--qp-navy);
}

.wc-upsell-tier-card.is-selected .wc-upsell-tier-total {
    color: var(--qp-teal);
}

.wc-upsell-tier-savings-tag {
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--qp-radius-pill);
    border: 1px solid #bbf7d0;
    white-space: nowrap !important;
}

.wc-upsell-action-btn-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.wc-upsell-tier-add-btn {
    background: linear-gradient(135deg, #0cb8b6 0%, #0aa3a1 100%);
    color: #ffffff !important;
    border: none;
    padding: 11px 24px;
    font-size: 15px;
    font-weight: 800;
    border-radius: 25px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
    box-shadow: 0 3px 12px rgba(12, 184, 182, 0.28);
    line-height: 1.2;
    white-space: nowrap;
    width: auto;
    min-width: 240px;
    max-width: 360px;
    min-height: 46px;
    box-sizing: border-box;
}

.wc-upsell-tier-add-btn:hover {
    background: linear-gradient(135deg, #0aa3a1 0%, #088a88 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(12, 184, 182, 0.35);
}

.wc-upsell-tier-add-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 600px) {
    .wc-upsell-tier-card {
        padding: 12px 14px;
    }
    .wc-upsell-tier-name {
        font-size: 15px;
    }
    .wc-upsell-tier-total {
        font-size: 16px;
    }
    .wc-upsell-action-btn-wrapper {
        width: 100%;
        display: flex;
        justify-content: center;
    }
    .wc-upsell-tier-add-btn {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 48px !important;
        padding: 12px 18px !important;
        font-size: 15.5px !important;
        font-weight: 800 !important;
        white-space: normal !important;
        border-radius: 25px !important;
        gap: 8px !important;
        box-shadow: 0 4px 14px rgba(12, 184, 182, 0.35) !important;
    }
}

/* Fast Checkout Target Highlight Pulse */
@keyframes fc-highlight {
    0% {
        box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.6);
        border-color: #0ea5e9;
    }
    50% {
        box-shadow: 0 0 0 8px rgba(14, 165, 233, 0);
        border-color: #0284c7;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(14, 165, 233, 0);
        border-color: #c2eceb;
    }
}

.fc-highlight-pulse {
    animation: fc-highlight 1.2s ease-out 2 !important;
}
