/* =========================
   Модальные окна
========================= */
.certificate-modal,
.review-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.85);
}

.certificate-modal.active,
.review-modal.active {
  display: flex;
}

/* =========================
   Контент модалки
========================= */
.certificate-modal .modal-content,
.review-modal .modal-content {
  position: relative;
  z-index: 10000;
  max-width: 90%;
  max-height: 85%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 16px;
}

/* На планшете и десктопе - контейнер для позиционирования стрелок */
@media (min-width: 790px) {
  .certificate-modal .modal-content,
  .review-modal .modal-content {
    margin: 24px 120px; /* добавлен отступ от краёв экрана для стрелок */
    max-height: 80%;
    max-width: calc(100% - 240px);
  }
}

@media (min-width: 1000px) {
  .certificate-modal .modal-content,
  .review-modal .modal-content {
    margin: 32px 160px; /* чуть больше отступ на десктопе */
    max-height: 80%;
    max-width: calc(100% - 320px);
  }
}

/* =========================
   Картинки
========================= */
.certificate-modal .modal-image,
.review-modal .modal-image {
  width: 100%;
  height: auto;
  max-height: calc(100% - 70px);
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  border: none;
  margin-bottom: 16px;
  display: block;
  position: relative;
  z-index: 1;
}

/* На планшете и десктопе - картинка занимает всю высоту */
@media (min-width: 790px) {
  .certificate-modal .modal-image,
  .review-modal .modal-image {
    max-height: 100%;
    margin-bottom: 0;
  }
}

@media (min-width: 1000px) {
  .certificate-modal .modal-image,
  .review-modal .modal-image {
    max-height: 100%;
    margin-bottom: 0;
  }
}

/* =========================
   Кнопка закрытия
========================= */
.modal-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  background-color: #769758;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10002;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  padding: 0;
}

.modal-close:hover {
  background-color: #5e7a47;
  transform: scale(1.1);
}

.modal-close:active {
  transform: scale(0.95);
}

@media (min-width: 790px) {
  .modal-close {
    top: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    font-size: 36px;
  }
}

@media (min-width: 1000px) {
  .modal-close {
    top: 32px;
    right: 32px;
    width: 64px;
    height: 64px;
    font-size: 40px;
  }
}

/* =========================
   Контейнер кнопок навигации
========================= */
.nav-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 12px 0 0;
  z-index: 10001;
  position: relative;
}

/* На планшете и десктопе - стрелки по бокам, не перекрывают картинку */
@media (min-width: 790px) {
  .nav-wrapper {
    position: absolute;
    top: 50%;
    left: -100px;   /* стрелка будет немного сбоку от картинки */
    right: -100px;  /* и справа тоже */
    transform: translateY(-50%);
    justify-content: space-between;
    padding: 0;
    gap: 0;
    pointer-events: none;
  }
}

@media (min-width: 1000px) {
  .nav-wrapper {
    left: -140px;
    right: -140px;
  }
}

/* =========================
   Кнопки навигации
========================= */
.modal-nav-button {
  width: 50px;
  height: 50px;
  font-size: 24px;
  border-radius: 50%;
  background-color: #769758;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: background-color 0.3s ease, transform 0.2s ease;
  flex-shrink: 0;
  pointer-events: auto;
  z-index: 2;
}

.modal-nav-button:hover {
  background-color: #5e7a47;
  transform: scale(1.1);
}

.modal-nav-button:active {
  transform: scale(0.95);
}

@media (min-width: 790px) {
  .modal-nav-button {
    width: 60px;
    height: 60px;
    font-size: 28px;
  }

  .modal-nav-button:hover {
    transform: scale(1.15);
  }
}

@media (min-width: 1000px) {
  .modal-nav-button {
    width: 70px;
    height: 70px;
    font-size: 32px;
  }
}
