/* ══════════════════════════════════════════════
   sv_cert_preview.css — Приклад сертифіката
   v2: мініатюра + модальне вікно
══════════════════════════════════════════════ */

/* ── Секція ── */
.cert-preview {
  padding: 72px 0 80px;
  background: #f4f8f8;
}

.cert-preview__wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 32px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ── Картка-мініатюра ── */
.cert-preview__card {
  width: 260px;               /* ← фіксована ширина мініатюри */
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  overflow: hidden;
  border: 1px solid #e2eeee;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cert-preview__card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 10px 36px rgba(0,0,0,0.16);
}

/* ── Область PDF (мініатюра) ── */
.cert-preview__pdf-wrap {
  position: relative;
  width: 100%;
  background: #e8e8e8;
  overflow: hidden;
  line-height: 0;
}

.cert-preview__canvas {
  display: none;
  width: 100%;
  height: auto;
  vertical-align: top;
}

/* Оверлей при наведенні */
.cert-preview__hover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(18, 70, 81, 0.55);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
}
.cert-preview__card:hover .cert-preview__hover-overlay {
  opacity: 1;
}
.cert-preview__hover-overlay svg {
  width: 36px;
  height: 36px;
  color: #fff;
}
.cert-preview__hover-overlay span {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

/* Завантаження */
.cert-preview__loading {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px;
}
.cert-preview__loading p {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  color: #6a8a8d;
  margin: 0;
}
.cert-preview__spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e2eeee;
  border-top-color: #1a7a7a;
  border-radius: 50%;
  animation: certSpin 0.7s linear infinite;
}
@keyframes certSpin { to { transform: rotate(360deg); } }

/* ── Підвал мініатюри ── */
.cert-preview__footer {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid #e2eeee;
  background: #f4f8f8;
  flex-wrap: wrap;
}
.cert-preview__footer-text {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #124651;
  margin: 0;
  text-align: left;
  line-height: 1.3;
}
.cert-preview__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 16px;
  background: #1a7a7a;
  color: #fff;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
}
.cert-preview__btn:hover  { background: #145f5f; transform: translateY(-1px); }
.cert-preview__btn:disabled { background: #7aadad; cursor: not-allowed; transform: none; }
.cert-preview__btn svg    { width: 14px; height: 14px; }

/* ── Порожній стан ── */
.cert-preview__empty {
  padding: 40px 24px;
  background: #fff;
  border-radius: 12px;
  border: 2px dashed #d0e0e0;
}
.cert-preview__empty p {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  color: #8aadad;
  margin: 0;
}

/* ══════════════════════════════════════════════
   MODAL LIGHTBOX
══════════════════════════════════════════════ */
.cert-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.cert-modal--open { display: flex; }

/* Фон */
.cert-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 30, 35, 0.78);
  backdrop-filter: blur(4px);
  animation: certFadeIn 0.22s ease;
}

/* Вікно — займає більшу частину екрану */
.cert-modal__content {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
  width: min(860px, 96vw);
  height: min(94vh, 94dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: certSlideUp 0.25s cubic-bezier(.22,.68,0,1.2);
}

@keyframes certFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes certSlideUp { from { opacity: 0; transform: translateY(24px) scale(.97); }
                          to   { opacity: 1; transform: none; } }

/* ── Тулбар ── */
.cert-modal__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #e2eeee;
  background: #f4f8f8;
  flex-shrink: 0;
}

.cert-modal__zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cert-modal__zoom-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #d0e0e0;
  border-radius: 7px;
  background: #fff;
  color: #124651;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  padding: 0;
}
.cert-modal__zoom-btn svg { width: 16px; height: 16px; }
.cert-modal__zoom-btn:hover:not(:disabled) {
  background: #e8f4f4;
  border-color: #1a7a7a;
  transform: scale(1.08);
}
.cert-modal__zoom-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.cert-modal__zoom-btn--fit { margin-left: 6px; }

.cert-modal__zoom-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #124651;
  min-width: 42px;
  text-align: center;
}

/* Кнопка закрити */
.cert-modal__close {
  width: 34px;
  height: 34px;
  border: 1px solid #d0e0e0;
  border-radius: 7px;
  background: #fff;
  color: #124651;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.cert-modal__close svg   { width: 16px; height: 16px; }
.cert-modal__close:hover { background: #fde8e8; border-color: #c0392b; color: #c0392b; }

/* ── Скрол-зона PDF ── */
.cert-modal__pdf-scroll {
  flex: 1;
  overflow: auto;
  background: #d8d8d8;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8px;
}

.cert-modal__canvas {
  display: none;
  /* ширина/висота задається JS через style.width/height */
  max-width: none;           /* дозволяємо збільшення */
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
  border-radius: 2px;
}

.cert-modal__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 48px;
}
.cert-modal__loading p {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  color: #6a8a8d;
  margin: 0;
}

/* Підвал модалки */
.cert-modal__footer {
  padding: 12px 18px;
  border-top: 1px solid #e2eeee;
  background: #f4f8f8;
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ── Адаптив ── */
@media (max-width: 600px) {
  .cert-preview                 { padding: 48px 0 56px; }
  .cert-preview__wrap           { padding: 0 16px; }
  .cert-preview__card           { width: 100%; max-width: 320px; }
  .cert-preview__footer         { flex-direction: column; align-items: flex-start; }
  .cert-preview__btn            { width: 100%; justify-content: center; }
  .cert-modal__footer .cert-preview__btn { width: 100%; justify-content: center; }
  .cert-modal__content          { width: 100vw; height: 100dvh; border-radius: 0; }
}