/* ============================================================
   Online menu QR poster (A4)
   ------------------------------------------------------------
   Screen: scalable preview of a real 210x297mm sheet.
   Print : the same sheet, printed at exact A4 with no margins.
   ============================================================ */

.poster-page {
  --poster-accent: #0e7490;
  --poster-accent-dark: #104156;
  --poster-accent-light: #62a5b7;
  --poster-accent-soft: #e7f1f4;
  --poster-accent-line: #bcd8e0;
  --poster-accent-ink: #ffffff;
}

.poster-main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.poster-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.poster-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, .55);
  border: 1px solid rgba(148, 163, 184, .25);
  color: #cbd5f5;
  font-size: .82rem;
}

.poster-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 4rem 1rem;
  color: #cbd5f5;
}

/* ---------------- panels ---------------- */

.poster-panel {
  background: rgba(15, 23, 42, .55);
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 1rem;
  padding: 1.15rem;
}

.poster-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.poster-panel-title {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  color: #e2e8f0;
}

.poster-zoom {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.poster-zoom .btn {
  --bs-btn-color: #cbd5f5;
  --bs-btn-border-color: rgba(148, 163, 184, .35);
  --bs-btn-hover-bg: rgba(148, 163, 184, .15);
  --bs-btn-hover-border-color: rgba(148, 163, 184, .5);
  --bs-btn-hover-color: #fff;
}

.poster-zoom-value {
  min-width: 3.4rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #cbd5f5;
  font-size: .85rem;
}

/* ---------------- preview stage ---------------- */

.poster-stage {
  display: flex;
  justify-content: center;
  padding: .75rem;
  border-radius: .85rem;
  background:
    repeating-conic-gradient(rgba(148, 163, 184, .09) 0% 25%, transparent 0% 50%) 50% / 16px 16px;
  overflow: auto;
}

.poster-sheet-wrap {
  position: relative;
  flex: 0 0 auto;
}

.poster-sheet {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  background: #ffffff;
  color: #0f172a;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  direction: rtl;
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: 0 1.2rem 2.4rem rgba(2, 6, 23, .45);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.poster-sheet * {
  box-sizing: border-box;
}

/* ---------------- decorations ---------------- */

.poster-wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.poster--restaurant .poster-wash,
.poster--cafe .poster-wash {
  background: var(--poster-accent-soft);
}

.poster--retail .poster-wash {
  inset: 0 0 58% 0;
  background: var(--poster-accent-soft);
}

.poster-ornament {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.poster-ornament--corners span {
  position: absolute;
  width: 16mm;
  height: 16mm;
  border: 1.1mm solid var(--poster-accent-line);
}

.poster-ornament--corners span:nth-child(1) { top: 5.5mm; left: 5.5mm; border-right: 0; border-bottom: 0; }
.poster-ornament--corners span:nth-child(2) { top: 5.5mm; right: 5.5mm; border-left: 0; border-bottom: 0; }
.poster-ornament--corners span:nth-child(3) { bottom: 5.5mm; left: 5.5mm; border-right: 0; border-top: 0; }
.poster-ornament--corners span:nth-child(4) { bottom: 5.5mm; right: 5.5mm; border-left: 0; border-top: 0; }

.poster-ornament--rules span {
  position: absolute;
  left: 20mm;
  right: 20mm;
  height: 0;
  border-top: 0.7mm solid var(--poster-accent-line);
}

.poster-ornament--rules .rule-top { top: 6mm; }
.poster-ornament--rules .rule-bottom { bottom: 6mm; }

.poster-ornament--dots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 3.4mm;
  gap: 0;
  width: 10.2mm;
  height: 10.2mm;
  left: auto;
  right: 9mm;
  bottom: auto;
  top: 9mm;
}

.poster-ornament--dots span {
  width: 1.4mm;
  height: 1.4mm;
  margin: auto;
  border-radius: 50%;
  background: var(--poster-accent-line);
}

/* ---------------- header ---------------- */

.poster-head {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.poster-head--tint {
  background: var(--poster-accent-soft);
  border-radius: 7mm;
}

.poster-head--outline {
  border: 0.5mm solid var(--poster-accent-line);
  border-radius: 7mm;
}

.poster-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 2.4mm;
  font-weight: 700;
  color: var(--poster-accent-dark);
  letter-spacing: 0;
}

.poster-mark {
  width: 1.25em;
  height: 1.25em;
  fill: var(--poster-accent);
  flex: 0 0 auto;
}

.poster-title {
  margin: 0;
  font-weight: 800;
  color: var(--poster-accent-dark);
  letter-spacing: -0.01em;
}

.poster-subtitle {
  margin: 0;
  color: #4b5563;
  font-weight: 400;
}

.poster-subtitle span {
  display: block;
}

/* ---------------- QR card ---------------- */

.poster-card {
  position: absolute;
  background: #ffffff;
  border-radius: 9mm;
  border: 0.25mm solid #eef2f7;
}

.poster-card--shadow {
  box-shadow: 0 3mm 7mm rgba(15, 23, 42, .16);
}

.poster-card--border {
  border: 0.6mm solid var(--poster-accent-line);
}

.poster-qr {
  position: absolute;
  background: #ffffff;
}

.poster-qr-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.poster-plate {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #ffffff;
  border: 0.6mm solid var(--poster-accent-line);
  overflow: hidden;
}

.poster-plate img {
  /* Height comes from the layout (posterLayoutService.plateLogoFit) so a logo
     with blank margins is centred instead of sitting in a square frame. */
  width: 98%;
  object-fit: contain;
}

.poster-plate-mark {
  width: 44%;
  height: 44%;
  fill: var(--poster-accent);
}

/* ---------------- identity ---------------- */

.poster-name {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.poster-name span {
  display: block;
}

.poster-english {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-weight: 600;
  /* accent-text is the accent darkened until it is legible on white */
  color: var(--poster-accent-text);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.poster-tagline {
  position: absolute;
  left: 14mm;
  right: 14mm;
  text-align: center;
  color: #475569;
}

.poster-tagline span {
  display: block;
}

/* ---------------- call to action ---------------- */

.poster-cta {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-align: center;
}

.poster-cta--filled {
  background: var(--poster-accent);
  color: var(--poster-accent-ink);
  border-radius: 999px;
}

.poster-cta--ink {
  background: #0f172a;
  color: #ffffff;
  border-radius: 999px;
}

.poster-cta--outline {
  border: 0.9mm solid var(--poster-accent);
  color: var(--poster-accent-dark);
  border-radius: 999px;
}

/* ---------------- footer ---------------- */

/* Scoped to the sheet on purpose: landing.css ships a bare `footer` rule with a
   dark background and 60px of padding, which would otherwise paint a black band
   across the bottom of the printed poster. */
.poster-sheet .poster-foot {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4mm;
  padding: 3mm 0 0;
  margin: 0;
  background: transparent;
  border-top: 0.5mm solid #e2e8f0;
  color: #94a3b8;
}
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4mm;
  padding-top: 3mm;
  border-top: 0.5mm solid #e2e8f0;
  color: #94a3b8;
}

.poster-foot-brand {
  font-weight: 700;
  font-size: 1.35em;
  color: #111827;
}

.poster-foot-url {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- template character ---------------- */

.poster--elegant .poster-title { font-weight: 500; letter-spacing: 0.06em; }
.poster--elegant .poster-name { font-weight: 600; letter-spacing: 0.04em; }
.poster--minimal .poster-title { font-weight: 600; letter-spacing: 0; }
.poster--minimal .poster-name { font-weight: 700; }
.poster--restaurant .poster-title { font-weight: 900; }
.poster--restaurant .poster-name { font-weight: 900; }
.poster--cafe .poster-title { font-weight: 800; }
.poster--retail .poster-title { font-weight: 900; }
.poster--retail .poster-name { font-weight: 900; }

/* ============================================================
   Dashboard controls
   ============================================================ */

.poster-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
}

.poster-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
}

.poster-link-box {
  margin-top: 1rem;
  padding: .75rem .85rem;
  border-radius: .75rem;
  background: rgba(2, 6, 23, .45);
  border: 1px dashed rgba(148, 163, 184, .3);
}

.poster-link-label {
  font-size: .78rem;
  color: #94a3b8;
  margin-bottom: .35rem;
}

.poster-link-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  font-size: .9rem;
  color: #e2e8f0;
  word-break: break-all;
}

.poster-templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: .5rem;
}

