* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #fbf3e2;
  color: #1f1a17;
}

/* ---- gornja traka ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: #fffaf0;
  border-bottom: 1px solid #e0d3b8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.logo {
  margin: 0 0 2px;
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1.1;
  color: #1f1a17;
}
.logo-n { color: #d93a1c; }
.logo-tld { font-size: 0.5em; letter-spacing: 0; }
.tagline { margin: 2px 0 0; max-width: 100%; font-size: 30px; line-height: 1.25; color: #4a3f37; }
.actions { display: flex; align-items: center; gap: 12px; }

.print-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 34px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  background: #d93a1c;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 3px 0 #a82a12, 0 6px 14px rgba(217, 58, 28, 0.35);
}
.print-btn:hover { background: #c23216; }
.print-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #a82a12; }
.print-btn:focus-visible, .btn-secondary:focus-visible, .btn-add:focus-visible, .slot-btn:focus-visible {
  outline: 3px solid #1f1a17;
  outline-offset: 2px;
}

.btn-secondary {
  padding: 10px 14px;
  font-size: 15px;
  color: #4a3f37;
  background: #fffaf0;
  border: 1px solid #d6c9ae;
  border-radius: 8px;
  cursor: pointer;
}
.btn-secondary:hover { background: #f5ecd6; }
.btn-secondary[disabled] { opacity: 0.45; cursor: default; }

/* ---- raspored ---- */
.layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  align-items: start;
}

.catalog {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  padding: 16px;
}
.catalog h2 { margin: 0 0 12px; font-size: 17px; }
.catalog.pulse { animation: pulse 0.9s ease 2; }
@keyframes pulse {
  0%, 100% { background: transparent; }
  50% { background: #fde9a8; }
}
.catalog-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: #fffaf0;
  border: 1px solid #e0d3b8;
  border-radius: 10px;
}
.card .thumb {
  width: 56px;
  height: 56px;
  background: #fffaf0;
  border: 1px solid #ebe0c9;
  border-radius: 6px;
  overflow: hidden;
}
.card .thumb svg { width: 100%; height: 100%; display: block; }
.card .name { font-weight: 600; font-size: 15px; }
.card .meta { font-size: 12px; color: #7a6e63; }
.card.group { display: block; padding: 10px 8px 8px; }
.card.group > .name { margin: 0 0 8px 2px; }
.variants { display: grid; gap: 8px; }
.variant {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px;
  background: #fff7e6;
  border: 1px solid #ebe0c9;
  border-radius: 8px;
}
.variant .thumb { width: 48px; height: 48px; background: #fff; border: 1px solid #ebe0c9; border-radius: 6px; overflow: hidden; }
.variant .thumb svg { width: 100%; height: 100%; display: block; }
.variant .vname { font-weight: 600; font-size: 14px; }
.btn-add {
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #1f1a17;
  background: #fcc43a;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.btn-add:hover { background: #f0b420; }

/* ---- listovi ---- */
.stage { min-width: 0; padding: 20px; }
.sheets { display: flex; flex-direction: column; align-items: center; gap: 12px; transform-origin: top center; }
.sheet-label { margin: 8px 0 0; font-size: 14px; font-weight: 600; color: #6b5f55; align-self: center; }

.sheet {
  position: relative;
  width: 210mm;
  height: 297mm;
  padding: 10mm;
  display: flex;
  flex-direction: column;
  gap: 5mm;
  background: #fff;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
  flex: none;
}
.row { display: flex; gap: 5mm; height: 136mm; flex: none; }

.slot {
  position: relative;
  height: 136mm;
  border: 0.3mm dashed #cbbd9f;
  border-radius: 3mm;
  overflow: hidden;
  flex: none;
}
.slot.half { width: 190mm; }
.slot.quarter { width: 92.5mm; }
.slot > svg { display: block; width: 100%; height: 100%; }

.slot-btn {
  position: absolute;
  top: 2mm;
  border: 1px solid #d6c9ae;
  background: rgba(255, 255, 255, 0.95);
  color: #33291f;
  cursor: pointer;
  line-height: 1;
}
.slot-btn.remove {
  right: 2mm;
  width: 34px;
  height: 34px;
  font-size: 24px;
  border-radius: 50%;
}
.slot-btn.remove:hover { background: #fee2e2; border-color: #f87171; color: #b91c1c; }
.slot-btn.variant {
  left: 2mm;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 5px 12px;
  font-size: 17px;
  border-radius: 8px;
}
.slot-btn.variant:hover { background: #fde8ee; border-color: #e58aa5; }

.slot-error { padding: 20px; text-align: center; font-size: 16px; color: #7a6e63; }

.empty-hint {
  position: absolute;
  inset: 10mm;
  display: grid;
  place-items: center;
  border: 0.5mm dashed #cbbd9f;
  border-radius: 4mm;
  font-size: 22px;
  color: #8a7d70;
  text-align: center;
  /* extra bottom padding lifts the text to about a third of the sheet height */
  padding: 20px 20px 100mm;
}

/* ---- about (static text for visitors and search engines) ---- */
.about {
  max-width: 760px;
  margin: 24px auto 48px;
  padding: 0 20px;
  font-size: 17px;
  line-height: 1.55;
  color: #33291f;
}
.about h2 { margin: 0 0 12px; font-size: 26px; line-height: 1.2; color: #1f1a17; }
.about h3 { margin: 24px 0 8px; font-size: 20px; color: #1f1a17; }
.about p { margin: 0 0 12px; }
.about ul, .about ol { margin: 0; padding-left: 22px; }
.about li { margin: 4px 0; }

/* ---- obavijest ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  padding: 14px 22px;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  background: #1f1a17;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 30;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- floating print button (phones only, see the media query below) ---- */
.print-fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 25;
  display: none;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  color: #fff;
  background: #d93a1c;
  border: 2px solid #1f1a17;
  border-radius: 50%;
  box-shadow: 3px 3px 0 #1f1a17;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.print-fab.show { opacity: 1; transform: none; pointer-events: auto; }
.print-fab:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #1f1a17; }
.print-fab:focus-visible { outline: 3px solid #1f1a17; outline-offset: 3px; }

/* ---- uski zasloni ---- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .catalog { position: static; max-height: none; }
  .topbar { flex-wrap: wrap; }
  .print-btn { padding: 12px 24px; font-size: 20px; }
  .stage { padding: 8px; }
  .print-fab { display: inline-flex; }
  .toast { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
}
