/*
 * docs-custom.css
 * Styling for the two components that had to become dynamic instead of the
 * original fixed absolutely-positioned markup: the document list (.doclist) and the
 * page-by-page document viewer (.docgallery). Colors/radii/font are taken
 * directly from the original site's own design (teal #00add3 / #17b7df accents,
 * #f4f4f4 row background, Geologica font, 12px rounded corners) so the section
 * reads as part of the same design even though the markup underneath is new.
 */

.doclist {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  /* same horizontal insets / max-width as the "Часто задаваемые вопросы" block */
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 20px;
  font-family: 'Geologica', Arial, sans-serif;
  box-sizing: border-box;
}

.doclist__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background-color: #f4f4f4;
  border-radius: 12px;
  padding: 16px 20px;
  text-decoration: none;
  color: inherit;
  transition: background-color .2s ease-in-out;
  box-sizing: border-box;
}

a.doclist__row_link {
  cursor: pointer;
}

a.doclist__row_link:hover {
  background-color: #ececec;
}

.doclist__row_plain {
  opacity: .6;
  cursor: default;
}

.doclist__text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  min-width: 0;
}

.doclist__title {
  font-size: 16px;
  font-weight: 500;
  color: #1a1a1a;
}

.doclist__date {
  font-size: 14px;
  font-weight: 400;
  color: #8a8a8a;
  white-space: nowrap;
}

.doclist__arrow {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background-color: #00add3;
  background-image: url(/assets/img/weui_arrow-outlined.svg);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
}

.doclist__empty {
  padding: 20px;
  color: #8a8a8a;
  font-size: 15px;
}

@media screen and (max-width: 639px) {
  .doclist__row {
    padding: 14px 16px;
  }
  .doclist__title {
    font-size: 15px;
  }
}

/* ---------- document viewer popup ---------- */

/* The builder's popup CSS sets `.pmg .w-popup__container{pointer-events:none}`
   and re-enables it only on the zero-block content it moves in. Our gallery is
   appended straight into that container, so without this it inherits
   `pointer-events:none` and every click (arrows, thumbnails) falls through to the
   backdrop and just closes the popup. Re-enable it for our subtree. */
.w-popup__container .docgallery,
.w-popup__container .docgallery *,
.docgallery-popup__container,
.docgallery-popup__container *,
.docgallery-popup__close,
.docgallery-popup__close * {
  pointer-events: auto;
}

/* The 3 built-in doc popups append the gallery straight into the framework's
   `.w-popup__container`, which is full-bleed — so the viewer stretched to the
   screen edges. Give that gallery the same contained white card as the
   admin-added ones (`.docgallery-popup__container`). */
.docgallery-popup__container,
.w-popup__container > .docgallery {
  background: #fff;
  border-radius: 16px;
  max-width: 760px;
  width: calc(100% - 32px);
  margin: 0 auto;
  padding: 32px;
  box-sizing: border-box;
}

.docgallery-popup__close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
}

.docgallery-popup__close .w-popup__close {
  position: static;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: #f4f4f4;
}

.docgallery-popup__close .w-popup__close::before,
.docgallery-popup__close .w-popup__close::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 2px;
  background-color: #1a1a1a;
  border-radius: 1px;
}

.docgallery-popup__close .w-popup__close::before { transform: rotate(45deg); }
.docgallery-popup__close .w-popup__close::after { transform: rotate(-45deg); }

.docgallery {
  font-family: 'Geologica', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.docgallery__header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 32px;
}

.docgallery__title {
  font-size: 20px;
  font-weight: 600;
  color: #1a1a1a;
}

.docgallery__date {
  font-size: 14px;
  color: #8a8a8a;
}

.docgallery__main {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f4f4f4;
  border-radius: 12px;
  min-height: 320px;
  padding: 12px;
  box-sizing: border-box;
}

.docgallery__img {
  max-width: 100%;
  max-height: 60vh;
  display: block;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}

.docgallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background-color: #00add3;
  background-image: url(/assets/img/weui_arrow-outlined.svg);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
  cursor: pointer;
  z-index: 1;
}

.docgallery__nav_prev {
  left: 8px;
  transform: translateY(-50%) rotate(180deg);
}

.docgallery__nav_next {
  right: 8px;
}

.docgallery__counter {
  text-align: center;
  font-size: 13px;
  color: #8a8a8a;
}

.docgallery__thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.docgallery__thumb {
  flex-shrink: 0;
  width: 48px;
  height: 64px;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  background: #f4f4f4;
}

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

.docgallery__thumb_active {
  border-color: #00add3;
}

.docgallery__empty {
  display: none;
  padding: 40px 0;
  text-align: center;
  color: #8a8a8a;
  font-size: 15px;
}

.docgallery_empty .docgallery__main,
.docgallery_empty .docgallery__thumbs,
.docgallery_empty .docgallery__counter {
  display: none;
}

@media screen and (max-width: 639px) {
  .docgallery-popup__container,
  .w-popup__container > .docgallery {
    padding: 20px;
    width: calc(100% - 24px);
  }
  .docgallery__title {
    font-size: 17px;
  }
  .docgallery__main {
    min-height: 220px;
  }
  .docgallery__nav {
    width: 34px;
    height: 34px;
  }
}
