/*
 * Offer Includes — ported from AEM Cloud's
 * southLandingComponents/offerIncludes clientlib/css/style.css, near
 * verbatim (same .oi- class names, colors, breakpoints).
 */

/* ======================================================
   SECTION
====================================================== */
.oi-section {
  background: #12182A;
  padding: 60px 0;
  width: 100%;
}

/* ======================================================
   SECTION HEADER
====================================================== */
.oi-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  text-align: center;
  padding: 0 24px;
}

.oi-header__icon-wrap {
  width: 50px;
  height: 50px;
  background: #E84B1C;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.oi-header__icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.oi-header__title {
  color: #FFFFFF;
  font-size: 32px;
  font-weight: 700;
  margin: 0;
}

/* ======================================================
   MAIN CARD WRAPPER
====================================================== */
.oi-card {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 120px;
  display: flex;
  gap: 30px;
}

/* ======================================================
   LEFT COLUMN — authored STB + features
====================================================== */
.oi-card__left {
  flex: 0 0 48%;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  background: #1C2540;
  border-radius: 12px;
  border: 1px solid #3C475B;
}

.oi-card__stb-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.oi-card__stb-img {
  width: 100%;
  max-width: 210px;
  height: auto; /* width/height attributes only reserve the aspect ratio */
  object-fit: contain;
  display: block;
}

/* Feature icons row */
.oi-features {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  gap: 10px;
}

.oi-features__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  list-style: none;
}

/* Dark tile is CSS-drawn here (not baked into the authored image), so any uploaded
   icon — with or without its own background — renders consistently. */
.oi-features__icon-wrap {
  width: 48px;
  height: 48px;
  background: #2A3350;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.oi-features__icon {
  width: 16px !important;
  height: 16px !important;
  object-fit: contain;
}

.oi-features__text {
  color: #D1D5DB;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

/* ======================================================
   RIGHT COLUMN — API-driven content
====================================================== */
.oi-card__right {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  background: #1C2540;
  border-radius: 12px;
  border: 1px solid #3C475B;
}

/* Pack info block */
.oi-pack-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.oi-pack-info__name {
  color: #FFFFFF;
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  text-align: center;
  min-height: 32px;
}

.oi-pack-info__channels {
  color: #9CA3AF;
  font-size: 14px;
  text-align: center;
  margin: 0 0 12px;
  min-height: 20px;
}

/* Channel logo grid — 4-column, up to 8 logos (2 rows). Columns stay 1fr so the
   grid still lays out 4-wide, but each tile caps at max-width so it doesn't
   stretch to fill the whole column on a wide card. */
.oi-logo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  justify-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.oi-logo-grid__item {
  width: 100%;
  max-width: 90px;
  background: #E8EEF6;
  border-radius: 10px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  list-style: none;
  overflow: hidden;
}

.oi-logo-grid__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

/* ======================================================
   SHIMMER — GPU-accelerated via transform: translateX
   Uses ::after pseudo-element so background-position is
   never animated — no CPU repaints on mobile.
====================================================== */
@keyframes oi-shimmer {
  100% { transform: translateX(100%); }
}

/* Logo grid skeleton shimmer — same cap as the real tiles so loading and loaded states match. */
.oi-logo-grid__skeleton {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 90px;
  background: #D0DAE8;
  border-radius: 10px;
  aspect-ratio: 1;
  list-style: none;
}

.oi-logo-grid__skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgb(255 255 255 / 35%) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: oi-shimmer 1.4s infinite;
}

/* Empty tile — static muted placeholder after API failure,
   same size as skeleton/logo tiles, no shimmer animation */
.oi-logo-grid__empty {
  width: 100%;
  max-width: 90px;
  background: #1C2540;
  border-radius: 10px;
  aspect-ratio: 1;
  list-style: none;
  opacity: 0.25;
}

/* ======================================================
   TEXT SKELETON LINES
   Applied to pack name + SD|HD count while API resolves
====================================================== */
.oi-skel-line {
  position: relative;
  overflow: hidden;
  display: block;
  border-radius: 6px;
  background: #2e3a52;
  color: transparent !important;
  pointer-events: none;
}

.oi-skel-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgb(255 255 255 / 12%) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: oi-shimmer 1.4s infinite;
}

/* Pack name — wider bar */
.oi-skel-line--name {
  width: 70%;
  height: 28px;
  margin: 0 auto 4px;
  min-height: 0;
}

/* SD|HD count — narrower bar */
.oi-skel-line--count {
  width: 40%;
  height: 16px;
  margin: 0 auto;
  min-height: 0;
}

/* View Details button — muted while loading */
.oi-view-details-btn.oi-btn--loading {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* View Details button */
.oi-view-details-wrap {
  display: flex;
  justify-content: center;
  margin-top: auto;
}

.oi-view-details-btn {
  background: #1B1516;
  color: #F04C23;
  border: 2px solid #F04C234D;
  border-radius: 24px;
  padding: 9px 28px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.oi-view-details-btn:hover,
.oi-view-details-btn:focus-visible {
  background: #6B3B1E;
  outline: none;
}

/* ======================================================
   MODAL — dark backdrop + white panel
====================================================== */
.oi-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.oi-modal[hidden] {
  display: none;
}

.oi-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 65%);
}

