/* ============================================================
   Zasedací pořádek (/stoly) — editor stolů a hostů
   Přebírá paletu, písma a .btn z hlavního webu.
   ============================================================ */

@import url("styles.css");

html, body { height: 100%; }

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height: 1.4;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- horní lišta ---------- */

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  padding: 0.6rem 1rem;
  background: var(--cream-tint);
  border-bottom: 1px solid var(--line);
}

.toolbar-title { font-size: 1.6rem; margin: 0; }

.toolbar-actions {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-small { padding: 0.45rem 1rem; font-size: 0.78rem; }

.btn-danger { color: #a4392e; }
.btn-danger:hover { background: #a4392e; border-color: #a4392e; color: var(--cream); }

.stats {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.stats.is-over { color: #a4392e; font-weight: 700; }

/* ---------- pracovní plocha ---------- */

.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
}

.canvas-wrap {
  flex: 1;
  min-width: 0;
  overflow: auto;
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.canvas {
  width: 100%;
  height: auto;
  max-height: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* stoly a židle v SVG */
.table .table-body {
  fill: var(--cream-tint);
  stroke: var(--sage-deep);
  stroke-width: 2;
  cursor: grab;
}
.table.is-selected .table-body { stroke-width: 4; fill: #e9ecdc; }
.table.is-dragging .table-body { cursor: grabbing; opacity: 0.85; }

.table-name {
  font-family: var(--font-serif);
  font-size: 22px;
  fill: var(--sage-deep);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.seat .seat-dot {
  fill: #fff;
  stroke: var(--sage);
  stroke-width: 2;
}
.seat.is-occupied { cursor: grab; }
.seat.is-occupied .seat-dot { stroke: none; }
.seat.is-target .seat-dot {
  stroke: var(--terracotta);
  stroke-width: 4;
  fill: #f6e7d8;
}

.seat-label {
  font-family: var(--font-sans);
  font-size: 14px;
  fill: var(--ink);
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
  stroke-linejoin: round;
}
.seat-label-full { display: none; }

/* ---------- boční panel ---------- */

.panel {
  width: 320px;
  flex: none;
  display: flex;
  flex-direction: column;
  overflow: auto;
  background: var(--cream);
  border-left: 1px solid var(--line);
}
.panel.is-drop-target {
  background: var(--cream-tint);
  outline: 2px dashed var(--sage);
  outline-offset: -4px;
}

.panel-section {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}
.panel-section.guests { flex: 1; }

.panel input, .panel select { padding: 0.45rem 0.6rem; }

.group-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 1.15rem;
  margin: 0.75rem 0 0.35rem;
}
.group-title:first-child { margin-top: 0; }
.group-count {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.panel-empty { color: var(--ink-soft); font-size: 0.9rem; margin: 0.5rem 0; }

.chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0;
  padding: 0.3rem 0.4rem 0.3rem 0.6rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.chip.is-dragging { opacity: 0.4; }

.dot {
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--c, var(--sage));
}

.chip-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-del {
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.3rem;
  cursor: pointer;
  border-radius: 50%;
}
.chip-del:hover { color: #a4392e; background: var(--cream-tint); }

.add-guest { display: grid; gap: 0.5rem; margin-top: 0.75rem; }

.prop-label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.prop-caption { margin: 0.75rem 0 0.35rem; font-size: 0.85rem; font-weight: 500; color: var(--ink-soft); }
.seat-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.prop-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }

/* ---------- přetahování ---------- */

.drag-ghost {
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  pointer-events: none;
  padding: 0.35rem 0.75rem;
  background: var(--sage-deep);
  color: var(--cream);
  border-radius: 999px;
  font-size: 0.9rem;
  white-space: nowrap;
  transform: translate(-50%, -140%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ---------- užší obrazovky ---------- */

@media (max-width: 900px) {
  body { overflow: auto; }
  .workspace { flex-direction: column; }
  .canvas-wrap { overflow: visible; }
  .canvas { max-height: none; }
  .panel {
    width: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

/* ---------- tisk ---------- */

.print-only, .print-list { display: none; }

@page { size: A4 portrait; margin: 12mm; }
@page plan { size: A4 landscape; margin: 10mm; }

@media print {
  html, body { height: auto; }
  body {
    display: block;
    overflow: visible;
    background: #fff;
    color: #000;
  }
  .toolbar, .panel, .drag-ghost { display: none !important; }

  .workspace, .canvas-wrap {
    display: block;
    padding: 0;
    overflow: visible;
  }
  .canvas-wrap { page: plan; }
  .canvas {
    width: 100%;
    height: auto;
    max-height: none;
    border: 0;
    border-radius: 0;
  }
  .grid-bg { display: none; }
  .table .table-body { fill: #fff; stroke: #000; }
  .table-name { fill: #000; }
  .seat-label { fill: #000; stroke: none; }
  .seat-label-short { display: none; }
  .seat-label-full { display: block; font-size: 11px; }
  .table.is-selected .table-body { stroke-width: 2; }

  .print-only {
    display: block;
    text-align: center;
    font-size: 1.6rem;
    margin: 0 0 0.5rem;
  }
  .print-only::after { display: none; }

  /* seznam host → stůl */
  body.print-list .workspace { display: none; }
  body.print-list .print-list { display: block; }
  .print-list h2 { font-size: 1.6rem; margin-bottom: 1rem; }
  .print-list h2::after { display: none; }
  .print-list h3 { margin: 1.25rem 0 0.5rem; break-after: avoid; }
  .print-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
    column-count: 3;
    column-gap: 1.5rem;
    font-size: 0.9rem;
  }
  .print-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.12rem 0;
    border-bottom: 1px dotted #999;
    break-inside: avoid;
  }
  .print-list li strong { white-space: nowrap; }
}
