/* Mobilný režim mapy stolov – PAX / telefón / kompaktný dotykový PC */

#js-show-tables.tmt-map-scrollable {
  overflow: scroll !important;
  overflow-x: scroll !important;
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  overscroll-behavior: contain;
  width: 100% !important;
  max-width: 100vw !important;
  height: calc(100vh - 60px) !important;
  max-height: calc(100vh - 60px) !important;
  box-sizing: border-box;
  display: block !important;
}

body#smartpos #js-show-tables.tmt-map-scrollable {
  height: calc(100vh - 50px) !important;
  max-height: calc(100vh - 50px) !important;
}

body.tmt-map-scroll-active {
  overflow: hidden !important;
  height: 100%;
  max-height: 100vh;
}

#js-show-tables.tmt-map-scrollable #tablesplace {
  width: 100%;
  min-width: 0;
  padding-bottom: 16px;
}

#js-show-tables.tmt-map-scrollable #tablemap {
  position: relative;
  display: block;
  box-sizing: border-box;
}

#js-show-tables.tmt-map-scrollable #tbmenu,
#js-show-tables.tmt-map-scrollable #tbmenu .tbmitem,
#js-show-tables.tmt-map-scrollable #tablemap-toolbar,
#js-show-tables.tmt-map-scrollable #tablemap-toolbar button,
#js-show-tables.tmt-map-scrollable #tablemap-toolbar input {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

#js-show-tables.tmt-map-scrollable:not(.tmt-edit-tables) #tablemap a.draggable {
  touch-action: manipulation;
}

#tablemap .has-bill:not(.has-bill-true) {
  display: none !important;
}

#js-show-tables.tmt-list-scrollable {
  overflow-x: hidden !important;
}

#tablesplace.tmt-map-scrollable {
  overflow: visible !important;
}

#tablesplace.tmt-list-scrollable {
  overflow-x: hidden !important;
}

/* Upraviť stoly – pravý dolný roh mapy (fixed, neposúva sa so scrollom) */
#switch-box {
  position: fixed !important;
  right: 14px !important;
  bottom: 18px !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  z-index: 650;
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  padding: 0 12px 12px;
  min-width: 0;
}

body:has(.bills) #switch-box {
  bottom: 72px;
}

#switch-box:not(.opened) {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0;
}

#switch-box:not(.opened) > p,
#switch-box:not(.opened) > label,
#switch-box:not(.opened) > #tbmaddtable,
#switch-box:not(.opened) > #tbmsave {
  display: none !important;
}

#switch-box.opened {
  background: #f2144b !important;
  border-radius: 14px;
  max-width: min(220px, calc(100vw - 28px));
}

#switch-box #swb-toggle {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 48px !important;
  height: 48px !important;
  margin-left: auto;
  border-radius: 50% !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  border-bottom-left-radius: 50% !important;
  border-top-left-radius: 50% !important;
  opacity: 1 !important;
  cursor: pointer;
}

#switch-box.opened #swb-toggle {
  margin: 10px 0 8px auto;
}

#switch-box.opened #swb-toggle {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E") !important;
  background-size: 18px !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

#switch-box p {
  margin: 8px auto 6px !important;
  font-size: 14px !important;
}

@media (min-width: 769px) {
  #tablemap-toolbar {
    display: none !important;
  }

  #tablemap.mode-list,
  #tablemap.mode-map {
    min-width: 1000px;
  }

  #tablemap .draggable.tmt-hidden {
    display: block !important;
  }

  #tablemap.tmt-no-results::after {
    content: none !important;
    display: none !important;
  }
}