.oi-modal__panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  background: #151519;
  border-radius: 16px 16px 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 48px 0 32px;
}

.oi-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
  z-index: 1;
}

.oi-modal__close:hover {
  background: #2A3550;
}

.oi-modal__close svg path {
  stroke: #FFFFFF;
}

/* ======================================================
   ACCORDION — inside modal
====================================================== */
.oi-modal__accordion-list {
  display: flex;
  flex-direction: column;
  padding: 0 16px;
  gap: 8px;
}

.oi-accordion-item {
  background: #292930;
  border: 1px solid #3C475B;
  border-radius: 8px;
  overflow: hidden;
}

.oi-accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.oi-accordion-title {
  font-size: 14px;
  font-weight: 500;
  color: #FFFFFF;
  line-height: 1.4;
}

.oi-accordion-chevron {
  flex-shrink: 0;
  margin-left: 12px;
  display: flex;
  align-items: center;
  transition: transform 0.3s ease;
}

.oi-accordion-chevron svg path {
  stroke: #FFFFFF;
}

.oi-accordion-item.active .oi-accordion-chevron {
  transform: rotate(180deg);
}

/* Accordion panel — max-height transition */
.oi-accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.oi-accordion-item.active .oi-accordion-panel {
  max-height: 600px;
}

/* Channel grid inside accordion panel — horizontal scroll */
.oi-accordion-channel-grid {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid #3C475B;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.oi-accordion-channel-grid::-webkit-scrollbar {
  display: none;
}

/* Individual channel card inside accordion */
.oi-channel-card {
  flex-shrink: 0;
  width: 72px;
  text-align: center;
}

.oi-channel-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #E5E7EB;
  display: block;
  margin: 0 auto 6px;
  padding: 5px;
  background-color: #fff;
}

.oi-channel-name {
  font-size: 10px;
  color: #6B7280;
  margin: 0;
  line-height: 1.3;
  word-break: break-word;
}

/* Channel logo initial-letter fallback */
.oi-channel-logo-fallback {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: #F3F4F6;
  color: #9CA3AF;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 6px;
  flex-shrink: 0;
}

/* ======================================================
   DESKTOP — center modal (not bottom-sheet)
====================================================== */
@media (min-width: 768px) {
  .oi-modal {
    align-items: center;
  }

  .oi-modal__panel {
    border-radius: 16px;
    max-height: 80vh;
  }

  .oi-accordion-channel-grid {
    flex-wrap: wrap;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    max-height: 250px;
    background-color: #EEEEEE;
  }
}

/* ======================================================
   TABLET  (max-width: 1024px)
====================================================== */
@media (max-width: 1024px) {
  .oi-card {
    max-width: 720px;
  }

  .oi-card__left,
  .oi-card__right {
    padding: 24px 20px;
  }
}

/* ======================================================
   MOBILE  (max-width: 768px)
====================================================== */
@media (max-width: 768px) {
  .oi-section {
    padding: 40px 0;
  }

  .oi-header {
    margin-bottom: 24px;
  }

  .oi-header__title {
    font-size: 28px;
  }

  /* Card wrapper becomes a transparent spacer — each column is its own card */
  .oi-card {
    flex-direction: column;
    margin: 0 16px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    gap: 16px;
    overflow: visible;
  }

  /* Left column — STB card */
  .oi-card__left {
    border-radius: 20px;
    border: 1px solid #3C475B;
    padding: 24px 20px;
    flex: none;
  }

  /* Right column — pack info card */
  .oi-card__right {
    border-radius: 20px;
    border: 1px solid #3C475B;
    padding: 24px 20px;
    flex: none;
    gap: 16px;
  }

  .oi-pack-info__name {
    font-size: 26px;
  }

  .oi-modal__panel {
    max-width: 100%;
  }
}

/* ======================================================
   SMALL MOBILE  (max-width: 480px)
====================================================== */
@media (max-width: 480px) {
  .oi-card {
    margin: 0 12px;
  }

  .oi-logo-grid {
    gap: 8px;
  }

  .oi-features {
    gap: 4px;
  }

  .oi-features__icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .oi-features__icon {
    width: 16px !important;
    height: 16px !important;
  }

  .oi-features__text {
    font-size: 10px;
  }

  .oi-pack-info__name {
    font-size: 24px;
  }
}

/* ======================================================
   STATIC MODE — no channel icons authored, no API column.
   Left card is centered on its own (all breakpoints).
====================================================== */
.offer-include.oi-static .oi-card {
  justify-content: center;
}

.offer-include.oi-static .oi-card__left {
  flex: 0 1 450px;
  width: 100%;
  max-width: 450px;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .offer-include.oi-static .oi-card {
    align-items: center;
  }

  .offer-include.oi-static .oi-card__left {
    flex: none;
  }
}
