/* Beer label generator (beerlabelgenerator.php, Assets/js/beer-labels.js).
   Labels are drawn at real size in mm, so the print sheet matches the screen preview. */

/* ---------- Page and form ---------- */
.cb-labels-form .form-group { display: block; margin-bottom: 14px; }
.cb-labels-form label { color: var(--cb-text-heading); font-size: 13px; font-weight: 600; }
.cb-labels-form .form-control { display: block; max-width: none; width: 100% !important; }
.cb-labels-form textarea.form-control { resize: vertical; }
.cb-labels-subhead { margin-top: 24px; }

.cb-labels-templates { border: 0; margin: 0 0 14px; padding: 0; }
.cb-labels-templates legend { border: 0; color: var(--cb-text-heading); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.cb-labels-templates label { display: inline-block; margin: 0 6px 6px 0; }
.cb-labels-templates input { opacity: 0; position: absolute; }
.cb-labels-templates span {
  border: 1px solid var(--cb-border-input);
  border-radius: 999px;
  cursor: pointer;
  display: inline-block;
  font-weight: 600;
  padding: 6px 16px;
}
.cb-labels-templates input:checked + span { background: var(--cb-theme-secondary); border-color: var(--cb-theme-secondary); color: #fff; }
.cb-labels-templates input:focus-visible + span { outline: 2px solid var(--cb-theme-primary); outline-offset: 2px; }

.cb-labels-color { align-items: center; display: flex; gap: 10px; }
.cb-labels-color input[type="color"],
.cb-labels-palette input[type="color"] { background: none; border: 1px solid var(--cb-border-input); border-radius: 6px; height: 34px; padding: 2px; width: 56px; }
.cb-labels-palette legend { border: 0; color: var(--cb-text-heading); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.cb-labels-palette-row { align-items: center; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.cb-labels-palette-row label { align-items: center; cursor: pointer; display: inline-flex; font-weight: 400; gap: 6px; margin: 0; }
.cb-labels-check { cursor: pointer; display: block; }
.cb-labels-check input { margin-right: 6px; }
.cb-labels-print { font-size: 16px; justify-content: center; margin-top: 6px; width: 100%; }

.cb-labels-preview-card { position: sticky; top: 16px; }
.cb-labels-stage,
.cb-labels-sheet-stage {
  background: var(--cb-surface-subtle);
  align-items: flex-start;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  overflow: hidden;
  padding: 0;
}
.cb-labels-stage { background: repeating-linear-gradient(45deg, #f1f4f8, #f1f4f8 10px, #eaeef4 10px, #eaeef4 20px); }
.cb-labels-stage .cbl-holder,
.cb-labels-sheet-stage .cbl-sheet { flex: 0 0 auto; transform-origin: top center; }
.cbl-holder { padding: 6mm; }
.cbl-holder .cbl { box-shadow: 0 6px 18px rgba(19, 34, 50, 0.18); }
.cb-labels-sheet-title { color: var(--cb-text-heading); font-size: 15px; font-weight: 700; margin: 20px 0 10px; }
.cb-labels-sheet-stage .cbl-sheet { box-shadow: 0 4px 14px rgba(19, 34, 50, 0.15); }

@media (max-width: 991px) {
  .cb-labels-preview-card { position: static; }
}

/* ---------- Sheet ---------- */
.cbl-sheet {
  align-items: center;
  background: #fff;
  box-sizing: border-box;
  display: flex;
  height: var(--sheet-h);
  justify-content: center;
  overflow: hidden;
  width: var(--sheet-w);
}
.cbl-grid { display: grid; }
.cbl-sheet--cut .cbl { outline: 0.2mm dashed #b8c2cf; outline-offset: 1.4mm; }
.cb-label-print { display: none; }

/* ---------- Label base ---------- */
.cbl {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  background: var(--cbl-bg, #fff);
  box-sizing: border-box;
  color: var(--cbl-text, #1d2a38);
  display: flex;
  flex-direction: column;
  font-family: "Open Sans", Arial, sans-serif;
  height: var(--cbl-h);
  line-height: 1.25;
  overflow: hidden;
  position: relative;
  width: var(--cbl-w);
}
.cbl-band { flex: 0 0 auto; }
.cbl-brewery,
.cbl-brewery-foot {
  font-size: calc(var(--cbl-u) * 2.3);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.cbl-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}
.cbl-style {
  color: var(--cbl-accent, #b2292e);
  font-size: calc(var(--cbl-u) * 2.5);
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: calc(var(--cbl-u) * 1);
  text-transform: uppercase;
}
.cbl-name {
  color: var(--cbl-title, inherit);
  font-family: Merriweather, Georgia, serif;
  font-size: calc(var(--cbl-u) * 7.4 * var(--cbl-name-k, 1));
  font-weight: 700;
  line-height: 1.15;
  max-width: 100%;
}
.cbl-desc {
  font-size: calc(var(--cbl-u) * 2.7 * var(--cbl-desc-k, 1));
  line-height: 1.35;
  margin-top: calc(var(--cbl-u) * 1.6);
  opacity: 0.9;
}
.cbl--no-desc .cbl-desc { display: none; }
.cbl-stats {
  display: flex;
  flex-wrap: wrap;
  margin-top: calc(var(--cbl-u) * 2.6);
}
.cbl-stat { padding: 0 calc(var(--cbl-u) * 2.2); text-align: center; }
.cbl-stat b {
  display: block;
  font-size: calc(var(--cbl-u) * 1.9);
  font-weight: 700;
  letter-spacing: 0.12em;
  opacity: 0.7;
}
.cbl-stat span { display: block; font-size: calc(var(--cbl-u) * 3.3); font-weight: 700; }
.cbl-foot {
  align-items: flex-end;
  display: flex;
  flex: 0 0 auto;
  gap: calc(var(--cbl-u) * 2);
  justify-content: space-between;
}
.cbl-foot-text { display: flex; flex-direction: column; gap: calc(var(--cbl-u) * 0.6); }
.cbl-date { font-size: calc(var(--cbl-u) * 2.3); font-weight: 600; opacity: 0.85; }
/* 15 mm is about the smallest a phone reads reliably for a short URL. */
.cbl-qr { display: block; flex: 0 0 auto; height: max(15mm, calc(var(--cbl-u) * 15)); width: max(15mm, calc(var(--cbl-u) * 15)); }

/* ---------- Classic: cream, navy frame, beer-colour band ---------- */
.cbl--classic { border: calc(var(--cbl-u) * 0.7) solid #1d2a38; }
.cbl--classic .cbl-band {
  align-items: center;
  background: var(--cbl-color);
  border-bottom: calc(var(--cbl-u) * 0.7) solid #1d2a38;
  color: var(--cbl-ink);
  display: flex;
  justify-content: center;
  min-height: calc(var(--cbl-u) * 7.5);
  padding: 0 calc(var(--cbl-u) * 4);
  text-align: center;
}
.cbl--classic .cbl-body { align-items: center; padding: calc(var(--cbl-u) * 2.5) calc(var(--cbl-u) * 5) calc(var(--cbl-u) * 1); text-align: center; }
.cbl--classic .cbl-stats { justify-content: center; }
.cbl--classic .cbl-stat + .cbl-stat { border-left: calc(var(--cbl-u) * 0.3) solid #d8cba5; }
.cbl--classic .cbl-foot { padding: 0 calc(var(--cbl-u) * 4) calc(var(--cbl-u) * 3); }
.cbl--classic:not(.cbl--has-qr) .cbl-foot { justify-content: center; }

/* ---------- Bold: the beer colour fills the label ---------- */
.cbl--bold { padding: calc(var(--cbl-u) * 5) calc(var(--cbl-u) * 5.5); }
.cbl--bold .cbl-band { opacity: 0.9; }
.cbl--bold .cbl-style { opacity: 0.85; }
.cbl--bold .cbl-name { font-family: "Open Sans", Arial, sans-serif; font-size: calc(var(--cbl-u) * 8.4 * var(--cbl-name-k, 1)); letter-spacing: -0.01em; line-height: 1.08; text-transform: uppercase; }
.cbl--bold .cbl-name::after { background: currentColor; content: ""; display: block; height: calc(var(--cbl-u) * 0.9); margin-top: calc(var(--cbl-u) * 2.2); opacity: 0.6; width: calc(var(--cbl-u) * 12); }
.cbl--bold .cbl-stats { gap: calc(var(--cbl-u) * 1.4); }
.cbl--bold .cbl-stat { background: rgba(255, 255, 255, 0.16); border-radius: calc(var(--cbl-u) * 1.2); padding: calc(var(--cbl-u) * 1) calc(var(--cbl-u) * 2); }
.cbl--bold .cbl-qr { border-radius: calc(var(--cbl-u) * 1.2); }

/* ---------- Minimal: white, a beer-colour stripe down the side ---------- */
.cbl--minimal { border: calc(var(--cbl-u) * 0.3) solid #cdd7e3; padding: calc(var(--cbl-u) * 4.5) calc(var(--cbl-u) * 5) calc(var(--cbl-u) * 4) calc(var(--cbl-u) * 11); }
.cbl--minimal::before { background: var(--cbl-color); bottom: 0; content: ""; left: 0; position: absolute; top: 0; width: calc(var(--cbl-u) * 5.5); }
.cbl--minimal .cbl-band { color: #5f7083; }
.cbl--minimal:not(.cbl--round) .cbl-stat { padding: 0 calc(var(--cbl-u) * 4) 0 0; text-align: left; }

/* ---------- Round labels ---------- */
.cbl--round { border-radius: 50%; text-align: center; }
.cbl--round .cbl-band { display: none; }
.cbl--round .cbl-body { align-items: center; padding: calc(var(--cbl-u) * 9) calc(var(--cbl-u) * 7) calc(var(--cbl-u) * 1); text-align: center; }
.cbl--round .cbl-stats { justify-content: center; }
.cbl--round .cbl-stat:nth-child(n+3) { display: none; }
.cbl--round .cbl-foot { align-items: center; flex-direction: column; gap: calc(var(--cbl-u) * 1); justify-content: center; padding: 0 0 calc(var(--cbl-u) * 6); }
.cbl--round .cbl-foot-text { align-items: center; }
.cbl--round .cbl-qr { height: 15mm; order: -1; width: 15mm; }
.cbl--round.cbl--has-qr .cbl-desc { display: none; }
.cbl--round.cbl--bold,
.cbl--round.cbl--minimal { padding: 0; }
.cbl--round.cbl--minimal { border: calc(var(--cbl-u) * 3) solid var(--cbl-color); }
.cbl--round.cbl--minimal::before { display: none; }
.cbl--round.cbl--bold .cbl-name::after { margin-left: auto; margin-right: auto; }

/* ---------- Print: only the label sheets ---------- */
@media print {
  html,
  body { background: #fff !important; height: auto !important; margin: 0 !important; padding: 0 !important; }
  body > *:not(#cbLabelPrint) { display: none !important; }
  #cbLabelPrint { display: block !important; }
  #cbLabelPrint .cbl-sheet {
    break-after: page;
    height: calc(var(--sheet-h) - 1mm);
    page-break-after: always;
  }
  #cbLabelPrint .cbl-sheet:last-child { break-after: auto; page-break-after: auto; }
}
