/* ============================================
   Complementary Products - Master Styles (LTR/RTL)
   ============================================ */

.cp-popup {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 999999;
    display: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.cp-popup.active { opacity: 1; }

.cp-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.cp-popup-content {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 12px;
    max-width: 420px;
    width: calc(100% - 40px);
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: fadeSlideIn 0.3s ease-out;
    text-align: left; /* Base English */
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.cp-popup-close {
    position: absolute;
    top: 12px; 
    width: 30px; height: 30px;
    border: none; background: #f5f5f5;
    border-radius: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 10;
}

.cp-popup-close:hover { background: #e0e0e0; transform: scale(1.05); }

.cp-popup-inner { padding: 22px; overflow-y: auto; max-height: 85vh; }

/* Scrollbar */
.cp-popup-inner::-webkit-scrollbar { width: 4px; }
.cp-popup-inner::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.cp-popup-header { text-align: center; margin-bottom: 18px; border-bottom: 1px solid #e5e5e5; padding-bottom: 14px; }
.cp-popup-header h3 { font-size: 17px; font-weight: 600; color: #333; margin: 0; }
.cp-popup-subtitle { font-size: 13px; color: #777; margin-top: 5px; }

.cp-popup-body { display: grid; grid-template-columns: 100px 1fr; gap: 16px; margin-bottom: 18px; }

.cp-popup-image { border-radius: 8px; border: 1px solid #e5e5e5; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cp-popup-image img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }

.cp-popup-details { display: flex; flex-direction: column; gap: 8px; }
.cp-popup-title { font-size: 15px; font-weight: 600; margin: 0; color: #333; }
.cp-popup-price { font-size: 18px; font-weight: 700; color: #0073aa; }

.cp-popup-quantity { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.cp-quantity-selector { display: inline-flex; border: 1px solid #ddd; border-radius: 6px; overflow: hidden; }
.cp-qty-btn { width: 32px; height: 32px; border: none; background: #f5f5f5; cursor: pointer; font-weight: bold; }
.cp-qty-minus { border-right: 1px solid #ddd; }
.cp-qty-plus { border-left: 1px solid #ddd; }
.cp-quantity-selector input { width: 45px; text-align: center; border: none; font-weight: 600; }

.cp-popup-footer { display: flex; flex-direction: column; gap: 10px; }
.cp-popup-footer .button { padding: 12px; border-radius: 8px; font-weight: 600; text-align: center; cursor: pointer; transition: 0.2s; border: none; }

.cp-add-complementary { background: #0073aa; color: #fff; }
.cp-add-complementary:hover { background: #05821a; }
.cp-no-thanks { background: transparent; color: #999; font-size: 13px; }

/* States */
.cp-add-complementary.loading::after {
    content: ''; width: 14px; height: 14px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: spin 0.6s linear infinite; display: inline-block; margin-left: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* RTL Fixes */
/*[dir="rtl"] .cp-popup-content { text-align: right; }*/
/*[dir="rtl"] .cp-popup-close { right: auto; left: 12px; }*/
/*[dir="rtl"] .cp-qty-minus { border-right: none; border-left: 1px solid #ddd; }*/
/*[dir="rtl"] .cp-qty-plus { border-left: none; border-right: 1px solid #ddd; }*/
.cp-popup-close { left: auto; right: 12px }
.cp-popup-content { text-align: right; }

html:lang(en) .cp-popup-close,
html:lang(en-US) .cp-popup-close { right: auto; left: 12px; }

html:lang(en) .cp-popup-content,
html:lang(en-US) .cp-popup-content { text-align: left; }

    

/* Responsive Mobile */
@media (max-width: 600px) {
    .cp-popup-content { top: auto; bottom: 0; left: 0; right: 0; transform: none; width: 100%; border-radius: 16px 16px 0 0; animation: slideUp 0.3s; }
    @keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
    .cp-popup-body { grid-template-columns: 1fr; text-align: center; }
    .cp-popup-image { max-width: 120px; margin: 0 auto; }
    .cp-popup-quantity { justify-content: center; }
}