/* ── Booking form ───────────────────────────────────────────────────────────── */

.booking-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
}

.booking-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ── Date / Time / Table triggers ───────────────────────────────────────────── */

.date-picker,
.time-picker,
.table-picker {
  display: grid;
  gap: 0.4rem;
}

.date-trigger,
.time-trigger,
.table-trigger {
  min-height: 58px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  background: #140f0c;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.date-trigger::placeholder,
.time-trigger::placeholder,
.table-trigger::placeholder {
  color: #baa58a;
  font-weight: 600;
}

.date-trigger:focus,
.time-trigger:focus,
.table-trigger:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232, 110, 47, 0.2);
  transform: scale(1.01);
}

.date-trigger.is-filled,
.time-trigger.is-filled,
.table-trigger.is-filled {
  color: var(--gold);
}

/* ── Date modal ─────────────────────────────────────────────────────────────── */

.date-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.date-modal[hidden] {
  display: none;
}

.date-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 4, 3, 0.72);
  backdrop-filter: blur(4px);
}

.date-modal__panel {
  position: relative;
  z-index: 1;
  width: min(760px, 95vw);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem;
  background: linear-gradient(165deg, #22150f, #150f0b 75%);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
}

.date-modal__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.date-modal__title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--gold);
}

.date-close {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #1b120d;
  color: var(--text);
  font-size: 1rem;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
}

.date-nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.date-nav button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #1b120d;
  color: var(--text);
  font-size: 0.95rem;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

.date-month {
  text-align: center;
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 0.04em;
  font-size: 2rem;
}

.date-weekdays,
.date-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.date-weekdays span {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
}

.date-cell {
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 64px;
  background: #1d130e;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.date-cell:hover {
  border-color: var(--orange);
}

.date-cell.is-out {
  opacity: 0.4;
}

.date-cell.is-past {
  opacity: 0.32;
  cursor: not-allowed;
}

.date-cell.is-selected {
  background: linear-gradient(140deg, #e86e2f, #ff8f4f);
  border-color: #ff9c62;
  color: #fff;
}

.date-quick {
  margin-top: 0.9rem;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.date-quick button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #1d130e;
  color: var(--gold);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

/* ── Time modal ─────────────────────────────────────────────────────────────── */

.time-modal {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.time-modal[hidden] {
  display: none;
}

.time-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 4, 3, 0.76);
  backdrop-filter: blur(4px);
}

.time-modal__panel {
  position: relative;
  z-index: 1;
  width: min(760px, 95vw);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem;
  background: linear-gradient(165deg, #22150f, #140e0a 75%);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
}

.time-modal__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.time-modal__title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--gold);
}

.time-date {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.time-slot {
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 48px;
  background: #1d130e;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.time-slot:hover {
  border-color: var(--orange);
}

.time-slot.is-selected {
  background: linear-gradient(140deg, #e86e2f, #ff8f4f);
  border-color: #ff9c62;
  color: #fff;
}

.time-empty {
  margin: 0;
  color: var(--muted);
}

/* ── Table modal ────────────────────────────────────────────────────────────── */

.table-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.table-modal[hidden] {
  display: none;
}

.table-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 4, 3, 0.76);
  backdrop-filter: blur(4px);
}

.table-modal__panel {
  position: relative;
  z-index: 1;
  width: min(1260px, 98vw);
  max-height: 94vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.1rem;
  background: linear-gradient(165deg, #22150f, #140e0a 75%);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
}

.table-modal__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.table-modal__title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--gold);
}

/* ── Table info / legend / zone switch ──────────────────────────────────────── */

.table-info {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-legend {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.table-legend--admin {
  margin-bottom: 0.55rem;
}

.table-zone-switch,
.admin-zone-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}

.admin-zone-switch {
  margin-bottom: 0;
}

.table-zone-switch button,
.admin-zone-switch button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #1b120d;
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}

.admin-page .table-zone-switch button,
.admin-page .admin-zone-switch button {
  border-color: #bfd3e8;
  background: #edf5ff;
  color: #21405f;
}

