/* ══════════════════════════════════════════════
   register.css — Реєстр сертифікатів
══════════════════════════════════════════════ */

.reg-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ── Секція пошуку ── */
.reg-search-section {
  padding: 72px 0 80px;
}

.reg-search-box {
  background: #EEF6F5;
  border: 1px solid #e2eeee;
  border-radius: 16px;
  padding: 36px 40px;
  margin-bottom: 40px;
}

.reg-search-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #124651;
  margin: 0 0 14px;
}

/* ── Рядок вводу: [select серія] [№] [input номер] [кнопка] ── */
.reg-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Select серії */
.reg-series-select {
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #124651;
  background: #fff;
  border: 2px solid #d8e8e8;
  border-radius: 10px;
  padding: 13px 14px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  /* Мінімальна ширина — але розтягується під вміст */
  min-width: 80px;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23124651' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 34px;
}
.reg-series-select:focus {
  border-color: #1a7a7a;
  box-shadow: 0 0 0 3px rgba(26,122,122,0.1);
}
.reg-series-select--shake,
.reg-input--shake {
  animation: regShake 0.35s ease;
  border-color: #c0392b !important;
}

/* Знак № між полями */
.reg-search-sep {
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #7aa0a0;
  flex-shrink: 0;
  user-select: none;
  line-height: 1;
}

/* Input номера */
.reg-input {
  flex: 1;
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #1a1a2e;
  background: #fff;
  border: 2px solid #d8e8e8;
  border-radius: 10px;
  padding: 13px 18px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  letter-spacing: 0.5px;
  min-width: 0;
}
.reg-input:focus {
  border-color: #1a7a7a;
  box-shadow: 0 0 0 3px rgba(26,122,122,0.1);
}

@keyframes regShake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}

.reg-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 13px 28px;
  background: #1a7a7a;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.reg-btn:hover  { background: #145f5f; transform: translateY(-1px); }
.reg-btn:active { transform: translateY(0); }
.reg-btn svg { width: 18px; height: 18px; }

.reg-search-hint {
  font-family: 'Montserrat', sans-serif;
  font-size: 11.5px;
  color: #8aadad;
  margin: 12px 0 0;
}

/* ── Стани результату ── */
.reg-result {
  animation: regFadeIn 0.3s ease;
}
@keyframes regFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.reg-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 32px;
  background: #f4f8f8;
  border: 1px solid #e2eeee;
  border-radius: 16px;
  gap: 14px;
}

.reg-state--loading {
  gap: 16px;
}
.reg-state--loading p {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  color: #6a8a8d;
  margin: 0;
}

.reg-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2eeee;
  border-top-color: #1a7a7a;
  border-radius: 50%;
  animation: regSpin 0.7s linear infinite;
}
@keyframes regSpin {
  to { transform: rotate(360deg); }
}

/* Не знайдено */
.reg-state--notfound { gap: 12px; }
.reg-state-icon { font-size: 52px; line-height: 1; }
.reg-state--notfound h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #124651;
  margin: 0;
}
.reg-state--notfound p {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  color: #6a8a8d;
  line-height: 1.65;
  margin: 0;
  max-width: 440px;
}
.reg-contact-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 11px 28px;
  background: #124651;
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.2s;
}
.reg-contact-btn:hover { background: #1a7a7a; }

/* ── Знайдений сертифікат ── */
.reg-state--found {
  align-items: stretch;
  text-align: left;
  padding: 0;
  background: none;
  border: none;
  gap: 24px;
}

/* Шапка */
.reg-cert-header {
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 28px 32px;
  background: #f4f8f8;
  border: 1px solid #e2eeee;
  border-radius: 14px;
}
.reg-cert-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #7aa0a0;
  margin: 0 0 6px;
}
.reg-cert-number {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 900;
  color: #124651;
  margin: 0;
  letter-spacing: 0.5px;
}

/* Бейджі статусу */
.reg-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 30px;
}
.reg-badge--valid {
  background: rgba(42,100,88,0.12);
  color: #2d6b5e;
}
.reg-badge--valid::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2d6b5e;
  flex-shrink: 0;
}
.reg-badge--expired {
  background: rgba(192,57,43,0.1);
  color: #c0392b;
}
.reg-badge--expired::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c0392b;
  flex-shrink: 0;
}

/* Деталі */
.reg-cert-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.reg-cert-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #e2eeee;
  border-radius: 10px;
}
.reg-cert-detail-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #7aa0a0;
}
.reg-cert-detail-value {
  font-family: 'Montserrat', sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  color: #124651;
}

/* ── Превью PDF ── */
.reg-cert-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.reg-preview-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #7aa0a0;
  margin-top: 15px;
}

.reg-cert-preview {
  position: relative;
  background: #e8e8e8;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #d0d0d0;
  line-height: 0;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reg-cert-preview canvas {
  width: 100%;
  height: auto;
  display: block;
}

/* Оверлей "Не дійсний" */
.reg-expired-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.reg-expired-overlay span {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(28px, 6vw, 56px);
  font-weight: 900;
  color: rgba(255,255,255,0.92);
  letter-spacing: 4px;
  text-transform: uppercase;
  padding: 10px 28px;
  border-radius: 6px;
  transform: rotate(-15deg);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

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

.reg-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  padding: 12px 24px;
  background: #124651;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
  align-self: flex-start;
}
.reg-download-btn:hover { background: #1a7a7a; transform: translateY(-1px); }
.reg-download-btn svg  { width: 16px; height: 16px; }

/* ── Адаптив ── */
@media (max-width: 600px) {
  .reg-wrap           { padding: 0 16px; }
  .reg-search-box     { padding: 24px 20px; }
  .reg-search-row     { flex-wrap: wrap; }
  .reg-series-select  { flex: 1 1 auto; }
  .reg-search-sep     { order: 2; }
  .reg-input          { flex: 1 1 120px; order: 3; }
  .reg-btn            { order: 4; width: 100%; justify-content: center; }
  .reg-cert-details   { grid-template-columns: 1fr; }
  .reg-cert-header    { flex-direction: column; }
  .reg-search-section { padding: 48px 0 64px; }
}

/* ── Картки результатів (expand/collapse) ── */
.reg-cert-card {
  border: 1px solid #e2eeee;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 12px;
  background: #EEF6F5;
}
.reg-cert-card__header {
  cursor: default;
  margin-bottom: 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
  background: #EEF6F5;
}
.reg-cert-card--open .reg-cert-card__header {
  border-bottom-color: #e2eeee;
  border-radius: 0;
}
.reg-cert-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.reg-cert-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: #e2eeee;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.25s;
}
.reg-cert-toggle svg {
  width: 18px;
  height: 18px;
  stroke: #124651;
  transition: transform 0.25s;
}
.reg-cert-card--open .reg-cert-toggle svg {
  transform: rotate(180deg);
}
.reg-cert-toggle:hover { background: #cce0e0; }

.reg-cert-card__body {
  padding: 20px 32px 28px;
}
.reg-cert-card__body .reg-cert-details {
  margin-bottom: 0;
}

/* Підказка «знайдено N сертифікатів» */
.reg-results-hint {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #7aa0a0;
  margin: 0 0 16px;
}

@media (max-width: 600px) {
  .reg-cert-card__body { padding: 16px 16px 24px; }
}