@media (max-width: 768px) {
  #js-show-tables {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  #js-show-tables.tmt-list-scrollable {
    overflow-x: hidden !important;
  }

  #js-show-tables.tmt-map-scrollable {
    overflow: auto !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    overscroll-behavior: contain;
  }

  #tablesplace {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  #tablesplace.tmt-list-scrollable {
    overflow-x: hidden !important;
  }

  #tablesplace.tmt-map-scrollable {
    overflow: visible !important;
  }

  #tbmenu {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 6px;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 8px 10px 4px !important;
    box-sizing: border-box;
    background: #0e1735 !important;
    text-align: left !important;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    touch-action: pan-x;
  }

  body#smartpos #tbmenu {
    background: transparent !important;
    padding-left: 10px !important;
  }

  #tbmenu::-webkit-scrollbar {
    display: none;
  }

  #tbmenu .tbmitem {
    flex-shrink: 0;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    float: none !important;
    margin: 0 !important;
    transform: none !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    background: rgba(41, 59, 111, 0.85) !important;
    color: rgba(255, 255, 255, 0.88) !important;
    padding: 8px 14px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    min-height: 34px;
    box-sizing: border-box;
  }

  #tbmenu .tbmitem.act,
  #tbmenu .tbmitem.act:hover {
    background: #5f7d3d !important;
    border-color: #7ea74e !important;
    color: #fff !important;
  }

  #tbmenu .tbmitem.has-bill-active {
    padding-right: 28px !important;
  }

  #tablemap-toolbar {
    display: none;
    background: linear-gradient(180deg, #121d3d 0%, #0e1735 100%);
    padding: 8px 12px 6px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  #tablemap-toolbar.tmt-active {
    display: block;
  }

  /* Vyhľadávanie */
  #tablemap-toolbar .tmt-search-wrap {
    position: relative;
    margin-bottom: 8px;
  }

  #tablemap-toolbar .tmt-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    opacity: 0.45;
    pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2318234f' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-4.35-4.35M11 18a7 7 0 100-14 7 7 0 000 14z'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  #tablemap-search {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    padding: 11px 40px 11px 40px;
    font-size: 15px;
    color: #172348;
    background: #fff;
    box-sizing: border-box;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    outline: none;
  }

  #tablemap-search:focus {
    box-shadow: 0 0 0 2px rgba(95, 125, 61, 0.55), 0 2px 12px rgba(0, 0, 0, 0.12);
  }

  #tablemap-search::placeholder {
    color: #8a94a8;
  }

  #tablemap-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: #eef1f7;
    color: #4a5568;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: none;
    transition: background 0.15s ease;
  }

  #tablemap-search-clear:active {
    background: #dde3ef;
  }

  /* Chip filtre – horizontálny scroll */
  #tablemap-toolbar .tmt-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0 4px;
    margin: 0 -2px;
  }

  #tablemap-toolbar .tmt-chips::-webkit-scrollbar {
    display: none;
  }

  #tablemap-toolbar .tmt-chip-sep {
    flex-shrink: 0;
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 2px;
  }

  #tablemap-toolbar .tmt-filter-btn,
  #tablemap-toolbar .tmt-sort-btn {
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: rgba(41, 59, 111, 0.65);
    color: rgba(255, 255, 255, 0.88);
    min-height: 34px;
    line-height: 1.2;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  }

  #tablemap-toolbar .tmt-filter-btn.act,
  #tablemap-toolbar .tmt-sort-btn.act {
    background: #5f7d3d;
    border-color: #7ea74e;
    color: #fff;
  }

  #tablemap-toolbar .tmt-filter-btn:active,
  #tablemap-toolbar .tmt-sort-btn:active {
    transform: scale(0.97);
  }

  #tablemap-toolbar .tmt-meta {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    padding: 6px 2px 2px;
    letter-spacing: 0.02em;
  }

  #js-show-tables {
    min-height: 0;
  }

  /* Grid stolov */
  #tablemap.mode-list {
    min-width: 0 !important;
    min-height: 0 !important;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: min-content;
    gap: 8px;
    padding: 10px 12px 16px;
    box-sizing: border-box;
    position: relative;
    align-items: start;
    touch-action: pan-y;
  }

  #tablemap.mode-list .draggable {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    display: block;
    overflow: hidden;
    margin: 0;
    border-radius: 12px;
    transition: transform 0.12s ease;
  }

  #tablemap.mode-list .draggable:active {
    transform: scale(0.97);
  }

  #tablemap.mode-list .draggable.tmt-hidden {
    display: none !important;
  }

  #tablemap.mode-list .rotateable {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: 64px !important;
    min-height: 64px !important;
    max-height: 64px !important;
    margin: 0;
    display: block;
    box-sizing: border-box;
    padding: 0;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
    transform: none !important;
    -webkit-transform: none !important;
    -moz-transform: none !important;
    overflow: hidden;
  }

  #tablemap.mode-list .hasbill .rotateable {
    border-color: #7ea74e;
    box-shadow: 0 2px 10px rgba(95, 125, 61, 0.25);
  }

  #tablemap.mode-list .mustprint .rotateable {
    border-color: #b7002a;
    box-shadow: 0 2px 10px rgba(183, 0, 42, 0.25);
  }

  #tablemap.mode-list a.act .rotateable {
    outline: 2px solid #fff;
    outline-offset: 1px;
  }

  #tablemap.mode-list .drag {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    padding: 0;
  }

  #tablemap.mode-list .tmt-table-meta {
    position: absolute;
    top: 6px;
    left: 8px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 2px;
    max-width: 42%;
    pointer-events: none;
  }

  #tablemap.mode-list .tablename {
    position: static !important;
    display: block !important;
    width: auto !important;
    font-size: 15px;
    line-height: 1.1;
    margin: 0 !important;
    padding: 0 !important;
    font-weight: 700;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #0d142d !important;
    text-align: left !important;
  }

  #tablemap.mode-list .btbnae {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    z-index: 1;
    display: block !important;
    width: auto !important;
    max-width: 52%;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 600;
    padding: 0 !important;
    opacity: 0.92;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #0d142d !important;
    text-align: center !important;
    pointer-events: none;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
  }

  #tablemap.mode-list .has-bill {
    position: static !important;
    opacity: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important;
    height: 0 !important;
    width: auto !important;
    overflow: hidden;
    display: block !important;
    background: none !important;
    border-radius: 0 !important;
  }

  #tablemap.mode-list .has-bill-true {
    position: static !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    opacity: 1 !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
    color: #2d5016 !important;
    height: auto !important;
    width: auto !important;
    text-align: left !important;
    display: block !important;
    background: transparent !important;
    border-radius: 0 !important;
    pointer-events: none;
  }

  #tablemap.mode-list a.named .tablename {
    display: block !important;
    width: auto !important;
    padding-left: 0 !important;
  }

  #tablemap.mode-list a.named .btbnae {
    display: block !important;
    width: auto !important;
    padding-left: 0 !important;
  }

  #tablemap.mode-list .hasbill:not(.mustprint) .has-bill-true {
    color: #2d5016 !important;
  }

  #tablemap.mode-list .mustprint .has-bill-true {
    color: #8b0020 !important;
  }

  /* Trvanie stola – na mobile skryté */
  #tablemap .time {
    display: block;
    float: left;
    left: -4px;
    transform: scale(0.8);
    bottom: 0px;
    top: unset;
}

  #tablemap.mode-list .billsontable {
    display: none;
  }

  #tablemap.mode-list .rotate,
  #tablemap.mode-list .table-delete {
    display: none !important;
  }

  #tablemap.mode-list.tmt-no-results::after,
  #tablemap.mode-map.tmt-no-results::after {
    content: 'Skúste iný filter alebo vyhľadávanie';
    display: block;
    grid-column: 1 / -1;
    padding: 32px 16px;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    font-size: 13px;
  }

  #tablemap.mode-map .draggable.tmt-hidden {
    display: none !important;
  }

  #tablemap.mode-map {
    min-width: 1000px !important;
    min-height: calc(100vh - 120px);
    width: auto;
    position: relative;
    touch-action: pan-x pan-y;
  }
}