.poster-template {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .65rem;
  border-radius: .65rem;
  border: 1px solid rgba(148, 163, 184, .25);
  background: rgba(2, 6, 23, .35);
  color: #cbd5f5;
  font-size: .85rem;
  transition: border-color .15s ease, background .15s ease;
}

.poster-template:hover {
  border-color: rgba(148, 163, 184, .55);
}

.poster-template.active {
  border-color: #facc15;
  background: rgba(250, 204, 21, .12);
  color: #fff;
}

.poster-template-swatch {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: .35rem;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}

.poster-field-row {
  margin-top: 1rem;
}

.poster-field-row .form-label {
  font-weight: 600;
  color: #cbd5f5;
}

.poster-accent-row {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.poster-accent-row .form-control-color {
  width: 3rem;
  flex: 0 0 auto;
}

.poster-readonly {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .55rem .75rem;
  border-radius: .5rem;
  background: rgba(2, 6, 23, .4);
  border: 1px solid rgba(148, 163, 184, .2);
  color: #e2e8f0;
}

.poster-logo-row {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}

.poster-logo-preview {
  width: 4.5rem;
  height: 4.5rem;
  flex: 0 0 auto;
  /* Round like the plate in the middle of the poster, so the seller sees the
     printed result before saving. */
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, .3);
}

.poster-logo-preview img {
  width: 98%;
  object-fit: contain;
}

.poster-logo-preview i {
  color: #94a3b8;
  font-size: 1.5rem;
}

.poster-hint {
  margin-top: 1rem;
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  font-size: .8rem;
  color: #94a3b8;
}

@media (max-width: 575.98px) {
  .poster-actions {
    grid-template-columns: 1fr;
  }

  .poster-stage {
    padding: .35rem;
  }
}

/* ============================================================
   Print: exactly one A4 page, nothing else on the paper
   ============================================================ */

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    /* The dashboard chrome around the poster is only hidden with
       `visibility`, which keeps its box in the layout. Without clamping the
       document, that leftover height makes the browser emit a second, empty
       A4 page after the poster. */
    height: 297mm !important;
    max-height: 297mm !important;
    overflow: hidden !important;
  }

  /* dashboard.css hides .seller-shell when printing shipping labels; the
     poster is printed from inside that shell, so it is re-enabled here. */
  .poster-page,
  .poster-page * {
    visibility: hidden !important;
    transform: none !important;
    box-shadow: none !important;
    animation: none !important;
  }

  .poster-page.seller-shell,
  .poster-page .poster-main,
  .poster-page .poster-stage,
  .poster-page .poster-sheet-wrap {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    overflow: visible !important;
  }

  #poster-sheet,
  #poster-sheet * {
    visibility: visible !important;
  }

  #poster-sheet {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 210mm !important;
    height: 297mm !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: hidden !important;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}