/* ==========================================================================
   Installment provider cards (Tamara, MISPay, Amwal) — product page
   Single source of truth for BOTH themes (custom = LTR, custom_rtl = RTL).
   Logical properties used so direction flips automatically.
   Mobile-first: cards stack full-width. Desktop (>=768px): 3 equal cards/row.
   ========================================================================== */

.catalog-product-view .installments-widgets {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
    padding: 0;
    max-width: 100%;
}

.catalog-product-view .installment-card {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    padding: 6px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    box-sizing: border-box;
}

.catalog-product-view .installment-card,
.catalog-product-view .installment-card * {
    font-size: 12px;
    line-height: 1.35;
    color: #333;
}

/* strip borders/shadows third-party widgets draw on their own wrappers */
.catalog-product-view .installment-card *,
.catalog-product-view .installment-card *::before,
.catalog-product-view .installment-card *::after {
    box-shadow: none !important;
}

/* ---- MISPay ------------------------------------------------------------- */
.catalog-product-view .installment-card--mispay mispay-widget {
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    width: 100%;
    max-width: 100%;
}

/* ---- Tamara ------------------------------------------------------------- */
.catalog-product-view .installment-card--tamara .tamara-summary-widget_container {
    display: flex !important;
    align-items: center !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}
.catalog-product-view .installment-card--tamara .badge-wrapper,
.catalog-product-view .installment-card--tamara .tamara-inline-badge,
.catalog-product-view .installment-card--tamara .tamara-badge {
    order: -1 !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}
.catalog-product-view .installment-card--tamara .badge-wrapper img,
.catalog-product-view .installment-card--tamara .tamara-inline-badge img,
.catalog-product-view .installment-card--tamara .tamara-badge img {
    width: 48px !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
}
.catalog-product-view .installment-card--tamara .summary-widget-content,
.catalog-product-view .installment-card--tamara .content-wrapper {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    min-width: 0 !important;
    overflow: hidden !important;
}
.catalog-product-view .installment-card--tamara,
.catalog-product-view .installment-card--tamara * {
    font-size: 11px !important;
    line-height: 1.3 !important;
    color: #333 !important;
}
.catalog-product-view .installment-card--tamara .tamara-inline-learn-more-link {
    text-decoration: underline !important;
    white-space: nowrap !important;
}
.catalog-product-view .installment-card--tamara svg {
    width: 12px !important;
    height: 12px !important;
    flex-shrink: 0 !important;
}

