/* DeviceHub Bank Installments — product page panel.
   A row of bank cards (logo, "upto N months", lowest monthly amount) that slides
   sideways when it does not fit. Tapping a card opens that bank's plan table
   underneath. On phones (767px and below) the cards are two and a bit per view and
   the plan table stays a table, just tighter.

   Colours, radius, borders and text sizes come from the DeviceHub theme's own
   design tokens (--devhub-*) so the panel looks like the rest of the product
   page; the fallback after each token keeps it presentable on other themes. */

.dhi-panel {
  --dhi-accent: var(--devhub-primary, #ff6600);
  --dhi-accent-soft: #fff5f0; /* same as the selected tab pill */
  --dhi-text: var(--devhub-dark, #1f2937);
  --dhi-muted: var(--devhub-mid, #667085);
  --dhi-line: var(--devhub-border, #e4e7ec);
  --dhi-surface: var(--devhub-bg, #f7f8fa);
  --dhi-radius: var(--devhub-radius-md, 14px);
  --dhi-size: var(--devhub-text-2xl, 16px);

  margin: 18px 0;
  clear: both;
  max-width: 100%;
  color: var(--dhi-text);
  font-size: var(--dhi-size);
}

.dhi-panel[hidden] {
  display: none !important;
}

/* Screen-reader-only text (the bank name when the card shows a logo) */
.dhi-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.dhi-intro {
  margin: 0 0 14px;
  color: var(--dhi-text);
}

.dhi-hint {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: var(--dhi-radius);
  background: var(--dhi-accent-soft);
  color: var(--dhi-accent);
}

.dhi-hint[hidden],
.dhi-banks[hidden],
.dhi-detail[hidden] {
  display: none;
}

/* ── Bank cards ─ same look as the page's other selectable cards ──────────── */

/* The bank cards sit in ONE row. When they do not fit, the row slides sideways:
   arrows on desktop, a swipe on phones (same idea as the product page's bundle cards). */
.dhi-slider {
  position: relative;
}

.dhi-viewport {
  /* A little room so the selected card's border and focus ring are not clipped. */
  margin: -4px;
  padding: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.dhi-viewport::-webkit-scrollbar {
  display: none;
}

.dhi-cards {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
}

.dhi-cards .dhi-card {
  flex: 0 0 190px;
  scroll-snap-align: start;
}

.dhi-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--dhi-line);
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--devhub-shadow-card, 0 6px 16px rgba(16, 24, 40, 0.12));
  cursor: pointer;
  transform: translateY(-50%);
  transition: border-color 0.15s;
}

.dhi-nav[hidden] {
  display: none;
}

.dhi-nav:hover {
  border-color: var(--dhi-accent);
}

.dhi-nav:focus {
  outline: 0;
}

.dhi-nav:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.22);
}

.dhi-nav svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--dhi-text);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dhi-nav--prev {
  left: -12px;
}

.dhi-nav--next {
  right: -12px;
}

.dhi-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  padding: 18px 12px;
  border: 1.5px solid var(--dhi-line);
  border-radius: var(--dhi-radius);
  background: #fff;
  box-shadow: none;
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.dhi-card:hover {
  border-color: var(--dhi-accent);
  background: #fff;
}

/* No browser focus ring on click. Keyboard users still get a soft orange ring. */
.dhi-card:focus {
  outline: 0 !important;
}

.dhi-card:focus-visible {
  outline: 0 !important;
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.22);
}

/* Selected bank: the same look as the selected tab pill */
.dhi-card.is-active,
.dhi-card.is-active:hover {
  border-color: var(--dhi-accent);
  background: var(--dhi-accent-soft);
}

.dhi-card-face {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
}

.dhi-logo {
  display: block;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: 44px !important;
  object-fit: contain;
}

