/* ===================================================
   Manila S.A. — Template-Specific Styles
   =================================================== */

/* ─── Template selector (sidebar) ─── */
.template-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.template-option {
  cursor: pointer;
  display: flex;
}
.template-option input { display: none; }
.template-chip {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  transition: all 0.15s;
}
.template-option input:checked + .template-chip {
  background: var(--carbon);
  color: #fff;
  border-color: var(--carbon);
}

/* Detail level switcher (sidebar) */
.detail-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
}
.detail-option {
  cursor: pointer;
  display: flex;
}
.detail-option input { display: none; }
.detail-option input:checked + .template-chip {
  background: var(--carbon);
  color: #fff;
  border-color: var(--carbon);
}

/* Brief specs — shared across templates */
.brief-spec-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.brief-spec-label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
}
.brief-spec-value {
  font-size: 10px;
  font-weight: 500;
}
.tpl-dark .brief-spec-label {
  color: rgba(255,255,255,0.45);
}
.tpl-dark .brief-spec-value {
  color: #e0e4ea;
}

/* Brief sections for Classic + Corporate */
.brief-specs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 10px;
}
.brief-certs-row {
  margin-bottom: 8px;
}

/* Logo toggles (sidebar) */
.logo-toggles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.logo-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
}
.logo-toggle input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}


/* ═══════════════════════════════════════════════════
   TEMPLATE: DARK — Floating product on dark
   ═══════════════════════════════════════════════════ */

.sheet.tpl-dark {
  background: #1a2332;
}

.tpl-dark .sheet-content {
  padding: 14mm 12mm 6mm;
  color: #e0e4ea;
}

/* ─── Logos — prominent, spaced ─── */
.tpl-dark-logos {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.tpl-dark-brand-logo {
  max-height: 70px;
  width: auto;
}
.tpl-dark-manila-logo {
  height: 50px;
  width: auto;
  opacity: 0.85;
}

/* ─── Product image — floating, no frame ─── */
.tpl-dark-product-area {
  position: relative;
  width: 100%;
  height: 100mm;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
  flex-shrink: 0;
}
.tpl-dark-product-area.dragging { cursor: grabbing; }

.tpl-dark-product-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,0.4));
}

.tpl-dark-product-area .hero-controls {
  display: flex;
}

/* ─── Title — centered ─── */
.tpl-dark-title {
  text-align: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.tpl-dark .product-name {
  color: #ffffff;
  font-size: 26px;
}
.tpl-dark .product-subtitle {
  color: rgba(255,255,255,0.55);
}

/* ─── Specs 2-col ─── */
.tpl-dark-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.tpl-dark .spec-heading {
  color: #90b8f8;
  border-bottom-color: rgba(255,255,255,0.12);
}
.tpl-dark .spec-table tr {
  border-bottom-color: rgba(255,255,255,0.06);
}
.tpl-dark .spec-label {
  color: rgba(255,255,255,0.45);
}
.tpl-dark .spec-table td:last-child {
  color: #e0e4ea;
}
.tpl-dark .size-lbs {
  color: rgba(255,255,255,0.35);
}

/* ─── Certs + Nutrition ─── */
.tpl-dark-certs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.tpl-dark .cert-item {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
}
.tpl-dark .cert-text-badge {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.tpl-dark .nutrition-table {
  color: #e0e4ea;
}
.tpl-dark .nutrition-table tr {
  border-bottom-color: rgba(255,255,255,0.06);
}
.tpl-dark .nt-header td {
  border-bottom-color: rgba(255,255,255,0.25);
  color: #e0e4ea;
}
.tpl-dark .nt-indent {
  color: rgba(255,255,255,0.4) !important;
}

/* ─── Brief specs (Dark) ─── */
.tpl-dark-brief-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: center;
  margin-bottom: 10px;
}
.tpl-dark-brief-certs {
  margin-bottom: 8px;
}
.tpl-dark-brief-certs .cert-logos {
  justify-content: center;
}

/* ─── Footer ─── */
.tpl-dark-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 6px;
  flex-shrink: 0;
}
.tpl-dark-footer .footer-tagline {
  color: #90b8f8;
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 11px;
  text-align: center;
  margin-bottom: 6px;
}
.tpl-dark-footer .footer-qr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tpl-dark-footer .footer-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tpl-dark-footer .qr-label {
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.5);
}
.tpl-dark-footer .footer-contact-center {
  text-align: center;
  flex: 1;
}
.tpl-dark-footer .footer-contact {
  font-size: 9px;
  color: rgba(255,255,255,0.45);
  margin-bottom: 2px;
}
.tpl-dark-footer .footer-manila {
  font-size: 8px;
  color: rgba(255,255,255,0.35);
}

