/* CR-80 jewellery certificate design (85 × 54 mm, Evolis Primacy) */

.cert-design-page {
  --cert-ink: #1a1a1a;
  --cert-paper: #ffffff;
  --cert-stage: linear-gradient(165deg, #2f2a26 0%, #171513 55%, #24201c 100%);
}

.cert-heading-row { align-items: flex-end; gap: 18px; }
.cert-heading-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.cert-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 0 0 12px;
  padding: 4px;
  border-radius: 8px;
  background: #efefef;
}
.cert-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: #555;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}
.cert-tab.active {
  background: #1c1c1c;
  color: #fff;
}

.cert-studio {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.85fr);
  gap: 18px;
  align-items: start;
  margin-top: 6px;
}

.cert-preview-stage {
  position: relative;
  min-height: min(56vh, 460px);
  padding: 22px 24px 20px;
  border-radius: 10px;
  color: #ececec;
  background: var(--cert-stage);
  overflow: hidden;
}

.cert-preview-stage::before {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  border: 1px solid #ffffff12;
  box-shadow: 0 0 0 48px #ffffff06;
  pointer-events: none;
}

.preview-stage-meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}
.preview-stage-meta .eyebrow { color: #c4b8a8; margin: 0; }
.preview-size-chip {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #e8dfd4;
  border: 1px solid #ffffff22;
  padding: 5px 9px;
  border-radius: 4px;
}

.cert-viewport {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 28px 12px 24px;
}

.cert-preview-host {
  transform: scale(2.05);
  transform-origin: center center;
  filter: drop-shadow(0 14px 22px #00000055);
}

.preview-hint {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: #cfc5b8;
}

/* Shared CR-80 geometry (preview mirrors print CSS) */
.cr80-card {
  position: relative;
  width: 85mm;
  height: 54mm;
  overflow: hidden;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--cert-ink);
  background: var(--cert-paper);
  box-sizing: border-box;
}

.cr80-front {
  display: grid;
  grid-template-columns: 34mm 1fr;
  height: 100%;
}
.cr80-front.photo-right { grid-template-columns: 1fr 34mm; }
.cr80-front.photo-right .cr80-photo { order: 2; }
.cr80-front.photo-right .cr80-details {
  order: 1;
  border-right: 0;
  border-left: 0.2mm solid #e2e2e2;
}

.cr80-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #f4f4f4 0%, #ebebeb 100%);
  border-right: 0.2mm solid #e2e2e2;
  overflow: hidden;
  padding: 2mm;
}
.cr80-photo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.cr80-photo-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #9a9a9a;
  font-size: 5.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 700;
  text-align: center;
  padding: 2mm;
}

.cr80-details {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3mm 3.2mm;
  min-width: 0;
  overflow: hidden;
}
.cr80-brand {
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr80-title {
  margin-top: 1.2mm;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #555;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr80-name {
  margin-top: 2mm;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr80-rows {
  margin-top: 2mm;
  display: flex;
  flex-direction: column;
  gap: 0.9mm;
  min-height: 0;
  overflow: hidden;
}
.cr80-row {
  display: grid;
  grid-template-columns: 14mm 1fr;
  gap: 1mm;
  align-items: baseline;
  min-width: 0;
}
.cr80-row-label {
  font-weight: 700;
  color: #777;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr80-row-value {
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.cr80-code {
  margin-top: auto;
  padding-top: 1.5mm;
  border-top: 0.2mm solid #ddd;
  font-weight: 800;
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cr80-back {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  padding: 5mm 6mm;
  background: linear-gradient(165deg, #faf8f5 0%, #f3efe8 55%, #ebe6dc 100%);
}
.cr80-back.bg-white { background: #fff; }
.cr80-back.bg-charcoal {
  background: linear-gradient(165deg, #2a2a2a 0%, #161616 100%);
  color: #f5f5f5;
}
.cr80-back.bg-charcoal .cr80-back-tagline,
.cr80-back.bg-charcoal .cr80-back-contact,
.cr80-back.bg-charcoal .cr80-back-footer { color: #d0d0d0; }
.cr80-back-logo {
  width: 18mm;
  height: auto;
  margin-bottom: 2.2mm;
  display: block;
}
.cr80-back-brand {
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  line-height: 1.05;
}
.cr80-back-tagline {
  margin-top: 1.6mm;
  font-weight: 600;
  letter-spacing: .04em;
  color: #666;
  line-height: 1.2;
}
.cr80-back-contact {
  margin-top: 3.2mm;
  display: flex;
  flex-direction: column;
  gap: 0.7mm;
  font-weight: 600;
  color: #555;
  line-height: 1.25;
  max-width: 100%;
}
.cr80-back-contact span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr80-back-footer {
  margin-top: 3.5mm;
  max-width: 68mm;
  font-weight: 550;
  color: #888;
  line-height: 1.25;
}

.cert-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.control-block {
  background: #fff;
  border: 1px solid #e4e4e4;
  border-radius: 10px;
  padding: 14px 16px 16px;
}
.control-block h2 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.control-block .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
  color: #656565;
  font-size: 9px;
  font-weight: 700;
}
.control-block .field input,
.control-block .field select,
.control-block .field textarea {
  height: 36px;
  padding: 0 10px;
  border: 1px solid #e2e2e2;
  border-radius: 4px;
  background: #fff;
  color: #1a1a1a;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
}
.control-block .field textarea {
  height: auto;
  min-height: 64px;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.4;
}
.control-block .field input[type="color"] {
  padding: 4px;
  cursor: pointer;
}
.control-block .field input:focus,
.control-block .field select:focus,
.control-block .field textarea:focus {
  outline: 0;
  border-color: #8a8a8a;
  box-shadow: 0 0 0 2px #8a8a8a16;
}
.control-note {
  margin: 0 0 10px;
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}
.brand-text-field { margin-top: 4px; }
.cert-settings-card .cert-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 21px 18px;
}
.field-toggles {
  display: grid;
  gap: 7px;
}
.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #333;
}
.font-grid,
.size-inputs,
.cert-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.product-results {
  margin-top: 8px;
  max-height: 180px;
  overflow: auto;
  border: 1px solid #ebebeb;
  border-radius: 8px;
  background: #fafafa;
}
.product-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid #eee;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.product-result:last-child { border-bottom: 0; }
.product-result:hover,
.product-result.active { background: #f0f0f0; }
.product-result strong { font-size: 13px; }
.product-result span { font-size: 12px; color: #666; }
.product-results-empty {
  margin: 0;
  padding: 12px;
  font-size: 12px;
  color: #777;
}
.selected-product-summary {
  margin: 8px 0 0;
  font-size: 12px;
  color: #555;
  line-height: 1.35;
}

.cert-panel[hidden] { display: none !important; }

@media (max-width: 980px) {
  .cert-studio { grid-template-columns: 1fr; }
  .cert-preview-host { transform: scale(1.55); }
}
@media (max-width: 560px) {
  .cert-preview-host { transform: scale(1.2); }
  .font-grid, .cert-grid-2 { grid-template-columns: 1fr; }
}

@media print {
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }
  body > *:not(#vowCertPrintFrame) {
    display: none !important;
    visibility: hidden !important;
  }
  #vowCertPrintFrame {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    opacity: 1 !important;
  }
}
