/* ===== Konfigurator spomenika - stilovi ===== */
:root {
  --bg: #f4f6f7;
  --panel: #ffffff;
  --ink: #1d2327;
  --ink-soft: #5b6470;
  --muted: #8a93a0;
  --line: #e3e7eb;
  --accent: #2f6b5b;
  --accent-ink: #ffffff;
  --accent-soft: #e8f1ee;
  --danger: #b3261e;
  --shadow-sm: 0 1px 2px rgba(20, 30, 40, 0.06), 0 2px 6px rgba(20, 30, 40, 0.05);
  --shadow-md: 0 6px 18px rgba(20, 30, 40, 0.08);
  --radius: 10px;
  --radius-sm: 6px;
  --header-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.05rem; }
h2 { font-size: 1.15rem; margin-bottom: .35rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--ink-soft); font-size: .92rem; }
.small { font-size: .82rem; }
a { color: var(--accent); }

/* ===== Top bar ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  padding: .65rem 1rem; height: var(--header-h);
}
.brand { display: flex; align-items: center; gap: .75rem; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  background: var(--accent); color: white;
  border-radius: 8px; font-size: 1.1rem;
}
.brand-sub { margin: 0; font-size: .78rem; color: var(--muted); }
.topnav { display: flex; gap: .5rem; align-items: center; }

.btn-primary, .btn-ghost, .btn-mini {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  font: inherit; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn-primary, .btn-ghost { padding: .55rem 1rem; border-radius: var(--radius-sm); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #265a4c; }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-add { width: 100%; margin-top: .5rem; }
.btn-submit { width: 100%; padding: .8rem; font-size: 1rem; margin-top: .5rem; }
.btn-mini {
  padding: .35rem .65rem; font-size: .8rem;
  border-radius: var(--radius-sm); background: white; color: var(--ink); border-color: var(--line);
}
.btn-mini:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Layout ===== */
.layout {
  display: grid; grid-template-columns: 1fr 420px; gap: 1rem;
  padding: 1rem; max-width: 1400px; margin: 0 auto;
  align-items: start;
}
.preview {
  position: sticky; top: calc(var(--header-h) + 1rem);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  display: flex; flex-direction: column; gap: .75rem;
}
.preview-toolbar {
  display: flex; align-items: center; gap: .6rem;
  justify-content: space-between; flex-wrap: wrap;
}
.preview-toolbar .hint { font-size: .78rem; color: var(--muted); }
.preview-stage {
  background: linear-gradient(180deg, #f7f9fa 0%, #e8eef0 100%);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 6 / 7;
  width: 100%;
  display: grid; place-items: center;
  touch-action: none; /* za drag na mobitelu */
}
.preview-stage svg { width: 100%; height: 100%; display: block; }
.preview-meta {
  text-align: center; color: var(--ink-soft); font-size: .9rem;
}
.preview-meta .dot { margin: 0 .35rem; opacity: .5; }

/* Drag handles */
.draggable { cursor: grab; }
.draggable:active { cursor: grabbing; }
.draggable.dragging { opacity: 0.85; }
.draggable.hover-outline rect:first-child,
.draggable.hover-outline ellipse:first-child { /* no-op placeholder */ }

/* Tekst engraving filter applied to group */
#textGroup text { user-select: none; }

/* ===== Panel ===== */
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  display: flex; flex-direction: column;
}
.steps {
  display: flex; flex-wrap: wrap; gap: .35rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: .85rem;
}
.step {
  border: 1px solid var(--line);
  background: white;
  padding: .4rem .7rem;
  border-radius: 999px;
  font-size: .82rem;
  cursor: pointer;
  color: var(--ink-soft);
}
.step:hover { border-color: var(--accent); color: var(--accent); }
.step.active {
  background: var(--accent); color: white; border-color: var(--accent);
}
.step-panel { display: none; }
.step-panel.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px) } to { opacity: 1; transform: none } }

.step-nav {
  display: flex; justify-content: space-between; gap: .5rem;
  margin-top: 1.25rem; padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.step-nav button { flex: 1; }

/* ===== Form fields ===== */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .85rem; }
.field > span { font-size: .85rem; color: var(--ink-soft); font-weight: 500; }
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"],
.field select,
.field textarea {
  font: inherit;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
.field input[type="range"] { accent-color: var(--accent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* ===== Grids ===== */
.grid { display: grid; gap: .6rem; }
.grid-shapes { grid-template-columns: repeat(3, 1fr); }
.grid-materials { grid-template-columns: repeat(3, 1fr); }
.grid-ornaments { grid-template-columns: repeat(4, 1fr); }

.tile {
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .5rem;
  background: white;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  gap: .3rem;
  transition: border-color .15s, transform .1s, box-shadow .15s;
  font-size: .78rem; color: var(--ink-soft); text-align: center;
}
.tile:hover { border-color: var(--accent); }
.tile.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink); font-weight: 500;
  box-shadow: 0 0 0 2px rgba(47, 107, 91, 0.15);
}
.tile svg { width: 100%; height: 56px; display: block; }
.tile .swatch {
  width: 100%; aspect-ratio: 16 / 9;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,.1);
}

.text-lines { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .25rem; }
.line-item { display: flex; gap: .4rem; align-items: center; }
.line-item input {
  flex: 1; padding: .5rem .65rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit;
}
.line-item input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.line-item .btn-del {
  width: 32px; height: 32px;
  border: 1px solid var(--line); background: white;
  border-radius: var(--radius-sm); cursor: pointer; color: var(--muted);
}
.line-item .btn-del:hover { color: var(--danger); border-color: var(--danger); }