/* ─── Editables ─── */
.tpl-dark [contenteditable="true"]:hover {
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15);
}
.tpl-dark [contenteditable="true"]:focus {
  box-shadow: 0 0 0 2px #90b8f8;
}


/* ═══════════════════════════════════════════════════
   TEMPLATE: CORPORATE (Bakkafrost/Heimland-style)
   ═══════════════════════════════════════════════════ */

.tpl-corporate .sheet-content {
  padding: 8mm 12mm 6mm;
}

/* Header */
.tpl-corp-header {
  text-align: center;
  position: relative;
  margin-bottom: 4px;
  flex-shrink: 0;
}
.tpl-corp-logo {
  max-height: 120px;
  width: auto;
  max-width: 70%;
  margin-bottom: 4px;
}
.tpl-corp-tagline {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 11px;
  color: var(--gray-500);
}
.tpl-corp-manila-logo {
  position: absolute;
  top: 0;
  right: 0;
  height: 45px;
  width: auto;
  opacity: 0.8;
}

/* Divider */
.tpl-corp-divider {
  border: none;
  border-top: 2px solid var(--accent);
  margin: 4px 0 8px;
  flex-shrink: 0;
}

/* Photo */
.tpl-corp-photo {
  width: 85%;
  margin: 0 auto 8px;
  max-height: 80mm;
  overflow: hidden;
  border-radius: 4px;
  background: #fff;
  position: relative;
  cursor: grab;
  flex-shrink: 0;
}
.tpl-corp-photo.dragging { cursor: grabbing; }
.tpl-corp-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center center;
  pointer-events: none;
  user-select: none;
}
.tpl-corp-photo .hero-controls { display: flex; }

/* Title */
.tpl-corp-title-block {
  text-align: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.tpl-corp-accent-line {
  width: 60px;
  height: 2px;
  background: var(--accent);
  margin: 0 auto 6px;
}
.tpl-corp-accent-line:last-child {
  margin: 6px auto 0;
}
.tpl-corp-name {
  font-size: 24px;
  text-align: center;
}
.tpl-corp-subtitle {
  text-align: center;
  margin-top: 3px;
}

/* Specs 2-col with icons */
.tpl-corp-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.tpl-corp-spec-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tpl-corp-spec-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--accent);
}
.tpl-corp-spec-header svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
}
.tpl-corp-spec-header-sm {
  font-size: 10px;
  margin-top: 6px;
}
.tpl-corp-spec-header-sm svg {
  width: 14px;
  height: 14px;
}

/* Spec rows with left-border accent */
.tpl-corp-spec-rows {
  display: flex;
  flex-direction: column;
}
.tpl-corp-row {
  display: flex;
  gap: 6px;
  padding: 3px 0 3px 8px;
  border-left: 3px solid var(--accent);
  font-size: 10px;
  border-bottom: 1px solid var(--gray-200);
}
.tpl-corp-label {
  font-weight: 600;
  color: var(--gray-700);
  min-width: 70px;
  flex-shrink: 0;
  white-space: nowrap;
}
.tpl-corp-row span:last-child {
  color: var(--carbon);
}

