/* ==========================================================================
   Sulfah BNPL — WooCommerce plugin styles
   RTL-first (Arabic). Port from Magento sulfah-bnpl.css.
   ========================================================================== */

/* Saudi Riyal symbol (new official glyph U+20C1) — never use «ر.س». */
@font-face {
    font-family: 'saudi_riyal';
    src: url('../fonts/saudi_riyal.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
.icon-saudi_riyal_new::after {
    content: "\20c1";
    font-family: 'saudi_riyal' !important;
    font-size: inherit;
    color: inherit;
    margin-inline-start: 2px;
}

/* Sulfah brand font (Cairo) — matches sulfah.com. */
@font-face {
    font-family: 'SulfahCairo';
    src: url('../fonts/cairo-var.woff2') format('woff2');
    font-weight: 200 900;
    font-display: swap;
    font-style: normal;
}

/* Apply the brand font to every Sulfah element. */
.sulfah-bnpl-method,
.sulfah-bnpl-method *,
.sulfah-promo-widget,
.sulfah-promo-widget *,
.sulfah-info,
.sulfah-info *,
.sulfah-modal__bar,
.sulfah-modal__bar * {
    font-family: 'SulfahCairo', 'Cairo', system-ui, sans-serif !important;
}

/* ==========================================================================
   Checkout payment-method row.
   ========================================================================== */
.sulfah-bnpl-method .sulfah-bnpl-label {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-direction: row-reverse;
    justify-content: flex-end;
    margin: 0;
    cursor: pointer;
}

.sulfah-bnpl-method img.sulfah-bnpl-logo {
    display: block;
    height: 28px !important;
    max-height: 28px !important;
    width: auto !important;
    max-width: 80px !important;
    flex: 0 0 auto;
    object-fit: contain;
    vertical-align: middle;
    border: 0;
}

.sulfah-bnpl-method .sulfah-bnpl-logo--text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    height: 28px;
    padding: 0 12px;
    background: #31a343;
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    border-radius: 8px;
    white-space: nowrap;
}

.sulfah-bnpl-method .sulfah-bnpl-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.35;
}

.sulfah-bnpl-method .sulfah-bnpl-title {
    font-weight: 700;
    font-size: 15px;
    color: #1a1a1a;
}

.sulfah-bnpl-method .sulfah-bnpl-subtitle {
    font-weight: 400;
    font-size: 13px;
    color: #6b7280;
    margin-top: 2px;
}

html[dir="ltr"] .sulfah-bnpl-method .sulfah-bnpl-label,
body[dir="ltr"] .sulfah-bnpl-method .sulfah-bnpl-label,
[dir="ltr"] .sulfah-bnpl-method .sulfah-bnpl-label {
    flex-direction: row;
    justify-content: flex-start;
}

/* ==========================================================================
   Expanded promo panel (payment_fields).
   ========================================================================== */
.sulfah-bnpl-method .sulfah-promo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 56px;
    flex-wrap: wrap;
    padding: 24px 16px 8px;
}

.sulfah-bnpl-method .sulfah-promo__main {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
}

.sulfah-bnpl-method .sulfah-promo__logo {
    height: 30px !important;
    max-height: 30px !important;
    width: auto !important;
    max-width: 90px !important;
    object-fit: contain;
    margin-bottom: 4px;
}

.sulfah-bnpl-method .sulfah-promo__headline {
    margin: 0;
    font-weight: 800;
    font-size: 20px;
    color: #1a1a1a;
}

.sulfah-bnpl-method .sulfah-promo__sub {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

.sulfah-bnpl-method .sulfah-benefits {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sulfah-bnpl-method .sulfah-benefit {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 14px;
    color: #1a1a1a;
}

.sulfah-bnpl-method .sulfah-benefit__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #eaf6ec;
}

.sulfah-bnpl-method .sulfah-benefit__img {
    display: block;
    width: 20px !important;
    height: 20px !important;
    object-fit: contain;
}

@media (max-width: 600px) {
    .sulfah-bnpl-method .sulfah-promo {
        gap: 24px;
    }
}

/* ==========================================================================
   Checkout panel: live per-installment preview.
   ========================================================================== */
.sulfah-bnpl-method .sulfah-promo__preview {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    margin: 2px 0 2px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #eaf6ec;
}

.sulfah-bnpl-method .sulfah-promo__preview-amt {
    font-size: 18px;
    font-weight: 800;
    color: #1f7a31;
    white-space: nowrap;
}

.sulfah-bnpl-method .sulfah-promo__preview-prefix {
    font-size: 12px;
    color: #4b6b54;
}

.sulfah-bnpl-method .sulfah-promo__preview-unit {
    font-size: 12px;
    color: #4b6b54;
}

.sulfah-bnpl-method .sulfah-promo__approx {
    margin: 2px 0 0;
    font-size: 11px;
    line-height: 1.4;
    color: #9aa3af;
}

/* ==========================================================================
   On-site promo widget (PDP + cart pages).
   ========================================================================== */
.sulfah-promo-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0;
    padding: 14px 16px;
    min-height: 64px;
    border: 1px solid #d8e6dc;
    border-radius: 14px;
    background: #fbfefc;
    box-shadow: 0 1px 2px rgba(20, 40, 28, 0.04);
}