.table-zone-switch button.is-active,
.admin-zone-switch button.is-active {
  border-color: #2e7cc9;
  background: linear-gradient(145deg, #2e7cc9, #5797d8);
  color: #fff;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.25rem;
  border: 1px solid transparent;
}

.legend-dot.is-free {
  background: #21b16b;
  border-color: #1b965a;
}

.legend-dot.is-busy {
  background: #d34949;
  border-color: #b93d3d;
}

.legend-dot.is-small {
  background: #656b76;
  border-color: #555a63;
}

.legend-dot.is-manual {
  background: #f2a548;
  border-color: #dd9338;
}

/* ── Table layout ───────────────────────────────────────────────────────────── */

.table-layout {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 86 / 64;
  border: 1px solid #454b57;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(170deg, #3a404b, #323842);
}

.table-layout--admin {
  aspect-ratio: 86 / 70;
}

.table-layout.table-layout--terrace {
  aspect-ratio: 86 / 42;
  background: linear-gradient(165deg, #2f3f3b, #26352f);
  border-color: #4d6760;
}

.table-layout--admin.table-layout--terrace {
  aspect-ratio: 86 / 46;
}

.table-layout.table-layout--terrace::before {
  border-color: #4d6760;
}

.table-layout::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid #454b57;
  border-radius: 10px;
  pointer-events: none;
}

/* ── Table floor decorations ────────────────────────────────────────────────── */

.table-floor__bar {
  position: absolute;
  left: 14%;
  right: 8%;
  bottom: 4.5%;
  height: 11%;
  min-height: 56px;
  border: 1px solid #6b452b;
  border-radius: 12px;
  background: linear-gradient(180deg, #8e613e 0%, #764a2f 52%, #633c25 100%);
  box-shadow: inset 0 0 0 2px rgba(47, 29, 17, 0.35), inset 0 -10px 18px rgba(20, 12, 7, 0.22),
    0 8px 20px rgba(0, 0, 0, 0.22);
  z-index: 1;
}

.table-floor__bar-title {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  color: #f5e3cc;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-shadow: 0 1px 1px rgba(25, 15, 8, 0.5);
}

.table-floor__bar-shelf {
  position: absolute;
  left: 14%;
  right: 14%;
  height: 2px;
  background: rgba(255, 236, 212, 0.3);
  z-index: 1;
}

.table-floor__bar-shelf--one {
  top: 44%;
}

.table-floor__bar-shelf--two {
  top: 67%;
}

.table-floor__bar-obj {
  position: absolute;
  background: rgba(248, 235, 216, 0.78);
  border: 1px solid rgba(91, 62, 39, 0.55);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.table-floor__bar-obj--bottle {
  top: 18%;
  left: auto;
  right: 22%;
  width: 11px;
  height: 24px;
  border-radius: 4px;
}

.table-floor__bar-obj--glass {
  top: 52%;
  right: 11%;
  width: 13px;
  height: 13px;
  border-radius: 3px;
}

.table-floor__bar-obj--shaker {
  top: 50%;
  left: auto;
  right: 16%;
  width: 11px;
  height: 18px;
  border-radius: 999px;
}

.table-floor__entrance {
  position: absolute;
  left: 2.4%;
  top: 3.8%;
  width: 7%;
  max-width: 58px;
  min-width: 38px;
  height: 7.2%;
  min-height: 30px;
  border: 1.5px solid #c4d0dd;
  border-radius: 8px;
  background: rgba(20, 30, 44, 0.28);
  display: grid;
  place-items: center;
  padding-bottom: 0;
  z-index: 1;
}

.table-floor__entrance::before {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 5px;
  height: 2px;
  border-radius: 999px;
  background: #dfe7f1;
}

.table-floor__entrance-label {
  position: relative;
  z-index: 1;
  color: #f4f8ff;
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(8, 12, 18, 0.6);
}

.table-floor__entrance-arrow {
  display: none;
}

.table-floor__divider-main,
.table-floor__divider-leg {
  position: absolute;
  border-radius: 4px;
  border: 1px solid rgba(210, 220, 232, 0.65);
  background: linear-gradient(180deg, #f9fbff 0%, #e8edf5 100%);
  box-shadow: 0 3px 10px rgba(3, 7, 14, 0.18);
  z-index: 1;
  pointer-events: none;
}

.table-floor__divider-main {
  left: 18%;
  top: 20%;
  width:65%;
  height: 2.6%;
  min-height: 7px;
}

.table-floor__divider-leg {
  left: 82%;
  top: 23%;
  width: 1.8%;
  min-width: 7px;
  height: 37%;
}

.table-layout--terrace .table-floor__bar,
.table-layout--terrace .table-floor__entrance,
.table-layout--terrace .table-floor__divider-main,
.table-layout--terrace .table-floor__divider-leg {
  display: none;
}

.table-terrace__edge {
  position: absolute;
  left: 3%;
  right: 3%;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(138, 108, 76, 0.95), rgba(101, 74, 49, 0.95));
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
  z-index: 1;
}

.table-terrace__edge--top {
  top: 3.5%;
}

.table-terrace__bar-label {
  position: absolute;
  top: 6.5%;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #111;
  text-shadow: none;
  font-size: 0.74rem;
  z-index: 1;
}

/* ── Table seat ─────────────────────────────────────────────────────────────── */

.table-seat {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  transform: translate(-50%, -50%);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.35rem;
  color: #f8fafc;
  font: inherit;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.24rem;
  text-align: center;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.table-seat:disabled {
  opacity: 1;
}

.table-seat::before,
.table-seat::after {
  content: "";
  position: absolute;
  top: 10%;
  bottom: 10%;
  width: 10px;
  background: radial-gradient(circle, #d9dde2 0 4px, transparent 5px) repeat-y;
  pointer-events: none;
}

.table-seat::before {
  left: -7px;
  background-size: 10px calc(100% / var(--chairs-left));
}

.table-seat::after {
  right: -7px;
  background-size: 10px calc(100% / var(--chairs-right));
}

.table-seat--round {
  border-radius: 999px;
}

.table-seat--round::before,
.table-seat--round::after {
  top: 12%;
  bottom: 12%;
  width: 10px;
  border: 0;
  border-radius: 0;
  background: radial-gradient(circle, #d9dde2 0 4px, transparent 5px) repeat-y;
  background-size: 10px calc(100% / var(--chairs-left));
}

.table-seat--round::after {
  background-size: 10px calc(100% / var(--chairs-right));
}

.table-seat.is-free {
  background: linear-gradient(145deg, #22c07b, #1ea96b);
}

.table-seat.is-busy {
  background: linear-gradient(145deg, #dc5151, #c14545);
  cursor: not-allowed;
}

.table-seat.is-small {
  background: linear-gradient(145deg, #6b7280, #5b616d);
  cursor: not-allowed;
}

.table-seat:not(:disabled):hover {
  transform: translate(-50%, -50%) scale(1.03);
}

.table-layout--admin .table-seat {
  cursor: default;
}

.table-layout--admin.is-merge-mode .table-seat {
  cursor: pointer;
}

.table-layout--admin .table-seat.is-busy {
  background: linear-gradient(145deg, #dc5151, #c14545) !important;
}

.table-layout--admin .table-seat.is-merge-source {
  border-color: #ffe08a;
  box-shadow: 0 0 0 3px rgba(255, 224, 138, 0.42);
}

.table-layout--admin .table-seat.is-merge-candidate {
  border-color: #a6d8ff;
  box-shadow: 0 0 0 2px rgba(166, 216, 255, 0.3);
}

.table-seat.is-selected {
  border-color: #b6f4d6;
  box-shadow: 0 0 0 3px rgba(182, 244, 214, 0.35);
}

.table-seat__label {
  font-size: 0.98rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.table-seat__capacity {
  font-size: 1.22rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.table-seat__time {
  background: rgba(255, 255, 255, 0.94);
  color: #1f2937;
  border-radius: 6px;
  padding: 0.09rem 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.table-seat__state {
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  opacity: 0.9;
}

.table-seat__time,
.table-seat__state {
  display: none;
}

/* ── Booking feedback / date help ───────────────────────────────────────────── */

.booking-feedback {
  margin: 0;
  font-size: 0.85rem;
  color: #9fdfb3;
}

.booking-feedback.is-error {
  color: #ff9a8b;
}

.date-help {
  margin: 0;
  font-size: 0.78rem;
  color: var(--gold);
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .date-modal__panel {
    width: min(680px, 96vw);
    padding: 0.85rem;
  }

  .date-month {
    font-size: 1.6rem;
  }

  .date-cell {
    min-height: 54px;
  }

  .time-modal__panel {
    width: min(680px, 96vw);
    padding: 0.85rem;
  }

  .time-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .table-modal {
    padding: 0;
  }

  .table-modal__panel {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 0.55rem;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .table-modal__panel .table-layout {
    width: 96vw !important;
    min-width: 0 !important;
    max-width: 96vw !important;
    height: auto;
    aspect-ratio: 86 / 64;
    margin-inline: auto;
  }

  .table-modal__panel .table-layout.table-layout--terrace {
    width: 96vw !important;
    min-width: 0 !important;
    max-width: 96vw !important;
    aspect-ratio: 86 / 42;
  }
}

@media (max-width: 560px) {
  .table-modal__panel {
    padding: 0.2rem;
    display: grid;
    grid-template-rows: auto auto auto 1fr;
    gap: 0.25rem;
  }

  .table-modal__panel .table-layout {
    width: 98vw !important;
    max-width: 98vw !important;
    height: calc(100dvh - 135px);
    aspect-ratio: auto;
  }

  .table-modal__panel .table-layout.table-layout--terrace {
    width: 98vw !important;
    max-width: 98vw !important;
    height: calc(100dvh - 135px);
    aspect-ratio: auto;
  }

  .table-modal__panel .table-info {
    margin: 0;
    font-size: 0.72rem;
  }

  .table-modal__panel .table-legend {
    display: none;
  }

  .time-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .date-modal__top,
  .time-modal__top,
  .table-modal__top {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-zone-switch,
  .admin-zone-switch {
    flex-wrap: wrap;
  }
}