.dhi-card-name {
  font-size: var(--dhi-size);
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.dhi-card-upto,
.dhi-card-amount {
  color: var(--dhi-accent);
  font-weight: 600;
  line-height: 1.25;
}

.dhi-card-upto {
  font-size: calc(var(--dhi-size) * 0.85);
}

.dhi-card-amount {
  font-size: var(--dhi-size);
  font-weight: 700;
}

/* ── The opened bank ─ same look as the page's specification table ────────── */

.dhi-details {
  margin-top: 16px;
}

.dhi-detail {
  overflow: hidden;
  border: 1px solid var(--dhi-line);
  border-radius: var(--dhi-radius);
  background: #fff;
  box-shadow: var(--devhub-shadow-card, 0 12px 30px rgba(16, 24, 40, 0.06));
}

/* The bank name row above the plan table is hidden for now (the selected bank card
   already shows which bank is open). Remove this one line to bring it back. */
.dhi-detail-title {
  display: none;
  margin: 0;
  padding: 14px 20px;
  border-bottom: 1px solid var(--dhi-line);
  background: var(--dhi-surface);
  color: var(--dhi-text);
  font-size: var(--dhi-size);
  font-weight: 700;
}

/* Plans table */
.dhi-scroll {
  max-width: 100%;
}

.dhi-panel table {
  width: 100%;
  margin: 0;
  border: 0 !important; /* the theme frames every table; the bank card is already the frame */
  border-collapse: collapse;
}

.dhi-panel th,
.dhi-panel td {
  padding: 14px 20px;
  border: 0;
  border-top: 1px solid var(--dhi-line);
  text-align: center;
  vertical-align: top;
  font-size: var(--dhi-size);
  overflow-wrap: break-word;
}

.dhi-panel thead th {
  border-top: 0;
  border-bottom: 0;
  background: var(--dhi-surface) !important;
  color: var(--dhi-text) !important;
  font-weight: 700;
}

.dhi-panel tbody tr:nth-child(even) {
  background: var(--dhi-surface);
}

.dhi-month,
.dhi-total,
.dhi-fee {
  white-space: nowrap;
}

/* An amount: the currency right next to the number, centred in the cell. */
.dhi-money {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.dhi-month {
  color: var(--dhi-accent);
  font-weight: 700;
}

/* Terms & Conditions of a bank */
.dhi-bank-info {
  padding: 12px 20px;
  border-top: 1px solid var(--dhi-line);
  overflow-wrap: anywhere;
}

.dhi-terms summary {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--dhi-text);
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.dhi-terms summary::-webkit-details-marker {
  display: none;
}

.dhi-terms summary:focus {
  outline: 0;
}

.dhi-terms summary:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.22);
}

.dhi-arrow {
  margin-left: auto;
  font-size: 20px;
  transition: transform 0.15s;
}

.dhi-terms[open] > summary > .dhi-arrow {
  transform: rotate(180deg);
}

.dhi-terms > div {
  padding: 10px 0;
  line-height: 1.6;
}

/* The theme removes the space between paragraphs, so the gaps typed in the
   editor would not show. Give the terms their own spacing. */
.dhi-terms > div > * {
  margin-top: 0;
  margin-bottom: 14px;
}

.dhi-terms > div > *:last-child {
  margin-bottom: 0;
}

/* The theme paints paragraphs grey. Keep the terms in the same dark text as the rest
   of the page, with bold text and links in that same colour. */
.dhi-terms > div,
.dhi-terms > div :is(p, li, span, strong, b, em, i, u, a, h1, h2, h3, h4, h5, h6) {
  color: var(--dhi-text);
}

.dhi-terms > div :is(h1, h2, h3, h4, h5, h6) {
  font-size: inherit;
  font-weight: 700;
}

.dhi-terms > div ul,
.dhi-terms > div ol {
  padding-left: 24px;
}

.dhi-terms > div ul {
  list-style: disc;
}

.dhi-terms > div ol {
  list-style: decimal;
}

.dhi-terms > div li {
  margin-bottom: 6px;
}

.dhi-terms > div a {
  text-decoration: underline;
}

