/* ————— Tejbl: sdílené tokeny a komponenty ————— */

:root {
  --paper: #f6f3ec;
  --surface: #ffffff;
  --ink: #212b2e;
  --muted: #67716f;
  --faint: #9aa39f;
  --line: #e6dfd2;
  --line-strong: #d6cdbb;

  --brand: #0e6f66;
  --brand-strong: #0a5850;
  --brand-soft: #e1efec;
  --accent: #c2703d;
  --accent-soft: #f8e9dc;

  --free: #2e9e63;
  --free-soft: #e0f3e8;
  --soon: #b97f04;
  --soon-soft: #fdf1d3;
  --occupied: #d5455b;
  --occupied-soft: #fbe2e6;
  --cleaning: #3f7fd6;
  --cleaning-soft: #e2edfb;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(33, 43, 46, 0.05), 0 8px 24px rgba(33, 43, 46, 0.07);
  --shadow-lg: 0 4px 12px rgba(33, 43, 46, 0.08), 0 20px 48px rgba(33, 43, 46, 0.16);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

p { margin: 0; }
button { font-family: inherit; }
a { color: var(--brand); }

.tnum { font-variant-numeric: tabular-nums; }

/* ————— Horní lišta aplikace ————— */

.topbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 20px;
  height: 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.logo svg { display: block; }

.topbar nav {
  display: flex;
  gap: 4px;
}

.topbar nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 8px;
}

.topbar nav a:hover { color: var(--ink); background: var(--paper); }
.topbar nav a.active { color: var(--brand-strong); background: var(--brand-soft); }

.topbar .spacer { flex: 1; }

.venue-name {
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 600;
}

/* ————— Tlačítka ————— */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--faint); background: var(--paper); }