.swatches { display: flex; gap: .45rem; flex-wrap: wrap; }
.sw {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--line);
  cursor: pointer; padding: 0;
  transition: transform .1s, box-shadow .15s, border-color .15s;
}
.sw:hover { transform: scale(1.06); }
.sw.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(47,107,91,0.25); }

.upload {
  display: block;
  border: 2px dashed var(--line);
  padding: 1.25rem; text-align: center;
  border-radius: var(--radius-sm);
  cursor: pointer; color: var(--ink-soft);
  transition: border-color .15s, background .15s;
}
.upload:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.summary {
  background: var(--accent-soft);
  border: 1px solid #cfe2db;
  border-radius: var(--radius-sm);
  padding: .75rem .9rem; font-size: .88rem;
  margin: .75rem 0;
  white-space: pre-line; color: var(--ink);
}

.footer { text-align: center; padding: 1.25rem 1rem 2rem; color: var(--muted); }

.toast {
  position: fixed; bottom: 1.25rem; left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--ink); color: white;
  padding: .7rem 1.1rem; border-radius: 999px;
  font-size: .9rem; box-shadow: var(--shadow-md);
  z-index: 50; transition: transform .25s ease;
  pointer-events: none; max-width: calc(100% - 2rem);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ===== Responsive ===== */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: .6rem; gap: .6rem; }
  .preview { position: static; padding: .6rem; }
  .preview-stage { aspect-ratio: 4 / 5; max-height: 60vh; }
  .panel { padding: .85rem; }
  .topbar { padding: .55rem .8rem; }
  h1 { font-size: .98rem; }
  .brand-sub { display: none; }
}
@media (max-width: 560px) {
  .row { grid-template-columns: 1fr; }
  .grid-shapes, .grid-materials { grid-template-columns: repeat(2, 1fr); }
  .grid-ornaments { grid-template-columns: repeat(3, 1fr); }
  .steps { gap: .25rem; }
  .step { padding: .35rem .55rem; font-size: .75rem; }
  .topnav .btn-ghost { padding: .45rem .7rem; }
  .preview-stage { aspect-ratio: 3 / 4; }
  .preview-toolbar .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ===== ADMIN PANEL ===== */
.admin-shell { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.admin-tabs {
  display: flex; flex-wrap: wrap; gap: .35rem;
  border-bottom: 1px solid var(--line); margin-bottom: 1rem;
}
.admin-tab {
  padding: .55rem 1rem; cursor: pointer;
  border: none; background: transparent;
  color: var(--ink-soft); border-bottom: 2px solid transparent;
  font: inherit; font-weight: 500;
}
.admin-tab.active { color: var(--accent); border-color: var(--accent); }
.admin-pane { display: none; }
.admin-pane.active { display: block; }

.admin-card {
  background: white; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm);
}
.admin-list { display: grid; gap: .6rem; }
.admin-item {
  display: grid; grid-template-columns: 80px 1fr auto; gap: .75rem;
  align-items: center;
  padding: .6rem .8rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: white;
}
.admin-item .preview-thumb {
  width: 80px; height: 60px;
  background: linear-gradient(180deg,#f5f7f8,#e6ebee);
  border-radius: 4px; display: grid; place-items: center;
  border: 1px solid var(--line);
}
.admin-item .preview-thumb svg { width: 80%; height: 80%; }
.admin-actions { display: flex; gap: .35rem; }
.admin-actions button {
  padding: .35rem .55rem; font-size: .8rem;
  border: 1px solid var(--line); background: white;
  border-radius: 4px; cursor: pointer;
}
.admin-actions .btn-edit:hover { color: var(--accent); border-color: var(--accent); }
.admin-actions .btn-del:hover { color: var(--danger); border-color: var(--danger); }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 25, 35, 0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 1rem;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: white; border-radius: var(--radius);
  width: 100%; max-width: 640px;
  max-height: 90vh; overflow: auto;
  padding: 1.25rem; box-shadow: var(--shadow-md);
}
.modal h3 { margin: 0 0 .85rem; }
.modal .row-buttons {
  display: flex; gap: .5rem; justify-content: flex-end;
  margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--line);
}

.login-shell {
  min-height: 100vh; display: grid; place-items: center;
  background: var(--bg); padding: 1rem;
}
.login-card {
  background: white; padding: 2rem; border-radius: var(--radius);
  box-shadow: var(--shadow-md); width: 100%; max-width: 360px;
}
.login-card h2 { margin-bottom: .35rem; }
.login-card p { color: var(--muted); font-size: .88rem; margin-bottom: 1rem; }

.shape-tester {
  display: grid; grid-template-columns: 1fr 200px; gap: .75rem;
  align-items: start;
}
.shape-tester svg {
  width: 200px; height: 220px;
  border: 1px solid var(--line); border-radius: 4px;
  background: linear-gradient(180deg,#f7f9fa,#e8eef0);
}
@media (max-width: 640px) {
  .shape-tester { grid-template-columns: 1fr; }
  .shape-tester svg { width: 100%; }
}

.tag {
  display: inline-block; padding: .15rem .5rem;
  border-radius: 999px; font-size: .72rem;
  background: var(--line); color: var(--ink-soft);
}
.tag.ok { background: var(--accent-soft); color: var(--accent); }
.tag.off { background: #fde7e7; color: #b3261e; }

textarea.code {
  font-family: "SF Mono", Consolas, "Courier New", monospace;
  font-size: .85rem; min-height: 110px; resize: vertical;
}

.inquiry-row {
  display: grid; grid-template-columns: 1fr auto; gap: .5rem;
  padding: .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: white; margin-bottom: .5rem;
}
.inquiry-row.unseen { border-left: 3px solid var(--accent); }
.inquiry-row .meta { font-size: .8rem; color: var(--muted); }
.inquiry-row pre { white-space: pre-wrap; font-size: .82rem; margin: .35rem 0 0; }