/* Under the price row of the DeviceHub theme */
.devhub-single__price-row + .dhi-panel {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

/* ── Plan table with grid lines (every screen size) ───────────────────────── */

.dhi-panel th,
.dhi-panel td {
  border: 1px solid var(--dhi-line);
}

/* The bank card already has the outer frame. */
.dhi-panel th:first-child,
.dhi-panel td:first-child {
  border-left: 0;
}

.dhi-panel th:last-child,
.dhi-panel td:last-child {
  border-right: 0;
}

.dhi-panel thead th {
  border-top: 0;
}

.dhi-panel tbody tr:last-child td {
  border-bottom: 0;
}

/* ── Phones ──────────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
  /* Small cards: three whole ones, and a sliver of the fourth so it is clear the
     row slides. With three banks or fewer they simply share the width. */
  .dhi-cards {
    gap: 8px;
  }

  .dhi-cards .dhi-card {
    flex: 0 0 calc((100% - 3 * 8px - 24px) / 3);
  }

  .dhi-cards--few .dhi-card {
    flex: 0 0 calc((100% - 2 * 8px) / 3);
  }

  .dhi-nav {
    display: none;
  }

  .dhi-card {
    gap: 3px;
    padding: 9px 4px;
  }

  .dhi-card-face {
    height: 30px;
  }

  .dhi-logo {
    max-height: 26px !important;
  }

  .dhi-card-name {
    font-size: 11px;
  }

  .dhi-card-upto {
    font-size: 10px;
  }

  .dhi-card-amount {
    font-size: 11px;
  }

  .dhi-detail-title {
    padding: 12px 14px;
  }

  .dhi-bank-info {
    padding: 12px 14px;
  }

  /* The plan table stays a table on phones, just tighter, so the columns line up
     like on a bigger screen. The theme gives every table equal fixed columns; here the
     columns follow their content, so a long amount gets the room it needs. */
  .dhi-panel table {
    table-layout: auto !important;
  }

  .dhi-panel th,
  .dhi-panel td {
    padding: 8px 3px;
    font-size: 12px;
    line-height: 1.3;
    letter-spacing: 0;
  }

  .dhi-panel thead th {
    font-size: 11.5px;
  }

  /* Break between words only, never in the middle of one ("Month(s)", an amount). */
  .dhi-panel th,
  .dhi-panel td {
    word-break: normal !important;
    overflow-wrap: normal !important;
  }

  .dhi-panel thead th:first-child {
    white-space: nowrap;
  }

  /* Currency next to the number, always on one line. When the columns do not leave
     room, the text gets smaller instead of the currency dropping to its own line. */
  .dhi-money {
    flex-wrap: nowrap;
    gap: 0 3px;
  }

  .dhi-table--fee th,
  .dhi-table--fee td {
    padding-left: 2px;
    padding-right: 2px;
    font-size: 10.5px;
  }

  .dhi-table--fee thead th {
    font-size: 10px;
  }

  .dhi-table--fee .dhi-money {
    gap: 0 2px;
  }
}

@media (max-width: 370px) {
  /* Very narrow phones: the bank cards get a little less text and padding so
     "upto 36 months" and the amount stay inside the card. */
  .dhi-card {
    padding-left: 2px;
    padding-right: 2px;
  }

  .dhi-card-name {
    font-size: 10px;
  }

  .dhi-card-upto {
    font-size: 8.5px;
  }

  .dhi-card-amount {
    font-size: 9.5px;
  }

  .dhi-panel th,
  .dhi-panel td {
    font-size: 11px;
  }

  .dhi-panel thead th {
    font-size: 10.5px;
  }

  .dhi-table--fee th,
  .dhi-table--fee td {
    font-size: 9.5px;
  }

  .dhi-table--fee thead th {
    font-size: 9px;
  }
}

@media (max-width: 340px) {
  .dhi-table--fee th,
  .dhi-table--fee td {
    padding-left: 1px;
    padding-right: 1px;
    font-size: 8.5px;
  }

  .dhi-table--fee thead th {
    font-size: 8.5px;
  }
}