/* ---- Amwal (custom compact card) --------------------------------------- */
.catalog-product-view .installment-card--amwal {
    cursor: pointer;
    position: relative;
    padding-left: 64px;
}
.catalog-product-view .installment-card--amwal .amwal-card-logo {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 19px;
    display: block;
}
.catalog-product-view .installment-card--amwal .amwal-card-text {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.catalog-product-view .installment-card--amwal .amwal-card-link {
    flex: 0 0 auto;
    color: #3866df;
    text-decoration: underline;
    white-space: nowrap;
}

/* iframe-based widgets, if any provider renders one inline */
.catalog-product-view .installments-widgets iframe {
    width: 100% !important;
    max-width: 100%;
    border: 0;
    border-radius: 8px;
}

/* ==========================================================================
   Desktop (>=768px): compact single row — 3 small cards side by side.
   Minimal padding/margins, small text, content wraps (not clipped) so it
   stays clear. Column is ~377-578px depending on viewport. Tamara/MISPay
   are shadow-DOM (only the host font + card shell are controllable).
   ========================================================================== */
@media (min-width: 768px) {
    .catalog-product-view .installments-widgets {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 5px;
        margin: 8px 0;
        align-items: stretch;
    }
    .catalog-product-view .installment-card {
        flex: 1 1 0;
        width: auto;
        max-width: none;
        min-width: 0;
        min-height: 0;
        margin: 0;
        padding: 4px 6px;
        gap: 4px;
        border-radius: 6px;
        overflow: hidden;
    }
    .catalog-product-view .installment-card,
    .catalog-product-view .installment-card * {
        font-size: 9px;
        line-height: 1.25;
    }
    .catalog-product-view .installment-card--amwal {
        padding-left: 40px;
    }
    .catalog-product-view .installment-card--amwal .amwal-card-logo {
        left: 6px;
        width: 30px;
        height: 12px;
    }
    .catalog-product-view .installment-card--amwal .amwal-card-text {
        flex: 1 1 auto;
        min-width: 0;
        white-space: normal;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    .catalog-product-view .installment-card--amwal .amwal-card-link {
        white-space: nowrap;
    }
    .catalog-product-view .installment-card--tamara,
    .catalog-product-view .installment-card--tamara * {
        font-size: 8.5px !important;
    }
    /* Contain the Tamara widget so it can't spill over the neighbouring card. */
    .catalog-product-view .installment-card--tamara tamara-widget,
    .catalog-product-view .installment-card--tamara .tamara-promo-widget-wrapper,
    .catalog-product-view .installment-card--tamara .tamara-summary-widget_container,
    .catalog-product-view .installment-card--tamara .summary-widget-content,
    .catalog-product-view .installment-card--tamara .content-wrapper {
        max-width: 100% !important;
        min-width: 0 !important;
        overflow: hidden !important;
        flex-wrap: wrap !important;
    }
    .catalog-product-view .installment-card--tamara .badge-wrapper img,
    .catalog-product-view .installment-card--tamara .tamara-inline-badge img,
    .catalog-product-view .installment-card--tamara .tamara-badge img {
        width: 30px !important;
    }
    .catalog-product-view .installment-card--mispay mispay-widget {
        gap: 3px;
        font-size: 9px;
        max-width: 100%;
        overflow: hidden;
    }
}

/* ============================================================
   Amwal installments — Tamara-style popup: white, rounded, NO header/
   title, full-bleed iframe, clean neutral floating close button.
   Desktop = centered card; mobile = full-width bottom sheet. Scoped
   !important to beat the theme's modal CSS. Shared LTR + RTL.
   ============================================================ */
.installment-card--amwal {
    cursor: pointer;
}
.amwal-installments-modal.modal-popup .modal-inner-wrap {
    position: relative !important;
    max-width: 460px !important;
    width: 92% !important;
    margin: 3.5vh auto !important;
    background: #fff !important;
    border: 0 !important;
    border-radius: 22px !important;
    overflow: hidden !important;
    box-shadow: 0 24px 64px -16px rgba(26, 20, 8, 0.38) !important;
}
/* No header/title — float it transparently so only the close shows, over the iframe. */
.amwal-installments-modal.modal-popup .modal-header {
    position: absolute !important;
    inset-block-start: 0 !important;
    inset-inline: 0 !important;
    z-index: 5 !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    border: 0 !important;
    background: transparent !important;
}
.amwal-installments-modal .modal-title {
    display: none !important;
}
.amwal-installments-modal.modal-popup .modal-content {
    padding: 0 !important;
    margin: 0 !important;
}
.amwal-installments-modal-content {
    display: block;
}
.amwal-installments-iframe {
    display: block;
    width: 100% !important;
    height: 82vh !important;
    min-height: 420px !important;
    max-height: 720px !important;
    border: 0 !important;
    background: #fff;
}
/* Clean neutral floating close, like Tamara. */
.amwal-installments-modal.modal-popup .action-close {
    position: absolute !important;
    inset-block-start: 16px !important;
    inset-inline-end: 16px !important;
    inset-inline-start: auto !important;
    z-index: 10 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 40px !important;
    height: 40px !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: #f0f0f0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    transition: background 0.15s ease !important;
}
.amwal-installments-modal.modal-popup .action-close:hover {
    background: #e6e6e6 !important;
}
.amwal-installments-modal.modal-popup .action-close > span {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
}
.amwal-installments-modal.modal-popup .action-close:before {
    content: '\00D7' !important;
    background: transparent !important;
    background-image: none !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    font-size: 23px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    color: #1a1a1a !important;
}

/* ---- Mobile: full-width bottom sheet ---- */
@media (max-width: 767px) {
    .amwal-installments-modal.modal-popup .modal-inner-wrap {
        position: fixed !important;
        inset-inline: 0 !important;
        inset-block: auto 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        height: auto !important;
        max-height: 92vh !important;
        border-radius: 22px 22px 0 0 !important;
        box-shadow: 0 -16px 44px -10px rgba(26, 20, 8, 0.32) !important;
        transform: translateY(100%) !important;
        transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }
    .amwal-installments-modal.modal-popup._show .modal-inner-wrap {
        transform: translateY(0) !important;
    }
    .amwal-installments-iframe {
        height: 90vh !important;
        max-height: none !important;
        min-height: 0 !important;
    }
}

/* ============================================================
   Installments section loader — skeleton shimmer shown until the
   Tamara/MISPay widgets finish rendering, then fades out. Added/removed
   by Inhouse_Ui/js/product.js. Mobile = stacked; desktop = row of 3.
   ============================================================ */
.catalog-product-view .installments-widgets.is-loading .installment-card {
    display: none !important;
}
.catalog-product-view .installments-loader {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    flex: 1 1 100%;
    max-width: 100%;
}
.catalog-product-view .installments-widgets.is-loaded .installments-loader {
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}
.catalog-product-view .installments-loader__card {
    flex: 1 1 0;
    height: 46px;
    border-radius: 10px;
    background-color: #ededed;
    background-image: linear-gradient(100deg,
        rgba(255, 255, 255, 0) 30%,
        rgba(255, 255, 255, 0.75) 50%,
        rgba(255, 255, 255, 0) 70%);
    background-size: 200% 100%;
    background-repeat: no-repeat;
    animation: installmentsShimmer 1.3s ease-in-out infinite;
}
@keyframes installmentsShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@media (min-width: 768px) {
    .catalog-product-view .installments-loader {
        flex-direction: row;
        gap: 5px;
    }
    .catalog-product-view .installments-loader__card {
        height: 52px;
    }
}
