/* ==========================================================================
   "Buy Now Pay Later" installment drawer (redesign)
   Desktop + mobile, EN (LTR) + AR (RTL). Self-contained; scoped to .bnpl.
   ========================================================================== */

.bnpl {
  --bnpl-brown: #8a4a1f;
  --bnpl-brown-dark: #7a4019;
  --bnpl-orange: #ec6726;
  --bnpl-green: #2f7d33;
  --bnpl-ink: #1f2a37;
  --bnpl-text: #3a4653;
  --bnpl-muted: #8a94a2;
  --bnpl-line: #eceef1;
  --bnpl-card-border: #e6e8ec;
  --bnpl-thead: #dbe4ee;
  --bnpl-thead-ink: #2b3a4a;
  --bnpl-note-bg: #fdf3e2;
  --bnpl-note-ink: #9a6a1e;
  --bnpl-note-icon: #e0a12e;

  position: fixed;
  inset: 0;
  z-index: 10000;
  display: block;
  visibility: hidden;
  pointer-events: none;
  font-family: inherit;
}

.bnpl.is-open {
  visibility: visible;
  pointer-events: auto;
}

.bnpl *,
.bnpl *::before,
.bnpl *::after {
  box-sizing: border-box;
}

/* Overlay ------------------------------------------------------------------ */
.bnpl__overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 33, 0.45);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bnpl.is-open .bnpl__overlay {
  opacity: 1;
}

/* Panel -------------------------------------------------------------------- */
.bnpl__panel {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  width: 540px;
  max-width: 100%;
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(17, 24, 33, 0.18);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
  outline: none;
}

[dir="rtl"].bnpl .bnpl__panel {
  box-shadow: 12px 0 40px rgba(17, 24, 33, 0.18);
  transform: translateX(-100%);
}

.bnpl.is-open .bnpl__panel {
  transform: translateX(0);
}

/* Header ------------------------------------------------------------------- */
.bnpl__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px 12px;
}

.bnpl__title {
  margin: 0;
  font-size: 27px;
  line-height: 1.2;
  font-weight: 800;
  color: var(--bnpl-ink);
}

.bnpl__close {
  flex: none;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: #f3f4f6;
  color: #3a4653;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.bnpl__close:hover {
  background: #e7e9ec;
  color: #111;
}

/* Scroll area -------------------------------------------------------------- */
.bnpl__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 28px 28px;
}

/* Tabs --------------------------------------------------------------------- */
.bnpl__tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--bnpl-card-border);
  border-radius: 12px;
  margin-bottom: 22px;
}

.bnpl__tab {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--bnpl-brown);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.bnpl__tab svg {
  flex: none;
}

.bnpl__tab.is-active {
  background: var(--bnpl-brown);
  color: #fff;
}

.bnpl__tab[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Section label ------------------------------------------------------------ */
.bnpl__section-label {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--bnpl-muted);
}

/* Company grid ------------------------------------------------------------- */
.bnpl__companies {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.bnpl__companies[hidden] {
  display: none;
}

.bnpl__company {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 66px;
  padding: 10px;
  border: 1.5px solid var(--bnpl-card-border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.bnpl__company:hover {
  border-color: #d7dade;
}

.bnpl__company.is-selected {
  border-color: var(--bnpl-orange);
  box-shadow: 0 0 0 1px var(--bnpl-orange);
}

.bnpl__company-logo {
  max-width: 100%;
  max-height: 34px;
  object-fit: contain;
}

.bnpl__company-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--bnpl-ink);
  text-align: center;
}

/* Summary (company + cash price) ------------------------------------------- */
.bnpl__summary {
  display: flex;
  align-items: stretch;
  gap: 20px;
  padding: 4px 0 18px;
}

.bnpl__summary-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bnpl__summary-col--price {
  border-inline-start: 2px solid var(--bnpl-orange);
  padding-inline-start: 18px;
}

.bnpl__summary-value {
  font-size: 13px;
  color: var(--bnpl-muted);
}

.bnpl__summary-label {
  font-size: 19px;
  font-weight: 800;
  color: var(--bnpl-ink);
}

/* Plans table -------------------------------------------------------------- */
.bnpl__table {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--bnpl-line);
}

.bnpl__row {
  display: grid;
  grid-template-columns: 0.9fr 0.9fr 0.9fr 1.25fr;
  align-items: center;
  padding: 15px 16px;
}

.bnpl__row--head {
  background: var(--bnpl-thead);
  padding: 16px;
}

.bnpl__row--head span {
  font-size: 15px;
  font-weight: 700;
  color: var(--bnpl-thead-ink);
}

.bnpl__tbody .bnpl__row {
  border-top: 1px solid var(--bnpl-line);
}

.bnpl__cell {
  font-size: 15px;
  color: var(--bnpl-text);
  text-align: center;
}

.bnpl__row--head span:first-child,
.bnpl__cell--months {
  text-align: start;
}

.bnpl__row--head span:last-child,
.bnpl__cell--amount {
  text-align: end;
  font-weight: 600;
  color: var(--bnpl-ink);
}

/* Offer group -------------------------------------------------------------- */
.bnpl__offer {
  position: relative;
  margin: 12px 6px;
  padding: 10px 0 2px;
  border: 2px solid var(--bnpl-green);
  border-radius: 12px;
}

.bnpl__offer .bnpl__row {
  padding-inline: 10px;
  border-top: 0;
}

.bnpl__offer .bnpl__row + .bnpl__row {
  border-top: 1px solid rgba(47, 125, 51, 0.18);
}

.bnpl__offer-badge {
  position: absolute;
  top: -14px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bnpl-green);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(47, 125, 51, 0.3);
}

[dir="rtl"].bnpl .bnpl__offer-badge {
  transform: translateX(50%);
}

/* Approximate-amount note -------------------------------------------------- */
.bnpl__note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding: 13px 16px;
  border-radius: 10px;
  background: var(--bnpl-note-bg);
  color: var(--bnpl-note-ink);
  font-size: 14px;
  font-weight: 600;
}

.bnpl__note svg {
  flex: none;
  color: var(--bnpl-note-icon);
}

/* Body scroll lock --------------------------------------------------------- */
.bnpl-lock {
  overflow: hidden;
}

/* Mobile ------------------------------------------------------------------- */
@media (max-width: 767px) {
  .bnpl__panel {
    width: 100%;
    box-shadow: none;
  }

  .bnpl__head {
    padding: 18px 18px 8px;
  }

  .bnpl__title {
    font-size: 23px;
  }

  .bnpl__scroll {
    padding: 6px 18px 22px;
  }

  .bnpl__companies {
    gap: 10px;
  }

  .bnpl__company {
    min-height: 58px;
    padding: 8px;
  }

  .bnpl__company-logo {
    max-height: 28px;
  }

  .bnpl__tab {
    font-size: 13px;
    padding: 12px 8px;
    gap: 6px;
  }

  .bnpl__summary-label {
    font-size: 17px;
  }

  .bnpl__row {
    padding: 13px 12px;
  }

  .bnpl__cell,
  .bnpl__row--head span {
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  .bnpl__companies {
    grid-template-columns: repeat(3, 1fr);
  }
}
