/* ==========================================
   PANORAM DAO CHAIN — Verificador VERT
   White Institutional Premium
   Carpeta: /verify/
   ========================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e5e7eb;
  --line-strong: #d8e0ea;
  --navy: #0f172a;
  --navy-2: #1e293b;
  --blue: #2563eb;
  --green-bg: #dff6e8;
  --green-text: #0d7a43;
  --green-line: #bde8cf;
  --red-bg: #fee2e2;
  --red-text: #991b1b;
  --red-line: #fecaca;
  --pending-bg: #e2e8f0;
  --pending-text: #475569;
  --shadow-sm: 0 8px 18px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 12px 30px rgba(8, 25, 56, 0.06);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  overflow-x: hidden;
}

/* HEADER */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  background: var(--navy);
  color: white;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand img {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.brand-text {
  min-width: 0;
}

.brand-title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
}

.brand-sub {
  font-size: 12px;
  opacity: 0.7;
  line-height: 1.2;
}

/* BADGES */

.badge {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge.ok {
  background: var(--green-bg);
  color: var(--green-text);
  border: 1px solid var(--green-line);
}

.badge.error {
  background: var(--red-bg);
  color: var(--red-text);
  border: 1px solid var(--red-line);
}

/* CONTENIDO */

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 16px 40px;
}

h1 {
  font-size: 28px;
  margin-bottom: 6px;
  line-height: 1.2;
  color: var(--navy);
}

.subtitle {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: 15px;
}

/* TARJETAS */

.card,
.search-box,
.certificate {
  width: 100%;
  overflow: hidden;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
}

/* BUSCADOR */

.search-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.search-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

.search-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-row input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: #fff;
}

.search-row input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-row button {
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.search-row button:hover {
  background: var(--navy-2);
}

.search-help {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* FILAS */

.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.row:last-child {
  border-bottom: none;
}

.label {
  font-weight: 700;
  color: #334155;
  min-width: 140px;
  flex-shrink: 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-align: right;
}

.value-wrap {
  flex: 1;
  min-width: 0;
  text-align: right;
  word-break: break-word;
  overflow-wrap: anywhere;
}

#vertId,
#owner,
#evidence,
#eventIdValue,
#siteValue,
#personLabelValue,
#certVertId,
#certOwner {
  word-break: break-word;
  overflow-wrap: anywhere;
}

#evidence {
  font-size: 13px;
  line-height: 1.7;
  color: #233a63;
}

#eventIdValue,
#siteValue,
#personLabelValue {
  font-size: 14px;
  color: #10284a;
}

/* STATUS */

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.status-pill.pending {
  background: var(--pending-bg);
  color: var(--pending-text);
}

.status-pill.success {
  background: var(--green-bg);
  color: var(--green-text);
  border: 1px solid var(--green-line);
}

.status-pill.error {
  background: var(--red-bg);
  color: var(--red-text);
  border: 1px solid var(--red-line);
}

/* LINKS */

.link {
  color: var(--blue);
  text-decoration: none;
  font-size: 13px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.link:hover {
  text-decoration: underline;
}

.evidence-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* QR PRINCIPAL */

.qr {
  display: flex;
  justify-content: center;
  padding: 22px 0;
  margin-top: 10px;
}

.qr img {
  display: block;
  width: 180px;
  height: 180px;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
}

/* ACCIONES */

.actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.actions button,
.actions a {
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 9px 12px;
  min-width: 180px;
  height: 44px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: 0.2s;
  text-align: center;
}

.actions button:hover,
.actions a:hover {
  background: var(--navy-2);
}

/* CERTIFICADO */

.certificate {
  margin-top: 26px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-soft) 100%);
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

.certificate-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.certificate-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 260px;
}

.certificate-brand img {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.certificate-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
}