.sulfah-promo-widget__logo {
    height: 26px !important;
    max-height: 26px !important;
    width: auto !important;
    max-width: 76px !important;
    flex: 0 0 auto;
    object-fit: contain;
}

.sulfah-promo-widget__body {
    flex: 1 1 auto;
    min-width: 0;
}

.sulfah-promo-widget__lead {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: #1a1a1a;
}

.sulfah-promo-widget__lead .sulfah-amt {
    color: #1f7a31;
    font-weight: 800;
    white-space: nowrap;
}

.sulfah-promo-widget__meta {
    margin: 3px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: #6b7280;
}

.sulfah-promo-widget__note {
    margin: 2px 0 0;
    font-size: 11px;
    line-height: 1.4;
    color: #9aa3af;
}

.sulfah-promo-widget__more {
    flex: 0 0 auto;
    align-self: center;
    border: 0;
    background: transparent;
    padding: 6px 4px;
    font-weight: 700;
    font-size: 13px;
    color: #1f7a31;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    white-space: nowrap;
}
.sulfah-promo-widget__more:hover { color: #166026; }
.sulfah-promo-widget__more:focus-visible {
    outline: 2px solid #31a343;
    outline-offset: 2px;
    border-radius: 6px;
    text-decoration: none;
}

@media (max-width: 480px) {
    .sulfah-promo-widget {
        flex-wrap: wrap;
        row-gap: 6px;
    }
    .sulfah-promo-widget__more {
        flex-basis: 100%;
        text-align: start;
        align-self: flex-start;
        padding-inline: 0;
    }
}

@media (min-width: 768px) {
    .cart-summary .sulfah-promo-widget {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 14px;
        min-height: 0;
    }
    .cart-summary .sulfah-promo-widget__logo {
        align-self: flex-start;
    }
    .cart-summary .sulfah-promo-widget__body {
        width: 100%;
    }
    .cart-summary .sulfah-promo-widget__lead {
        font-size: 13px;
        line-height: 1.5;
        word-break: normal;
        overflow-wrap: anywhere;
    }
    .cart-summary .sulfah-promo-widget__meta { font-size: 11.5px; }
    .cart-summary .sulfah-promo-widget__more {
        align-self: flex-start;
        flex: 0 0 auto;
        padding-inline: 0;
        white-space: normal;
    }
}

/* ==========================================================================
   Installment schedule timeline rows.
   ========================================================================== */
.sulfah-plan {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sulfah-plan__row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f3f2;
}
.sulfah-plan__row:last-child { border-bottom: 0; }

.sulfah-plan__dot {
    position: relative;
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #c7d7cc;
}
.sulfah-plan__row:not(:last-child) .sulfah-plan__dot::after {
    content: "";
    position: absolute;
    inset-inline-start: 50%;
    top: 14px;
    transform: translateX(-50%);
    width: 2px;
    height: 34px;
    background: #e4ece7;
}
.sulfah-plan__row.is-today .sulfah-plan__dot {
    background: #31a343;
    border-color: #31a343;
    box-shadow: 0 0 0 4px rgba(49, 163, 67, 0.15);
}

.sulfah-plan__when {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}
.sulfah-plan__label { font-size: 14px; font-weight: 700; color: #1a1a1a; }
.sulfah-plan__sub   { font-size: 12px; color: #6b7280; margin-top: 1px; }
.sulfah-plan__row.is-today .sulfah-plan__label { color: #1f7a31; }

.sulfah-plan__amt {
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 800;
    color: #1a1a1a;
    white-space: nowrap;
}
.sulfah-plan__row.is-more { opacity: 0.72; }
.sulfah-plan__row.is-more .sulfah-plan__label { font-weight: 600; }

.sulfah-info__note {
    margin: 4px 0 14px;
    font-size: 12px;
    line-height: 1.6;
    color: #6b7280;
    text-align: center;
}

/* ==========================================================================
   In-page modal hosting the Sulfah hosted checkout (iframe).
   ========================================================================== */
body.sulfah-modal-open { overflow: hidden; }

.sulfah-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sulfah-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 28, 24, 0.55);
}

.sulfah-modal__dialog {
    position: relative;
    z-index: 1;
    width: 460px;
    max-width: calc(100% - 24px);
    height: 760px;
    max-height: calc(100vh - 48px);
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.sulfah-modal__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #eef1ef;
    flex: 0 0 auto;
}

.sulfah-modal__title {
    font-weight: 700;
    font-size: 14px;
    color: #1a1a1a;
}

.sulfah-modal__close {
    border: 0;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0 6px;
}

.sulfah-modal__frame {
    border: 0;
    width: 100%;
    flex: 1 1 auto;
}

@media (max-width: 600px) {
    .sulfah-modal__dialog {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
}

/* ==========================================================================
   «كيف يعمل» info sheet (schedule modal).
   ========================================================================== */
.sulfah-promo__more {
    margin-top: 8px;
    font-weight: 700;
    font-size: 13px;
    color: #31a343;
    text-decoration: underline;
    cursor: pointer;
}

.sulfah-info {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sulfah-info[hidden] { display: none; }

.sulfah-info__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 28, 24, 0.55);
}

.sulfah-info.is-open .sulfah-info__dialog {
    animation: sulfah-dialog-in 0.18s ease-out both;
}
@keyframes sulfah-dialog-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .sulfah-info.is-open .sulfah-info__dialog { animation: none; }
}

.sulfah-info__dialog:focus { outline: none; }
.sulfah-info__close:focus-visible,
.sulfah-info__continue:focus-visible {
    outline: 2px solid #31a343;
    outline-offset: 2px;
    border-radius: 8px;
}

.sulfah-info__dialog {
    position: relative;
    z-index: 1;
    width: 420px;
    max-width: calc(100% - 24px);
    max-height: calc(100vh - 48px);
    background: #f4f6f5;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.sulfah-info__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    flex: 0 0 auto;
}

.sulfah-info__logo { height: 26px; width: auto; }

.sulfah-info__close {
    border: 0;
    background: transparent;
    font-size: 26px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
}

.sulfah-info__body {
    padding: 16px;
    overflow-y: auto;
}

.sulfah-info__hero {
    background: linear-gradient(160deg, #31a343, #1f7a31);
    color: #fff;
    border-radius: 14px;
    padding: 28px 20px;
    text-align: center;
    margin-bottom: 16px;
}

.sulfah-info__hero h3 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.sulfah-info__hero p  { margin: 0; font-size: 14px; opacity: 0.95; }

.sulfah-info__section,
.sulfah-info__card {
    background: #fff;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 12px;
}

.sulfah-info__section h4 { margin: 0 0 14px; font-size: 16px; font-weight: 800; color: #1a1a1a; }

.sulfah-steps { list-style: none; margin: 0; padding: 0; }
.sulfah-steps li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #f1f3f2;
}
.sulfah-steps li:last-child { border-bottom: 0; }
.sulfah-steps__n {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #eaf6ec;
    color: #31a343;
    font-weight: 800;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sulfah-info__card {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sulfah-info__card-icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #eaf6ec;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.sulfah-info__card-icon img { width: 24px; height: 24px; }
.sulfah-info__card strong { display: block; font-size: 14px; color: #1a1a1a; }
.sulfah-info__card p { margin: 2px 0 0; font-size: 13px; color: #6b7280; }

.sulfah-info__continue {
    width: 100%;
    border: 0;
    border-radius: 28px;
    background: #16231b;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    padding: 14px;
    cursor: pointer;
    margin-top: 4px;
}
.sulfah-info__continue:hover { background: #0e1712; }

body.sulfah-info-open { overflow: hidden; }

@media (max-width: 600px) {
    .sulfah-info { align-items: flex-end; }
    .sulfah-info__dialog {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
    }
    .sulfah-info.is-open .sulfah-info__dialog {
        animation: sulfah-sheet-up 0.22s ease-out both;
    }
}
@keyframes sulfah-sheet-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .sulfah-info.is-open .sulfah-info__dialog { animation: none; }
}
