/* ============================================
   МОДАЛЬНОЕ ОКНО КАРТОЧЕК
   ============================================ */
.modal-card {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  z-index: var(--z-modal);
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.modal-card.active {
  display: flex;
}

.modal-card-content {
  position: relative;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 32px;
  max-width: 700px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  cursor: default;
  animation: modalSlideUp 0.4s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Кнопка закрытия */
.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  z-index: var(--z-default);
  box-shadow: var(--shadow-sm);
}

.modal-close-btn:hover {
  background: rgba(255, 71, 87, 0.8);
  transform: rotate(90deg);
}

/* Обёртка изображения */
.modal-card-img-wrapper {
  position: relative;
  width: 100%;
  height: 320px;
  overflow: hidden;
  border-radius: 32px 32px 0 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.modal-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f0f2f5;
  padding: 20px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.modal-card-img:hover {
  transform: scale(1.02);
}

/* Тело модального окна */
.modal-card-body {
  padding: 24px 28px 32px;
}

.modal-card-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 12px;
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.modal-card-description {
  font-size: 1rem;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Кнопки действий */
.modal-card-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.modal-card-actions .modal-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 24px;
  border-radius: 60px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: none;
}

.modal-btn-pdf {
  background: linear-gradient(135deg, #4caf50, #4caf50);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.modal-btn-video {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.modal-btn-pdf::before,
.modal-btn-video::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.6s ease;
}

.modal-card.active .modal-btn-pdf::before,
.modal-card.active .modal-btn-video::before {
  left: 100%;
}

.modal-btn-pdf:hover,
.modal-btn-video:hover {
  transform: translateY(-3px);
  filter: brightness(1.05);
}

/* Навигация по карточкам */
.modal-nav-prev,
.modal-nav-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
  z-index: calc(var(--z-modal) + 1);
}

.modal-nav-prev {
  left: 20px;
}

.modal-nav-next {
  right: 20px;
}

.modal-nav-prev:hover,
.modal-nav-next:hover {
  background: rgba(79, 70, 229, 0.8);
  transform: translateY(-50%) scale(1.1);
}

/* ============================================
   ПОЛНОЭКРАННОЕ МОДАЛЬНОЕ ОКНО ДЛЯ ИЗОБРАЖЕНИЙ
   ============================================ */
.fullscreen-image-modal {
  position: fixed;
  z-index: var(--z-max);
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  cursor: pointer;
}

.fullscreen-image-modal .fullscreen-image {
  display: block;
  max-width: 90%;
  max-height: 90%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  animation: zoomIn 0.3s ease;
}

.fullscreen-close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
  z-index: calc(var(--z-max) + 1);
}

.fullscreen-close:hover {
  color: #bbb;
  transform: scale(1.1);
}

.fullscreen-caption {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  color: white;
  font-size: 16px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.7);
  margin: 0 auto;
  width: fit-content;
  border-radius: var(--radius-sm);
}

/* Водяной знак ВЕДО.РФ */
.fullscreen-image-modal::before {
  content: "ВЕДО.РФ";
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  color: rgba(255, 255, 255, 0.15);
  font-size: clamp(30px, 8vw, 100px);
  font-family: Arial, sans-serif;
  font-weight: bold;
  white-space: nowrap;
  z-index: calc(var(--z-max) + 2);
  pointer-events: none;
  letter-spacing: clamp(5px, 2vw, 15px);
  text-transform: uppercase;
}

/* ============================================
   МОБИЛЬНАЯ ВЕРСИЯ МОДАЛЬНЫХ ОКОН
   ============================================ */
@media (max-width: 768px) {
  .modal-card-content {
    width: 95%;
    max-height: 90vh;
    border-radius: 24px;
  }

  .modal-card-img-wrapper {
    height: 250px;
  }

  .modal-card-body {
    padding: 20px;
  }

  .modal-card-title {
    font-size: 1.4rem;
  }

  .modal-card-description {
    font-size: 0.9rem;
  }

  .modal-card-actions {
    flex-direction: column;
    gap: 12px;
  }

  .modal-card-actions .modal-btn {
    padding: 12px 20px;
    font-size: 0.9rem;
  }

  .modal-close-btn {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
  }

  .modal-nav-prev,
  .modal-nav-next {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }

  .modal-nav-prev {
    left: 10px;
  }

  .modal-nav-next {
    right: 10px;
  }
}

@media (max-width: 480px) {
  .modal-card-img-wrapper {
    height: 200px;
  }

  .modal-card-body {
    padding: 16px;
  }

  .modal-card-title {
    font-size: 1.2rem;
  }
}
