.hicasa-shop-gallery[hidden],
.hicasa-shop-gallery [hidden] {
  display: none !important;
}

body.hicasa-shop-gallery-open {
  overflow: hidden;
}

.hicasa-shop-gallery {
  position: fixed;
  z-index: 999999;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  color: #111827;
}

.hicasa-shop-gallery__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 12, 22, 0.92);
}

.hicasa-shop-gallery__dialog {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  width: min(1180px, 100%);
  height: min(900px, calc(100vh - 40px));
  height: min(900px, calc(100dvh - 40px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.hicasa-shop-gallery__details {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-height: 52px;
  padding: 9px 16px 10px;
  border-top: 1px solid #d8dee8;
  background: #ffffff;
}

.hicasa-shop-gallery__title {
  display: flex;
  gap: 9px;
  align-items: baseline;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #111827;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hicasa-shop-gallery__title-sku {
  flex: 0 0 auto;
  color: #184f91;
  font-size: 14px;
  font-weight: 800;
}

.hicasa-shop-gallery__title-name {
  min-width: 0;
  overflow: hidden;
  color: #111827;
  text-overflow: ellipsis;
}

.hicasa-shop-gallery__counter {
  display: none !important;
}

.hicasa-shop-gallery__close,
.hicasa-shop-gallery__arrow,
.hicasa-shop-gallery__thumbnail {
  appearance: none;
  border: 0;
  cursor: pointer;
}

.hicasa-shop-gallery__close {
  position: absolute;
  z-index: 5;
  top: 5px;
  right: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #d3dce8;
  border-radius: 6px;
  background: #ffffff;
  color: #172033;
  font-family: Arial, sans-serif;
  font-size: 26px;
  line-height: 1;
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.15);
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 80ms ease;
}

.hicasa-shop-gallery__close:hover,
.hicasa-shop-gallery__close:focus-visible {
  border-color: #9eb2cc;
  background: #f4f7fb;
  color: #0d417f;
  box-shadow: 0 5px 17px rgba(17, 24, 39, 0.2);
}

.hicasa-shop-gallery__close:active {
  transform: translateY(1px);
  box-shadow: 0 2px 7px rgba(17, 24, 39, 0.18);
}

.hicasa-shop-gallery__stage {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
  background: #f7f8fa;
  touch-action: pan-y;
  user-select: none;
}

.hicasa-shop-gallery__figure {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
}

.hicasa-shop-gallery__image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}

.hicasa-shop-gallery__arrow {
  position: relative;
  z-index: 2;
  width: 38px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #133b75;
  font-family: Arial, sans-serif;
  font-size: 21px;
  line-height: 1;
  opacity: 0.84;
}

.hicasa-shop-gallery__arrow:hover,
.hicasa-shop-gallery__arrow:focus-visible {
  background: transparent;
  color: #0a4fa4;
  opacity: 1;
}

.hicasa-shop-gallery__arrow--previous {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.hicasa-shop-gallery__arrow--next {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}

.hicasa-shop-gallery__stage.is-single-image {
  grid-template-columns: minmax(0, 1fr);
}

.hicasa-shop-gallery__stage.is-single-image .hicasa-shop-gallery__figure {
  grid-column: 1;
}

.hicasa-shop-gallery__thumbnails {
  display: flex;
  gap: 8px;
  min-height: 86px;
  padding: 10px 14px;
  overflow-x: auto;
  border-top: 1px solid #d8dee8;
  background: #ffffff;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.hicasa-shop-gallery__thumbnail {
  flex: 0 0 66px;
  width: 66px;
  height: 66px;
  padding: 3px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 4px;
  background: #edf1f5;
}

.hicasa-shop-gallery__thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hicasa-shop-gallery__thumbnail:hover {
  border-color: #8ba7cb;
}

.hicasa-shop-gallery__thumbnail.is-selected,
.hicasa-shop-gallery__thumbnail:focus-visible {
  border-color: #1f63c5;
  outline: none;
}

.hicasa-shop-gallery__status {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.hicasa-shop-gallery button:focus-visible {
  outline: 3px solid rgba(31, 99, 197, 0.34);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .hicasa-shop-gallery {
    padding: 12px;
  }

  .hicasa-shop-gallery__dialog {
    width: 100%;
    max-width: 430px;
    height: auto;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    grid-template-rows: min(52vh, calc(100vw - 32px)) auto auto;
    grid-template-rows: min(52dvh, calc(100vw - 32px)) auto auto;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  }

  .hicasa-shop-gallery__details {
    grid-template-columns: minmax(0, 1fr);
    min-height: 50px;
    padding: 8px 11px 9px;
  }

  .hicasa-shop-gallery__title {
    gap: 7px;
    font-size: 14px;
  }

  .hicasa-shop-gallery__title-sku {
    font-size: 13px;
  }

  .hicasa-shop-gallery__close {
    top: 4px;
    right: 4px;
    width: 44px;
    height: 44px;
    font-size: 25px;
  }

  .hicasa-shop-gallery__stage {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    padding: 8px 4px;
  }

  .hicasa-shop-gallery__stage.is-single-image {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 8px;
  }

  .hicasa-shop-gallery__arrow {
    width: 30px;
    height: 44px;
    font-size: 19px;
  }

  .hicasa-shop-gallery__thumbnails {
    min-height: 76px;
    padding: 8px;
  }

  .hicasa-shop-gallery__thumbnail {
    flex-basis: 58px;
    width: 58px;
    height: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hicasa-shop-gallery *,
  .hicasa-shop-gallery *::before,
  .hicasa-shop-gallery *::after {
    scroll-behavior: auto !important;
  }
}
