/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --green-900: #1b4332;
  --green-700: #2d6a4f;
  --green-500: #40916c;
  --green-200: #95d5b2;
  --gold:      #c9a227;
  --gold-light:#f0d060;
  --parchment: #fffdf3;
  --border-gold: #b8860b;
}

/* ── Bootstrap overrides ────────────────────────────────────────────────────── */
.btn-primary       { background-color: var(--green-700) !important; border-color: var(--green-700) !important; }
.btn-primary:hover { background-color: var(--green-900) !important; border-color: var(--green-900) !important; }
.btn-outline-primary { color: var(--green-700) !important; border-color: var(--green-700) !important; }
.btn-outline-primary:hover { background-color: var(--green-700) !important; color: #fff !important; }
.text-primary  { color: var(--green-700) !important; }
.border-primary { border-color: var(--green-700) !important; }
.bg-primary    { background-color: var(--green-700) !important; }

/* ── Navbar ─────────────────────────────────────────────────────────────────── */
.nplr-navbar {
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.nplr-navbar .nav-link { transition: color .15s; }
.nplr-navbar .nav-link:hover { color: var(--green-200) !important; }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.nplr-footer {
  background: linear-gradient(135deg, var(--green-900), #111);
}

/* ── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 55%, var(--green-500) 100%);
  min-height: 420px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-seal-circle {
  width: 180px; height: 180px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.1);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: #fff; text-align: center;
  backdrop-filter: blur(4px);
  box-shadow: 0 0 0 8px rgba(255,255,255,.08);
}
.hero-seal-circle .seal-icon { font-size: 3.5rem; line-height: 1; }
.hero-seal-circle .seal-text { font-size: .7rem; letter-spacing: .15em; text-transform: uppercase; opacity: .85; margin-top: .25rem; }

/* ── Species List ────────────────────────────────────────────────────────────── */
.species-list-group {
  border: 1px solid #c8ddd4;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0;
}
.species-group-header {
  background: var(--green-900);
  color: rgba(255,255,255,.9);
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  padding: 6px 14px;
}
.species-row {
  display: flex;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid #e4ede9;
  cursor: pointer;
  transition: background .12s;
}
.species-row:last-child { border-bottom: none; }
.species-row:hover { background: #f0faf4; }
.species-icon-wrap {
  width: 64px;
  height: 50px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 13px;
}
.species-icon-wrap svg { width: 60px; height: 46px; overflow: visible; }
.species-info { flex: 1; min-width: 0; }
.species-name { font-weight: 700; font-size: .92rem; color: #1a1a1a; }
.species-fee-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  color: var(--green-700);
  background: #e0f2e9;
  border: 1px solid #a8d5be;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 7px;
  vertical-align: middle;
  white-space: nowrap;
}
.species-desc {
  font-size: .76rem;
  color: #6c757d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.species-breed-count {
  font-size: .7rem;
  color: #aaa;
  margin-left: 5px;
}
.species-reg-btn { flex-shrink: 0; margin-left: 10px; }

/* ── Steps ──────────────────────────────────────────────────────────────────── */
.step-num {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--green-700);
  color: #fff;
  font-size: 1.4rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: .75rem;
}
.step-num.done { background: #198754; }

/* ── Pedigree sire/dam cards ────────────────────────────────────────────────── */
.ped-card { border: 1px solid #d0e8d8; background: #f9fdf9; }
.ped-card .card-header { background: rgba(45,106,79,.07); }

/* ── Certificate ────────────────────────────────────────────────────────────── */
.certificate {
  max-width: 960px;
  margin: 0 auto;
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--parchment);
}

.cert-outer {
  border: 10px double var(--border-gold);
  padding: 6px;
  background: var(--parchment);
}

.cert-inner {
  border: 2px solid var(--border-gold);
  padding: 32px 36px;
}

/* Header */
.cert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--border-gold);
  padding-bottom: 20px;
  margin-bottom: 22px;
}

.cert-seal {
  flex-shrink: 0;
  width: 108px; height: 108px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: radial-gradient(circle, #fffef0 40%, #f5e8a0 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  box-shadow: 0 0 0 2px var(--gold), 0 0 0 5px var(--parchment), 0 0 0 7px var(--gold);
}
.seal-top, .seal-bot {
  font-size: 6.5px; font-weight: 800; letter-spacing: 1.2px;
  text-transform: uppercase; color: #5a3700; font-family: sans-serif;
}
.seal-mid { font-size: 2rem; margin: 1px 0; }

.cert-title-area { text-align: center; flex: 1; padding: 0 24px; }
.cert-org       { font-size: 1.2rem; font-weight: 800; color: var(--green-900); text-transform: uppercase; letter-spacing: 2.5px; }
.cert-doc-title { font-size: 2rem; color: var(--border-gold); font-style: italic; margin: 6px 0; }
.cert-reg-badge {
  display: inline-block;
  background: var(--green-900); color: #fff;
  padding: 3px 18px; border-radius: 4px;
  font-family: 'Courier New', monospace; font-size: .95rem; font-weight: 700;
  letter-spacing: 1px;
}

/* Body */
.cert-declares {
  font-style: italic; color: #555; font-size: .88rem;
  text-align: center; margin-bottom: 14px;
}

.cert-animal-name {
  font-size: 2rem; font-weight: 700; color: var(--green-900);
  text-align: center; letter-spacing: .5px;
  border-top: 2px solid var(--border-gold);
  border-bottom: 2px solid var(--border-gold);
  padding: 10px;
  margin: 0 0 18px;
}

.cert-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.cert-field {
  background: rgba(45,106,79,.05);
  border: 1px solid #d0e8d8;
  border-radius: 4px;
  padding: 7px 10px;
}
.cert-field-label {
  display: block;
  font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: #777; font-family: sans-serif; margin-bottom: 2px;
}
.cert-field-value { font-size: .95rem; font-weight: 700; color: #111; }

.cert-section-head {
  font-size: .7rem; font-weight: 800; letter-spacing: 2px;
  text-transform: uppercase; color: var(--border-gold);
  border-bottom: 1px solid var(--gold-light);
  padding-bottom: 4px; margin-bottom: 10px;
  font-family: sans-serif;
}

.cert-pedigree-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 16px;
}
.cert-ped-box {
  border: 1px solid #cde0d0; border-radius: 4px;
  padding: 10px 14px;
  background: rgba(45,106,79,.03);
}
.ped-role  { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #888; font-family: sans-serif; }
.ped-name  { font-size: 1rem; font-weight: 700; color: #111; }
.ped-reg   { font-family: 'Courier New', monospace; font-size: .82rem; color: var(--green-700); }

.cert-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.cert-party-label { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--border-gold); font-family: sans-serif; }
.cert-party-name  { font-size: 1rem; font-weight: 700; color: #111; }
.cert-party-sub   { font-size: .85rem; color: #555; }

.cert-footer-row {
  border-top: 1px solid var(--border-gold);
  padding-top: 14px;
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 10px;
}
.cert-sig { text-align: center; min-width: 200px; }
.sig-line  { border-bottom: 1px solid #555; height: 44px; margin-bottom: 4px; }
.sig-title { font-size: .75rem; font-weight: 700; font-family: sans-serif; }
.sig-org   { font-size: .65rem; color: #777; font-family: sans-serif; }

.cert-date-box { text-align: center; }
.cert-date-lbl { font-size: .65rem; text-transform: uppercase; letter-spacing: 1px; color: #888; font-family: sans-serif; }
.cert-date-val { font-size: 1.05rem; font-weight: 700; color: var(--green-700); }

.cert-verify-bar {
  text-align: center; font-size: .72rem; color: #777; font-family: sans-serif;
  background: rgba(45,106,79,.05); padding: 7px 12px; border-radius: 4px;
}

/* ── Certificate option picker ─────────────────────────────────────────────── */
.cert-option {
  cursor: pointer;
  border: 2px solid #dee2e6 !important;
  transition: border-color .15s, background .15s;
}
.cert-option:hover     { border-color: var(--green-500) !important; }
.cert-option.selected  { border-color: var(--green-700) !important; background: rgba(45,106,79,.05); }

/* ── Misc ───────────────────────────────────────────────────────────────────── */
code { background: #f1f8f4; color: var(--green-700); padding: 2px 6px; border-radius: 3px; }

/* ── Print styles ───────────────────────────────────────────────────────────── */
@media print {
  .no-print, nav.nplr-navbar, footer.nplr-footer, #toasts { display: none !important; }
  body { background: white !important; }
  main#app { padding: 0 !important; }

  @page { margin: .4in; size: letter landscape; }

  /* Force certificate onto a single page */
  .certificate {
    max-width: 100%;
    margin: 0;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .cert-outer { border: 6px double var(--border-gold) !important; padding: 4px; }
  .cert-inner { border: 2px solid var(--border-gold); padding: 14px 22px; }

  /* Header — shrink logo and tighten spacing */
  .cert-header {
    padding-bottom: 10px;
    margin-bottom: 10px;
  }
  .cert-header img[alt="ILR"] { width: 52px !important; height: 52px !important; }
  .cert-seal img              { width: 80px !important; height: 80px !important; }
  .cert-seal                  { width: 80px; height: 80px; }
  .cert-doc-title             { font-size: 1.5rem; margin: 3px 0; }

  /* Body — tighten every gap */
  .cert-declares    { margin-bottom: 6px; font-size: .82rem; }
  .cert-animal-name { font-size: 1.5rem; padding: 5px; margin: 0 0 10px; }
  .cert-details     { gap: 7px; margin-bottom: 10px; }
  .cert-field       { padding: 4px 8px; }

  .cert-section-head   { margin-bottom: 5px; padding-bottom: 2px; }
  .cert-pedigree-grid  { gap: 8px; margin-bottom: 8px; }
  .cert-ped-box        { padding: 6px 10px; }
  .cert-parties        { gap: 8px; margin-bottom: 8px; }

  /* Footer — shorten signature lines */
  .cert-footer-row { padding-top: 8px; margin-bottom: 6px; }
  .sig-line        { height: 28px; margin-bottom: 3px; }
  .cert-verify-bar { padding: 4px 10px; }
}

/* ── Responsive tweaks ──────────────────────────────────────────────────────── */
@media (max-width: 575px) {
  .cert-header    { flex-direction: column; gap: 14px; text-align: center; }
  .cert-seal      { width: 80px; height: 80px; box-shadow: none; }
  .cert-doc-title { font-size: 1.4rem; }
  .cert-animal-name { font-size: 1.4rem; }
  .cert-details   { grid-template-columns: 1fr 1fr; }
  .cert-pedigree-grid, .cert-parties { grid-template-columns: 1fr; }
  .cert-footer-row { flex-direction: column; gap: 20px; align-items: center; }
  .cert-inner     { padding: 16px; }
}