.btn-soft { background: var(--brand-soft); color: var(--brand-strong); }
.btn-soft:hover { background: #d3e7e2; }

.btn-danger { background: var(--occupied-soft); color: #a92c40; }
.btn-danger:hover { background: #f6d2d8; }

.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ————— Štítky stavů ————— */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: currentColor;
}

.pill-pending { background: var(--soon-soft); color: var(--soon); }
.pill-confirmed { background: var(--brand-soft); color: var(--brand-strong); }
.pill-seated { background: var(--occupied-soft); color: var(--occupied); }
.pill-finished { background: #eeeae1; color: var(--muted); }
.pill-cancelled { background: #eeeae1; color: var(--muted); text-decoration: line-through; }
.pill-noshow { background: #eeeae1; color: #a92c40; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 2px 9px;
  border-radius: 99px;
  white-space: nowrap;
}

/* ————— Krokovač (počet osob, míst…) ————— */

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stepper button {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  line-height: 1;
}

.stepper button:hover { border-color: var(--brand); color: var(--brand-strong); }
.stepper output { font-size: 15px; font-weight: 750; min-width: 52px; text-align: center; }

/* ————— Vodorovný výběr dne (widget, dashboard, ruční rezervace) ————— */

.day-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}

.day-strip button {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
}

.day-strip button:hover:not(.active) { border-color: var(--brand); }

.day-strip button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ————— Karty a formuláře ————— */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }

.field label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input, .field select, .field textarea {
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  outline: none;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.form-error {
  color: #a92c40;
  background: var(--occupied-soft);
  border-radius: 8px;
  font-size: 13px;
  padding: 8px 11px;
  margin-bottom: 12px;
}

/* ————— Segmentovaný přepínač (zóny, dny) ————— */

.seg {
  display: inline-flex;
  background: #ece7db;
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
}

.seg button {
  border: 0;
  background: transparent;
  padding: 6px 15px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--muted);
  cursor: pointer;
}

.seg button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(33, 43, 46, 0.12);
}

/* ————— Plánek (SVG) ————— */

.fp-floor { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.fp-grid-dot { fill: #ece6d9; }

.fp-table { cursor: default; }
.fp-chair { fill: #e6dfcf; }
.fp-shape { fill: #faf8f3; stroke: #b6ad9b; stroke-width: 2; }

.fp-label {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 750;
  fill: var(--ink);
  text-anchor: middle;
  pointer-events: none;
}

.fp-sub {
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 650;
  fill: var(--muted);
  text-anchor: middle;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.fp-table.is-free .fp-shape { fill: var(--free-soft); stroke: var(--free); }
.fp-table.is-soon .fp-shape { fill: var(--soon-soft); stroke: var(--soon); }
.fp-table.is-occupied .fp-shape { fill: var(--occupied-soft); stroke: var(--occupied); }
.fp-table.is-cleaning .fp-shape { fill: var(--cleaning-soft); stroke: var(--cleaning); }

.fp-table.is-free .fp-sub { fill: #22794c; }
.fp-table.is-soon .fp-sub { fill: var(--soon); }
.fp-table.is-occupied .fp-sub { fill: var(--occupied); }
.fp-table.is-cleaning .fp-sub { fill: var(--cleaning); }

.fp-table.is-selected .fp-shape { stroke: var(--brand); stroke-width: 3.5; fill: var(--brand-soft); }
.fp-table.is-selected .fp-chair { fill: #c9e2dc; }

.fp-table.is-available .fp-shape { fill: var(--free-soft); stroke: var(--free); }
.fp-table.is-available { cursor: pointer; }
.fp-table.is-available:hover .fp-shape { fill: #cdeeda; stroke-width: 3; }

.fp-table.is-taken .fp-shape { fill: #f0ece2; stroke: #d5cdbc; }
.fp-table.is-taken .fp-label { fill: var(--faint); }
.fp-table.is-taken .fp-sub { fill: var(--faint); }

.fp-table.is-picked { cursor: pointer; }
.fp-table.is-picked .fp-shape { fill: var(--brand); stroke: var(--brand-strong); }
.fp-table.is-picked .fp-label { fill: #fff; }
.fp-table.is-picked .fp-sub { fill: #bfe0da; }
.fp-table.is-picked .fp-chair { fill: #c9e2dc; }

.fp-table.is-dragging { cursor: grabbing; }
.fp-table.is-dragging .fp-shape { stroke: var(--brand); stroke-dasharray: 6 4; }

.plan-wrap { position: relative; }
.plan-wrap svg { display: block; width: 100%; height: auto; touch-action: none; }

/* ————— Legenda stavů ————— */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.legend span { display: inline-flex; align-items: center; gap: 6px; }

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1.5px solid;
}

.legend .l-free i { background: var(--free-soft); border-color: var(--free); }
.legend .l-soon i { background: var(--soon-soft); border-color: var(--soon); }
.legend .l-occupied i { background: var(--occupied-soft); border-color: var(--occupied); }
.legend .l-cleaning i { background: var(--cleaning-soft); border-color: var(--cleaning); }

/* ————— Toasty (notifikace) ————— */

#toasts {
  position: fixed;
  top: 70px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  animation: toast-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.toast.toast-new { border-left-color: var(--accent); }
.toast h4 { font-size: 14px; margin-bottom: 2px; }
.toast p { font-size: 13px; color: var(--muted); }
.toast .toast-actions { display: flex; gap: 8px; margin-top: 9px; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.leaving { opacity: 0; transition: opacity 0.3s; }

/* ————— Overlay panel (akce stolu na dashboardu) ————— */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(33, 43, 46, 0.35);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
}

@media (min-width: 700px) {
  .overlay { align-items: center; }
}

.sheet {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: min(420px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 20px;
  animation: sheet-in 0.2s ease-out;
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.sheet h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.sheet .sheet-sub { color: var(--muted); font-size: 13px; margin: 3px 0 14px; }
.sheet .sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

/* ————— Drobnosti ————— */

.muted { color: var(--muted); }
.small { font-size: 13px; }

.demo-note {
  text-align: center;
  font-size: 12.5px;
  color: var(--faint);
  padding: 18px;
}

.demo-note button {
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

/* ————— Přechody mezi stránkami ————— */
/* Nativní View Transitions API (Chrome/Edge/Safari) — bez JS. V prohlížečích
   bez podpory se prostě nic nestane, stránka se přepne jako dřív. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: tf-page-out 180ms ease-in both;
}

::view-transition-new(root) {
  animation: tf-page-in 220ms ease-out both;
}

@keyframes tf-page-out {
  to { transform: translateX(-18px); opacity: 0; }
}

@keyframes tf-page-in {
  from { transform: translateX(18px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) {
    animation: none;
  }
}