.certificate-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.certificate-badge {
  background: var(--green-bg);
  color: var(--green-text);
  border: 1px solid var(--green-line);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.certificate-body {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-top: 18px;
  flex-wrap: wrap;
  width: 100%;
}

.certificate-grid {
  flex: 1 1 320px;
  min-width: 0;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px 18px;
  font-size: 14px;
}

.certificate-grid > div {
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.certificate-grid .mono {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.certificate-qr-wrap {
  flex: 0 1 180px;
  width: 180px;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-left: auto;
  margin-right: auto;
}

.certificate-qr-wrap img {
  display: block;
  width: 160px;
  height: 160px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.certificate-footer {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed #cbd5e1;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* NOTA */

.note {
  margin-top: 18px;
  font-size: 12px;
  color: #4c6485;
  text-align: center;
  line-height: 1.7;
}

/* FOOTER */

.footer {
  text-align: center;
  padding: 22px 16px 28px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

/* TABLET */

@media (max-width: 720px) {
  .container {
    padding: 24px 12px 32px;
  }

  h1 {
    font-size: 24px;
  }

  .card {
    padding: 18px;
  }

  .row {
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }

  .label {
    min-width: auto;
  }

  .mono,
  .value-wrap {
    text-align: left;
  }

  .evidence-links {
    justify-content: flex-start;
  }

  .certificate-body {
    flex-direction: column;
    align-items: stretch;
  }

  .certificate-grid {
    grid-template-columns: 1fr;
    gap: 6px;
    flex: 1 1 auto;
  }
  

  .certificate-qr-wrap {
    width: 100%;
    flex: 1 1 auto;
    margin-top: 8px;
    justify-content: center;
  }

  .certificate-qr-wrap img {
    width: 150px;
    height: 150px;
    margin: 0 auto;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .actions button,
  .actions a {
    width: 100%;
    min-width: 100%;
  }
}

/* MOVIL */

@media (max-width: 520px) {
  .header {
    padding: 12px 14px;
  }

  .brand-title {
    font-size: 14px;
  }

  .brand-sub {
    font-size: 11px;
  }

  .container {
    padding: 18px 10px 26px;
  }

  h1 {
    font-size: 21px;
  }

  .subtitle {
    font-size: 14px;
    margin-bottom: 18px;
  }

  .search-box {
    padding: 14px;
  }

  .search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-row button {
    width: 100%;
  }

  .card {
    padding: 16px;
    border-radius: 12px;
  }

  .qr img {
    width: 160px;
    height: 160px;
  }

  .certificate {
    padding: 16px;
  }

  .certificate-header {
    align-items: flex-start;
  }

  .certificate-title {
    font-size: 14px;
  }

  .certificate-subtitle {
    font-size: 11px;
  }

  .certificate-badge {
    font-size: 11px;
    padding: 6px 10px;
  }

  .certificate-qr-wrap img {
    width: 150px;
    height: 150px;
  }

  .actions {
    grid-template-columns: 1fr;
  }
}

/* IMPRESION */

@media print {
  body {
    background: #fff;
  }

  .header,
  .search-box,
  .actions,
  .note,
  .footer {
    display: none !important;
  }

  .container {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  .card {
    box-shadow: none;
    border: none;
    padding: 0;
  }

  .row {
    display: none;
  }

  .certificate {
    border: 1px solid #cbd5e1;
    box-shadow: none;
    margin: 0;
    page-break-inside: avoid;
  }
}

/* ===== PDF INSTITUCIONAL PREMIUM ===== */

@media print {
  @page {
    size: A4 portrait;
    margin: 14mm;
  }

  html,
  body {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  .header,
  .search-box,
  .actions,
  .note,
  .footer,
  .row,
  .qr {
    display: none !important;
  }

  .container {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .card {
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    padding: 0 !important;
  }

  .certificate {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 18px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  .certificate-header {
    padding-bottom: 12px !important;
    border-bottom: 1px solid #dbe2ea !important;
  }

  .certificate-title {
    font-size: 18px !important;
    letter-spacing: 0.02em;
  }

  .certificate-subtitle {
    font-size: 12px !important;
    color: #475569 !important;
  }

  .certificate-badge {
    background: #dff6e8 !important;
    color: #0d7a43 !important;
    border: 1px solid #bde8cf !important;
  }

  .certificate-body {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 18px !important;
    padding-top: 16px !important;
    flex-wrap: nowrap !important;
  }

  .certificate-grid {
    grid-template-columns: 150px 1fr !important;
    gap: 10px 14px !important;
    font-size: 13px !important;
    width: 100% !important;
  }

  .certificate-qr-wrap {
    width: 150px !important;
    flex: 0 0 150px !important;
    margin: 0 !important;
  }

  .certificate-qr-wrap img {
    width: 140px !important;
    height: 140px !important;
    border: 1px solid #dbe2ea !important;
    padding: 6px !important;
    background: #fff !important;
  }

  .certificate-footer {
    margin-top: 14px !important;
    padding-top: 10px !important;
    border-top: 1px dashed #cbd5e1 !important;
    font-size: 11px !important;
    color: #475569 !important;
    line-height: 1.5 !important;
  }
}

#certEventId,
#certSite,
#certPersonLabel {
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media print {
  #certEventId,
  #certSite,
  #certPersonLabel {
    color: #0f172a !important;
  }
}

.certificate-stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #bde8cf;
  background: #ecfdf3;
  color: #0d7a43;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media print {
  .certificate-stamp {
    background: #ecfdf3 !important;
    color: #0d7a43 !important;
    border: 1px solid #bde8cf !important;
  }
}

.certificate-issued-line {
  display: inline-block;
  margin-top: 8px;
  font-weight: 600;
  color: #334155;
  letter-spacing: 0.01em;
}

@media print {
  .certificate-issued-line {
    color: #334155 !important;
    font-weight: 600 !important;
  }
}

#certConstNumber {
  word-break: break-word;
  overflow-wrap: anywhere;
  color: #0f172a;
  font-weight: 700;
}

@media print {
  #certConstNumber {
    color: #0f172a !important;
    font-weight: 700 !important;
  }
}