/* Inline nutrition */
.tpl-corp-nutrition-inline {
  margin-top: 2px;
}
.tpl-corp-nt {
  font-size: 9px;
}
.tpl-corp-nt td { padding: 1.5px 3px; }

/* NO badges compact strip */
.tpl-corp-no-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--gray-200);
}
.tpl-corp-no-item {
  font-size: 9px;
  font-weight: 600;
  color: var(--gray-500);
  white-space: nowrap;
}

/* Certs row */
.tpl-corp-certs {
  margin-bottom: 6px;
  flex-shrink: 0;
}
.tpl-corp-certs .cert-logos {
  justify-content: center;
}

/* Footer */
.tpl-corporate .sheet-footer {
  margin-top: auto;
}


/* ═══════════════════════════════════════════════════
   TEMPLATE: MINIMAL (Editorial)
   ═══════════════════════════════════════════════════ */

.tpl-minimal .sheet-content {
  padding: 0;
}

/* Hero — full-bleed, ~63% of page */
.tpl-min-hero {
  position: relative;
  width: 100%;
  height: 188mm;
  overflow: hidden;
  cursor: grab;
  flex-shrink: 0;
}
.tpl-min-hero.dragging { cursor: grabbing; }
.tpl-min-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center center;
  pointer-events: none;
  user-select: none;
}
.tpl-min-hero .hero-controls { display: flex; }

/* Watermark logo */
.tpl-min-watermark {
  position: absolute;
  bottom: 16px;
  left: 20px;
  z-index: 2;
}
.tpl-min-watermark-logo {
  height: 50px;
  width: auto;
  opacity: 0.7;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.3));
}

/* Body */
.tpl-min-body {
  padding: 6mm 14mm 6mm;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Title */
.tpl-min-name {
  font-size: 30px !important;
  line-height: 1.15;
  margin-bottom: 2px;
}
.tpl-min-subtitle {
  margin-bottom: 10px;
}

/* Key specs — horizontal flex */
.tpl-min-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: auto;
}
.tpl-min-spec-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tpl-min-spec-label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-500);
}
.tpl-min-spec-value {
  font-size: 10px;
  color: var(--carbon);
  font-weight: 500;
}

/* Footer */
.tpl-min-footer {
  margin-top: auto;
  flex-shrink: 0;
}
.tpl-min-footer-line {
  width: 100%;
  height: 1px;
  background: var(--gray-200);
  margin-bottom: 6px;
}
.tpl-min-footer-contact {
  display: flex;
  gap: 16px;
  font-size: 9px;
  color: var(--gray-500);
  margin-bottom: 2px;
}
.tpl-min-footer-company {
  font-size: 8px;
  color: var(--gray-500);
  letter-spacing: 0.04em;
}


/* ═══════════════════════════════════════════════════
   PRINT OVERRIDES PER TEMPLATE
   ═══════════════════════════════════════════════════ */

@media print {
  /* Dark: force background colors */
  .sheet.tpl-dark,
  .sheet.tpl-dark .sheet-content,
  .sheet.tpl-dark .tpl-dark-footer,
  .sheet.tpl-dark .cert-item,
  .sheet.tpl-dark .cert-text-badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .tpl-dark .sheet-content {
    height: 297mm;
    max-height: 297mm;
  }

  /* Corporate: ensure borders print */
  .tpl-corporate .tpl-corp-row,
  .tpl-corporate .tpl-corp-divider,
  .tpl-corporate .tpl-corp-accent-line {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .tpl-corporate .sheet-content {
    height: 297mm;
    max-height: 297mm;
  }

  /* Minimal: large hero prints */
  .tpl-minimal .tpl-min-hero,
  .tpl-minimal .tpl-min-hero-img,
  .tpl-minimal .tpl-min-watermark-logo {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .tpl-minimal .sheet-content {
    padding: 0;
    height: 297mm;
    max-height: 297mm;
  }
}
