:root {
    --primary-color: #0d6efd;
    --primary-hover: #0b5ed7;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark-color: #212529;
    --light-color: #f8f9fa;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f5f7fa;
    color: var(--dark-color);
}

/* Навигация */
.navbar {
    background-color: var(--dark-color) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.navbar-brand {
    font-weight: 600;
}

.nav-link {
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

/* Карточки */
.card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(123, 114, 114, 0.42);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    /* Глобальный hover эффект отключен */
}

/* Отключение hover эффекта для карточек с классом no-hover */
.card.no-hover:hover {
    transform: none;
    box-shadow: 0 2px 4px rgba(0,0,0,.05);
}

/* Стили для кликабельных карточек */
.clickable-card {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.clickable-card:hover {
    /* Hover эффект отключен */
}

/* Специальный класс для карточек с hover эффектом */
.card-hoverable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.card-hoverable:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.15) !important;
    border-color: #667eea !important;
}

/* Глобальные стили для Bootstrap tooltips */
.tooltip .tooltip-inner {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #f1f5f9 100%);
    color: #1e293b;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.343);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    position: relative;
    overflow: hidden;
}

.tooltip .tooltip-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(96, 165, 250, 0.25) 0%, transparent 70%),
        radial-gradient(circle at 80% 50%, rgba(167, 139, 250, 0.25) 0%, transparent 70%);
    filter: blur(30px);
    z-index: 0;
    pointer-events: none;
}

.tooltip .tooltip-inner > * {
    position: relative;
    z-index: 1;
}

.tooltip.bs-tooltip-top .tooltip-arrow::before,
.tooltip.bs-tooltip-auto[data-popper-placement^="top"] .tooltip-arrow::before {
    border-top-color: #f8fafc;
}

.tooltip.bs-tooltip-end .tooltip-arrow::before,
.tooltip.bs-tooltip-auto[data-popper-placement^="right"] .tooltip-arrow::before {
    border-right-color: #f8fafc;
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before,
.tooltip.bs-tooltip-auto[data-popper-placement^="bottom"] .tooltip-arrow::before {
    border-bottom-color: #f8fafc;
}

.tooltip.bs-tooltip-start .tooltip-arrow::before,
.tooltip.bs-tooltip-auto[data-popper-placement^="left"] .tooltip-arrow::before {
    border-left-color: #f8fafc;
}

/* Минималистичная иконка info */
.bi-info-circle {
    font-size: 0.9em;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.bi-info-circle:hover {
    opacity: 1;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0,0,0,.05);
    padding: 1rem;
}

/* Кнопки */
.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* Формы */
.form-control {
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25);
}

.input-group-text {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

/* Таблицы */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.table td {
    vertical-align: middle;
}

/* Алерты */
.alert {
    border: none;
    border-radius: 0.375rem;
}

/* Иконки */
.bi {
    vertical-align: -0.125em;
}

/* Секции */
.hero-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e7eb 100%);
    padding: 4rem 0;
    margin-bottom: 2rem;
}

.feature-card {
    background-color: white;
    border-radius: 0.5rem;
    transition: transform 0.2s;
}

.feature-card:hover {
    /* Hover эффект отключен */
}

/* Статистика */
.stats-card {
    background-color: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.stats-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
}

/* Адаптивность */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 0;
    }
    
    .feature-card {
        margin-bottom: 1rem;
    }
}

/* User Profile Styles */
.user-profile-wrapper {
    position: relative;
    margin-left: auto;
}

.user-profile-trigger {
    cursor: pointer;
    padding: 4px;
    transition: all 0.3s ease;
}

.user-profile-trigger:hover {
    transform: scale(1.05);
}

.user-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 2px solid var(--bs-primary);
}

.user-status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #28a745;
    border: 2px solid white;
}

.user-profile-dropdown {
    min-width: 240px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    border: none;
    border-radius: 0.5rem;
}

.user-profile-header {
    padding: 1rem;
    background: linear-gradient(45deg, var(--bs-primary), var(--bs-primary-subtle));
    margin: -0.5rem 0 0.5rem;
    border-radius: 0.5rem 0.5rem 0 0;
}

.user-profile-header .user-info {
    color: white;
}

.user-profile-dropdown .dropdown-item {
    padding: 0.6rem 1rem;
    color: var(--bs-gray-700);
    transition: all 0.2s ease;
}

.user-profile-dropdown .dropdown-item:hover {
    background-color: var(--bs-primary-subtle);
    color: var(--bs-primary);
}

.user-profile-dropdown .dropdown-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.user-profile-dropdown .dropdown-divider {
    margin: 0.5rem 0;
}

.user-profile-dropdown .text-danger:hover {
    background-color: var(--bs-danger-subtle) !important;
    color: var(--bs-danger) !important;
}

/* Только плавная прозрачность для дропдауна пользователя */
#userDropdown + .dropdown-menu.show {
    animation: dropdownFadeInOpacity 0.18s ease-out;
}

@keyframes dropdownFadeInOpacity {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.main-navbar {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(44,62,80,0.04);
    border-bottom: 1px solid #e9ecef;
    min-height: 64px;
    z-index: 100;
}

.navbar-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #22223b;
    letter-spacing: 0.5px;
    font-family: 'Inter', 'Roboto', 'Segoe UI', Arial, sans-serif;
    margin-top: 2px;
}

.user-avatar {
    border-radius: 50%;
    border: 2px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(44,62,80,0.08);
    object-fit: cover;
    background: #fff;
    transition: box-shadow 0.2s;
}
.user-avatar:hover {
    box-shadow: 0 4px 16px rgba(44,62,80,0.16);
}

@media (max-width: 600px) {
    .navbar-title {
        font-size: 1.1rem;
    }
    .main-navbar {
        min-height: 54px;
    }
}

/* --- Стили для модалки с котиком --- */
.custom-danger-modal {
    border-radius: 18px;
    background: #fff;
    color: #222;
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
    border: 2px solid #e74c3c;
}
.custom-danger-modal .modal-title {
    color: #e74c3c;
}
.custom-danger-modal .btn-danger {
    background: #e74c3c;
    border: none;
    color: #fff;
    font-weight: bold;
}
.css-sad-cat {
  display: flex;
  justify-content: center;
  align-items: center;
  animation: cat-shake 0.7s;
}
.cat-ear {
  transform-origin: center bottom;
  transition: transform 0.2s;
}
.cat-ear.left {
  animation: cat-ear-left 1.2s infinite alternate;
}
.cat-ear.right {
  animation: cat-ear-right 1.2s infinite alternate;
}
.cat-tear {
  animation: cat-tear-drop 1.2s infinite;
}
@keyframes cat-shake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
  100% { transform: translateX(0); }
}
@keyframes cat-ear-left {
  0% { transform: rotate(-10deg); }
  100% { transform: rotate(-20deg); }
}
@keyframes cat-ear-right {
  0% { transform: rotate(10deg); }
  100% { transform: rotate(20deg); }
}
@keyframes cat-tear-drop {
  0% { opacity: 0.7; transform: translateY(0); }
  60% { opacity: 1; transform: translateY(8px); }
  100% { opacity: 0; transform: translateY(16px); }
}

/* Кастомный алерт */
/* Удалён дублирующий стиль #customAlertModal .modal-content */
#customAlertModal img {
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
}
#customAlertModal .btn-primary {
    background: #00d0ff;
    border: none;
    color: #222;
    font-weight: bold;
}

/* Стили для модалки с длинным списком гостей */
#customAlertModal .modal-dialog {
    max-height: 90vh;
    margin: 1.75rem auto;
}

#customAlertModal .modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#customAlertModal .modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#customAlertModal #customAlertDetails {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.guest-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 8px;
}
.guest-list-item {
    display: flex;
    align-items: center;
    font-size: 1.08em;
    font-weight: 500;
}
.guest-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e74c3c;
    margin-right: 10px;
}

/* Стили для скроллбара списка гостей */
.guest-list::-webkit-scrollbar {
    width: 6px;
}

.guest-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.guest-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.guest-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Адаптивность для списка гостей */
@media (max-width: 576px) {
    .guest-list {
        max-height: 150px;
        padding-right: 4px;
    }
    
    #customAlertModal .modal-dialog {
        max-height: 95vh;
        margin: 0.5rem auto;
    }
    
    #customAlertModal .modal-content {
        max-height: 95vh;
    }
}

/* Информационные карточки для демо-страницы */
.info-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid rgba(0,0,0,.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color), var(--warning-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.info-card:hover {
    /* Hover эффект отключен */
}

.info-card:hover::before {
    /* Hover эффект отключен */
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(13, 110, 253, 0.1);
    transition: all 0.3s ease;
}

.info-card:nth-child(1) .info-icon {
    background: rgba(13, 110, 253, 0.1);
}

.info-card:nth-child(2) .info-icon {
    background: rgba(25, 135, 84, 0.1);
}

.info-card:nth-child(3) .info-icon {
    background: rgba(255, 193, 7, 0.1);
}

.info-card:hover .info-icon {
    /* Hover эффект отключен */
}

.info-card h6 {
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.info-card p {
    font-size: 1.1rem;
    line-height: 1.2;
}

/* Адаптивность для информационных карточек */
@media (max-width: 576px) {
    .info-card {
        margin-bottom: 1rem;
    }
    
    .info-card p {
        font-size: 1rem;
    }
    
    .info-icon {
        width: 40px;
        height: 40px;
    }
    
    .info-icon i {
        font-size: 1.2rem !important;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .info-card {
        margin-bottom: 0.5rem;
    }
}

/* --- Единый размер карточек гостей в модалке выбора гостя --- */
.sale-guest-tile-wrapper {
    display: flex;
    align-items: stretch;
    height: 100%;
}

.sale-guest-tile {
    min-height: 90px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
                white-space: normal;
            font-size: 1.1rem;
            -webkit-tap-highlight-color: transparent;
            -webkit-touch-callout: none;
            -webkit-user-select: none;
            -khtml-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            touch-action: manipulation;
            transition: all 0.2s ease;
        }

@media (max-width: 576px) {
    .sale-guest-tile {
        min-height: 70px;
                    font-size: 1rem;
        }
    }
    
    /* Улучшенные стили для состояний плиток гостей */
    .sale-guest-tile:active {
        transform: scale(0.98);
        background-color: #000 !important;
        border-color: #000 !important;
        color: #fff !important;
    }
    
    .sale-guest-tile:focus {
        outline: none;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }
    
    .sale-guest-tile:hover {
    background-color: #000 !important;
    border-color: #000 !important;
    color: #fff !important;
}
    
    /* Сброс состояний при закрытии модалки */
    .modal:not(.show) .sale-guest-tile {
        transform: none !important;
        background-color: initial !important;
        border-color: initial !important;
        box-shadow: none !important;
    }
    
    /* Дополнительная защита от залипания состояний */
.sale-guest-tile:not(:focus):not(:active):not(:hover) {
    transform: none !important;
    background-color: initial !important;
    border-color: initial !important;
    box-shadow: none !important;
    color: initial !important;
}
    
    /* Принудительный сброс состояний для мобильных устройств */
    @media (max-width: 768px) {
        .sale-guest-tile {
            -webkit-tap-highlight-color: transparent !important;
            -webkit-touch-callout: none !important;
            touch-action: manipulation !important;
        }
        
        .sale-guest-tile:active {
            transform: scale(0.98) !important;
            transition: transform 0.1s ease !important;
        }
        
        .sale-guest-tile:not(:active) {
            transform: none !important;
            transition: transform 0.1s ease !important;
        }
    }
    
    /* Принудительный сброс всех состояний для модалки гостей */
#saleGuestModal .sale-guest-tile {
    transform: none !important;
    background-color: initial !important;
    border-color: initial !important;
    box-shadow: none !important;
    outline: none !important;
    color: initial !important;
}

#saleGuestModal .sale-guest-tile:not(:active):not(:focus):not(:hover) {
    transform: none !important;
    background-color: initial !important;
    border-color: initial !important;
    box-shadow: none !important;
    outline: none !important;
    color: initial !important;
}

/* Принудительный сброс при открытии модалки */
#saleGuestModal.show .sale-guest-tile {
    transform: none !important;
    background-color: initial !important;
    border-color: initial !important;
    box-shadow: none !important;
    outline: none !important;
    color: initial !important;
}
    
    /* Временное отключение взаимодействий при загрузке */
    #saleGuestModal.loading .sale-guest-tile {
        pointer-events: none !important;
    }
    
    /* Принудительный сброс всех состояний через CSS */
    .sale-guest-tile {
        transition: none !important;
    }
    
    .sale-guest-tile:active {
        transition: transform 0.1s ease !important;
    }
    
    /* Принудительный сброс через CSS переменные */
.sale-guest-tile {
    --reset-transform: none;
    --reset-bg: initial;
    --reset-border: initial;
    --reset-shadow: none;
    --reset-outline: none;
    --reset-color: initial;
}

.sale-guest-tile:not(:active):not(:focus):not(:hover) {
    transform: var(--reset-transform) !important;
    background-color: var(--reset-bg) !important;
    border-color: var(--reset-border) !important;
    box-shadow: var(--reset-shadow) !important;
    outline: var(--reset-outline) !important;
    color: var(--reset-color) !important;
}
    
    /* Принудительный сброс через CSS @supports */
    @supports (transform: none) {
        .sale-guest-tile:not(:active):not(:focus):not(:hover) {
            transform: none !important;
        }
    }
    
    @supports (background-color: initial) {
        .sale-guest-tile:not(:active):not(:focus):not(:hover) {
            background-color: initial !important;
        }
    }
    
    /* Принудительный сброс через CSS @media для мобильных */
@media (max-width: 768px) {
    .sale-guest-tile {
        transform: none !important;
        background-color: initial !important;
        border-color: initial !important;
        box-shadow: none !important;
        outline: none !important;
        color: initial !important;
    }
    
    .sale-guest-tile:active {
        transform: scale(0.98) !important;
        background-color: #000 !important;
        border-color: #000 !important;
        color: #fff !important;
    }
    
    .sale-guest-tile:not(:active) {
        transform: none !important;
        background-color: initial !important;
        border-color: initial !important;
        box-shadow: none !important;
        outline: none !important;
        color: initial !important;
    }
    
    .sale-guest-tile:hover {
        background-color: #000 !important;
        border-color: #000 !important;
        color: #fff !important;
    }
} 

.modal-footer.three-buttons {
  display: flex !important;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}
.modal-footer.three-buttons .btn {
  flex: 1 1 48%;
  min-width: 120px;
  margin: 0;
}
.modal-footer.three-buttons .btn:last-child {
  flex-basis: 100%;
  margin-top: 0;
}

/* Стили для модалки столиков */
.hall-section {
    background: white;
}

.hall-header {
    border-bottom: 1px solid #dee2e6;
}

.hall-canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.table-svg {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.table-svg:hover {
    filter: brightness(1.15) saturate(1.1);
    transform: translateY(-2px) scale(1.02);
}

.table-svg rect,
.table-svg circle {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.table-svg:hover rect,
.table-svg:hover circle {
    stroke-width: 3;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.table-svg:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.1s ease;
}

/* Пульсация для свободных столиков */
.table-svg[data-is-free="true"] {
    animation: tablePulse 2s ease-in-out infinite;
}

@keyframes tablePulse {
    0%, 100% {
        filter: brightness(1.15) saturate(1.1);
    }
    50% {
        filter: brightness(1.25) saturate(1.2);
    }
}

.table-svg[data-is-free="true"]:hover {
    animation: none;
    filter: brightness(1.3) saturate(1.3);
    transform: translateY(-3px) scale(1.03);
}

/* Цвета столиков уже задаются через градиенты в JS, убираем дублирование */

/* Блики на столиках */
.table-svg rect,
.table-svg circle {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Звёздочки для VIP столиков */
.table-svg.vip::before {
    content: "⭐";
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 16px;
    z-index: 10;
}

/* Активные карточки функций */
.feature-card.active {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.125rem rgba(13, 110, 253, 0.25);
}

/* === СОВРЕМЕННАЯ МОДАЛКА СТОЛИКОВ === */

/* Анимации модалки */
.tables-modal-opening .modal-dialog {
    animation: modalSlideUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tables-modal-closing .modal-dialog {
    animation: modalSlideDown 0.3s cubic-bezier(0.55, 0.055, 0.675, 0.19);
}

/* Анимации новой модалки */
.tables-modal-new-opening .modal-dialog {
    animation: modalSlideUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tables-modal-new-closing .modal-dialog {
    animation: modalSlideDown 0.3s cubic-bezier(0.55, 0.055, 0.675, 0.19);
}

@keyframes modalSlideUp {
    0% {
        transform: translate(0, 80px) scale(0.9);
        opacity: 0;
    }
    50% {
        transform: translate(0, -10px) scale(1.02);
        opacity: 0.8;
    }
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
}

@keyframes modalSlideDown {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(0, 50px) scale(0.95);
        opacity: 0;
    }
}

/* Эффект размытия фона */
.tables-modal.show + .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Эффект размытия фона для новой модалки */
.tables-modal-new.show + .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Принудительно убираем блюр со всех backdrop элементов */
.modal-backdrop {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Дополнительная защита от блюра */
.tables-modal-new .modal-backdrop,
.tables-modal-new + .modal-backdrop {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Стили модалки */
.tables-modal-content {
    border: none;
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fb 100%);
}

.tables-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 24px 32px;
    border-radius: 0;
}

.tables-modal-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.tables-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tables-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.tables-modal-body {
    padding: 0;
    background: #ffffff;
}

.tables-layout-container {
    height: 80vh;
    max-height: 80vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #e1e5e9 transparent;
    display: flex;
    flex-direction: column;
}

.tables-layout-container::-webkit-scrollbar {
    width: 8px;
}

.tables-layout-container::-webkit-scrollbar-track {
    background: transparent;
}

.tables-layout-container::-webkit-scrollbar-thumb {
    background: #e1e5e9;
    border-radius: 4px;
}

.tables-layout-container::-webkit-scrollbar-thumb:hover {
    background: #cbd3da;
}

/* Empty state */
.tables-empty-state {
    text-align: center;
    padding: 80px 32px;
    background: linear-gradient(135deg, #f8f9fb 0%, #ffffff 100%);
}

.tables-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

/* Стили залов */
.hall-section {
    margin-bottom: 0;
    background: white;
    border-bottom: 1px solid #f1f3f4;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.hall-section:last-child {
    border-bottom: none;
}

.hall-section:hover {
    background: #fafbfc;
}

.hall-header {
    padding: 24px 32px 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fb 100%);
    border-bottom: 1px solid #f1f3f4;
}

.hall-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.hall-title-wrapper {
    flex: 1;
    min-width: 0;
}

.hall-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}

.hall-stats {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.badge.bg-primary-soft {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 500;
}

.badge.bg-success-soft {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%) !important;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 500;
}

.hall-canvas-wrapper {
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fb 0%, #ffffff 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.hall-zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid #e1e5e9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.hall-header:hover .hall-zoom-controls {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.hall-zoom-level {
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    min-width: 45px;
    text-align: center;
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(108, 117, 125, 0.1);
    transition: all 0.2s ease;
}

.hall-zoom-level.auto-scaled {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    font-weight: 700;
}

.hall-zoom-level.max-scaled {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    font-weight: 700;
    animation: maxScalePulse 2s ease-in-out infinite;
}

.hall-zoom-level.smart-scaled {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 700;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.hall-zoom-level.user-calibrated {
    background: linear-gradient(135deg, #6f42c1, #e83e8c);
    color: white;
    font-weight: 700;
    box-shadow: 0 0 0 2px rgba(111, 66, 193, 0.3);
    animation: userCalibratePulse 3s ease-in-out;
}

.hall-zoom-level.force-scaled {
    background: linear-gradient(135deg, #dc3545, #fd7e14);
    color: white;
    font-weight: 700;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.4);
    animation: forceScalePulse 2s ease-in-out infinite;
}

/* Новые стили для умного зума по столикам */
.hall-zoom-level.tables-scaled {
    background: linear-gradient(135deg, #2980b9, #3498db);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.hall-zoom-level.tables-max-scaled {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.3);
    animation: tablesMaxPulse 3s ease-in-out infinite;
}

.hall-zoom-level.tables-smart-scaled {
    background: linear-gradient(135deg, #16a085, #1abc9c);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(26, 188, 156, 0.3);
}

@keyframes userCalibratePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes forceScalePulse {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.2);
    }
}

@keyframes maxScalePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
    }
}

@keyframes tablesMaxPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(155, 89, 182, 0.3);
    }
    50% {
        box-shadow: 0 2px 8px rgba(155, 89, 182, 0.6), 0 0 0 3px rgba(155, 89, 182, 0.2);
    }
}

/* Новые стили для умного зума по столикам */
.hall-zoom-level.tables-scaled {
    background: linear-gradient(135deg, #2980b9, #3498db);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.hall-zoom-level.tables-max-scaled {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.3);
    animation: tablesMaxPulse 3s ease-in-out infinite;
}

.hall-zoom-level.tables-smart-scaled {
    background: linear-gradient(135deg, #16a085, #1abc9c);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(26, 188, 156, 0.3);
}

@keyframes tablesMaxPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(155, 89, 182, 0.3);
    }
    50% {
        box-shadow: 0 2px 8px rgba(155, 89, 182, 0.6), 0 0 0 3px rgba(155, 89, 182, 0.2);
    }
}

.hall-zoom-controls .btn {
    transition: all 0.2s ease;
}

.hall-zoom-controls .btn:hover {
    transform: scale(1.05);
}

.hall-canvas-container {
    position: relative;
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f3f4;
    overflow: hidden;
    width: calc(100vw - 120px);
    max-width: 1200px;
    height: 70vh;
    max-height: 800px;
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hall-svg {
    border-radius: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fb 100%);
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: grab;
}

.hall-svg:active {
    cursor: grabbing;
}

/* Автоматическое масштабирование для больших залов */
.hall-canvas-container[data-auto-scale="true"] .hall-svg {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

/* Стили для панорамирования */
.hall-canvas-container.panning {
    overflow: auto;
    cursor: grab;
}

.hall-canvas-container.panning:active {
    cursor: grabbing;
}

.hall-canvas-container.panning .table-svg {
    pointer-events: auto;
    cursor: pointer;
}

.hall-canvas-container.panning:active {
    cursor: grabbing;
}

/* Подсказка о панорамировании */
.panning-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Подсказка о новых возможностях зума */
.zoom-hint {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: opacity 0.3s ease;
    max-width: 350px;
    animation: zoomHintSlide 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.zoom-hint-content {
    padding: 12px 16px;
    color: white;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
}

@keyframes zoomHintSlide {
    0% {
        transform: translateY(-10px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.panning-hint i {
    font-size: 1rem;
    animation: panningPulse 2s ease-in-out infinite;
}

@keyframes panningPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* === АДАПТАЦИЯ ДЛЯ СРЕДНИХ ЭКРАНОВ === */
@media (max-width: 1200px) and (min-width: 769px) {
    .hall-zoom-controls {
        padding: 5px 10px;
        gap: 4px;
    }
    
    .hall-zoom-controls .btn {
        padding: 4px 6px;
        font-size: 0.8rem;
    }
    
    .hall-zoom-level {
        font-size: 0.75rem;
        min-width: 42px;
    }
}

/* === МОБИЛЬНАЯ АДАПТАЦИЯ === */

@media (max-width: 768px) {
    .tables-modal-content {
        border-radius: 16px 16px 0 0;
        margin: 0;
        max-height: 100vh;
    }
    
    .tables-modal-header {
        padding: 16px 20px;
    }
    
    .tables-modal-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .hall-canvas-wrapper {
        padding: 16px;
        flex: 1;
    }
    
    .hall-canvas-container {
        padding: 16px;
        width: calc(100vw - 40px);
        max-width: none;
        height: 65vh;
        max-height: 600px;
        min-height: 350px;
    }
    
    .hall-header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .hall-zoom-controls {
        padding: 4px 8px;
        gap: 4px;
        align-self: center;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hall-zoom-controls .btn {
        padding: 3px 6px;
        font-size: 0.7rem;
        min-width: 28px;
    }
    
    .hall-zoom-level {
        font-size: 0.65rem;
        min-width: 35px;
        padding: 1px 3px;
    }
    
    /* Скрываем текст на кнопках для экономии места */
    .hall-zoom-controls .btn span {
        display: none !important;
    }
    
    /* На мобильных устройствах скрываем некоторые кнопки для экономии места */
    .hall-zoom-controls .hall-zoom-calibrate,
    .hall-zoom-controls .hall-zoom-smart,
    .hall-zoom-controls .hall-zoom-force,
    .hall-zoom-controls .hall-reset-pan {
        display: none;
    }
    
    /* Показываем кнопку Авто+ на мобильных */
    .hall-zoom-controls .hall-zoom-auto-plus {
        display: inline-flex !important;
    }
    
    .hall-header {
        padding: 16px 20px 12px;
    }
    
    .hall-name {
        font-size: 1.1rem;
    }
    
    .hall-stats {
        flex-wrap: wrap;
    }
    
    .badge.bg-primary-soft,
    .badge.bg-success-soft {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    .tables-empty-state {
        padding: 40px 20px;
    }
    
    .tables-empty-icon {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    /* Оптимизация столиков для тач-устройств */
    .table-svg {
        touch-action: manipulation;
    }
    
    .table-svg rect,
    .table-svg circle {
        stroke-width: 3; /* Делаем границы толще для лучшей видимости */
    }
    
    /* Улучшенное панорамирование на мобильных */
    .hall-canvas-container.panning {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

/* Уменьшаем анимации для тех кто предпочитает меньше движения */
@media (prefers-reduced-motion: reduce) {
    .table-svg,
    .table-svg rect,
    .table-svg circle,
    .hall-section,
    .tables-modal-content {
        transition: none !important;
        animation: none !important;
    }
    
    .table-svg[data-is-free="true"] {
        animation: none !important;
    }
}

/* Стили для корзины столиков */
.cart-item-tile {
    cursor: pointer;
    transition: all 0.2s ease;
}

.cart-item-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    border-color: var(--bs-primary);
}

.cart-item-tile:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

#cartItemsList .list-group-item {
    border-left: none;
    border-right: none;
    border-top: 1px solid #dee2e6;
}

#cartItemsList .list-group-item:first-child {
    border-top: none;
}

#cartItemsList .list-group-item:last-child {
    border-bottom: none;
}

.btn-group-sm .btn {
    min-width: 32px;
}

/* Ультра-компактный дизайн заказов в модальном окне управления столиком */
#tableManagementModal .modal-body {
    max-height: 80vh;
    overflow: hidden;
    padding: 0.75rem;
}

#tableOrdersList {
    max-height: 30vh;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
}



#tableManagementModal .compact-order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid #f1f3f4;
    background: #fafbfc;
    min-height: 2.5rem;
}

#tableManagementModal .compact-order-item:last-child {
    border-bottom: none;
}

#tableManagementModal .compact-order-item:hover {
    background: #f8f9fa;
}

#tableManagementModal .order-details {
    flex: 1;
    min-width: 0;
    line-height: 1.2;
}

#tableManagementModal .order-name {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.1rem;
    line-height: 1.2;
}

#tableManagementModal .order-price {
    font-size: 0.7rem;
    color: #6c757d;
    line-height: 1.1;
}

#tableManagementModal .order-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

#tableManagementModal .quantity-display {
    background: #e9ecef;
    border: 1px solid #ced4da;
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
    min-width: 30px;
    text-align: center;
    border-radius: 0;
}

#tableManagementModal .order-total {
    font-weight: 600;
    font-size: 0.8rem;
    color: #198754;
    min-width: 60px;
    text-align: right;
}

#tableManagementModal .btn-group .btn-sm {
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
    border-radius: 0;
    line-height: 1;
}

#tableManagementModal .btn-group .btn-sm:first-child {
    border-top-left-radius: 0.2rem;
    border-bottom-left-radius: 0.2rem;
}

#tableManagementModal .btn-group .btn-sm:last-child {
    border-top-right-radius: 0.2rem;
    border-bottom-right-radius: 0.2rem;
}

/* Мобильная адаптация модального окна управления столиком */
@media (max-width: 768px) {
    #tableManagementModal .modal-body {
        max-height: 85vh;
        padding: 0.5rem;
    }
    
    #tableOrdersList {
        max-height: 35vh;
    }
    
    #tableManagementModal .compact-order-item {
        padding: 0.3rem 0.4rem;
        min-height: 2.2rem;
    }
    
    #tableManagementModal .order-name {
        font-size: 0.8rem;
    }
    
    #tableManagementModal .order-price {
        font-size: 0.65rem;
    }
    
    #tableManagementModal .order-controls {
        gap: 0.4rem;
    }
    
    #tableManagementModal .quantity-display {
        padding: 0.15rem 0.3rem;
        font-size: 0.75rem;
        min-width: 28px;
    }
    
    #tableManagementModal .order-total {
        font-size: 0.75rem;
        min-width: 55px;
    }
    
    #tableManagementModal .btn-group .btn-sm {
        padding: 0.15rem 0.3rem;
        font-size: 0.75rem;
    }
    
    #tableManagementModal .row.mb-2 {
        margin-bottom: 0.5rem !important;
    }
}

@media (max-width: 576px) {
    #tableManagementModal .modal-dialog {
        margin: 0.25rem;
    }
    
    #tableManagementModal .modal-body {
        max-height: 90vh;
        padding: 0.4rem;
    }
    
    #tableOrdersList {
        max-height: 40vh;
    }
    
    #tableManagementModal .compact-order-item {
        padding: 0.25rem 0.3rem;
        min-height: 2rem;
    }
    
    #tableManagementModal .order-name {
        font-size: 0.75rem;
        margin-bottom: 0.05rem;
    }
    
    #tableManagementModal .order-price {
        font-size: 0.6rem;
    }
    
    #tableManagementModal .order-controls {
        gap: 0.3rem;
    }
    
    #tableManagementModal .quantity-display {
        padding: 0.1rem 0.25rem;
        font-size: 0.7rem;
        min-width: 25px;
    }
    
    #tableManagementModal .order-total {
        font-size: 0.7rem;
        min-width: 50px;
    }
    
    #tableManagementModal .btn-group .btn-sm {
        padding: 0.1rem 0.25rem;
        font-size: 0.7rem;
    }
}



/* Кастомный скроллбар для списка заказов */
#tableOrdersList::-webkit-scrollbar {
    width: 6px;
}

#tableOrdersList::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#tableOrdersList::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#tableOrdersList::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Оптимизация модального окна корзины товаров */
#tablesCartModal .modal-dialog {
    max-width: 90vw;
    width: 90vw;
}

#tablesCartModal .modal-body {
    max-height: 75vh;
    overflow: hidden;
}

#tablesCartModal .items-container {
    height: 65vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

#tablesCartModal .cart-panel {
    display: flex;
    flex-direction: column;
    height: 65vh;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fafbfc;
}

#tablesCartModal .cart-header {
    padding: 0.75rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 0.375rem 0.375rem 0 0;
}

#tablesCartModal .cart-body {
    flex: 1;
    overflow: hidden;
}

#tablesCartModal .cart-items-list {
    height: 100%;
    overflow-y: auto;
    padding: 0;
}

#tablesCartModal .cart-footer {
    padding: 0.75rem;
    background: #fff;
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 0.375rem 0.375rem;
}

#tablesCartModal .cart-total {
    text-align: center;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: #e7f3ff;
    border-radius: 0.25rem;
    border: 1px solid #b8daff;
}

#tablesCartModal .cart-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

#tablesCartModal .cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    padding: 2rem;
}

#tablesCartModal .cart-empty i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

#tablesCartModal .cart-empty small {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Компактные карточки товаров в корзине */
#tablesCartModal .cart-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f1f3f4;
    background: #fff;
}

#tablesCartModal .cart-item:last-child {
    border-bottom: none;
}

#tablesCartModal .cart-item:hover {
    background: #f8f9fa;
}

#tablesCartModal .cart-item-info {
    flex: 1;
    min-width: 0;
}

#tablesCartModal .cart-item-name {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
    line-height: 1.3;
}

#tablesCartModal .cart-item-price {
    font-size: 0.75rem;
    color: #6c757d;
}

#tablesCartModal .cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

#tablesCartModal .cart-quantity-controls {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 0.25rem;
    border: 1px solid #dee2e6;
}

#tablesCartModal .cart-quantity-controls button {
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    color: #495057;
    cursor: pointer;
}

#tablesCartModal .cart-quantity-controls button:hover {
    background: #e9ecef;
}

#tablesCartModal .cart-quantity-controls span {
    padding: 0.25rem 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    min-width: 30px;
    text-align: center;
    border-left: 1px solid #dee2e6;
    border-right: 1px solid #dee2e6;
}

#tablesCartModal .cart-item-total {
    font-weight: 600;
    font-size: 0.875rem;
    color: #198754;
    min-width: 60px;
    text-align: right;
}

/* Кастомный скроллбар для списка товаров и корзины */
#tablesCartModal .items-container::-webkit-scrollbar,
#tablesCartModal .cart-items-list::-webkit-scrollbar {
    width: 6px;
}

#tablesCartModal .items-container::-webkit-scrollbar-track,
#tablesCartModal .cart-items-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#tablesCartModal .items-container::-webkit-scrollbar-thumb,
#tablesCartModal .cart-items-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#tablesCartModal .items-container::-webkit-scrollbar-thumb:hover,
#tablesCartModal .cart-items-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Адаптивность корзины для планшетов */
@media (max-width: 992px) {
    #tablesCartModal .modal-dialog {
        max-width: 95vw;
        width: 95vw;
        margin: 0.5rem auto;
    }
    
    #tablesCartModal .modal-body {
        max-height: 90vh;
        padding: 1rem;
    }
    
    #tablesCartModal .items-container {
        height: 50vh;
        margin-bottom: 1rem;
    }
    
    #tablesCartModal .cart-panel {
        height: 35vh;
    }
    
    #tablesCartModal .row {
        flex-direction: column;
    }
    
    #tablesCartModal .col-lg-8,
    #tablesCartModal .col-lg-4 {
        width: 100%;
        max-width: none;
    }
    
    /* Товары в 4 колонки на больших планшетах */
    #tablesCartModal .items-container .col-md-4 {
        flex: 0 0 25%;
        max-width: 25%;
        padding: 0.375rem;
    }
    
    #tablesCartModal .cart-product-tile {
        height: 130px;
    }
    
    #tablesCartModal .cart-product-image {
        height: 75px;
    }
}

/* Улучшенная мобильная адаптация корзины для планшетов */
@media (max-width: 768px) {
    #tablesCartModal .modal-dialog {
        max-width: 98vw;
        width: 98vw;
        margin: 0.2rem auto;
    }
    
    #tablesCartModal .modal-body {
        padding: 0.75rem;
        max-height: 95vh;
        overflow: hidden;
    }
    
    #tablesCartModal .items-container {
        height: 45vh;
        margin-bottom: 1rem;
    }
    
    #tablesCartModal .cart-panel {
        height: 40vh;
    }
    
    /* Товары в 3 колонки на планшетах */
    #tablesCartModal .items-container .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
    
    #tablesCartModal .cart-product-tile {
        height: 120px;
        margin-bottom: 0.5rem;
    }
    
    #tablesCartModal .cart-product-image {
        height: 70px;
    }
    
    #tablesCartModal .cart-product-name {
        font-size: 0.75rem;
        line-height: 1.2;
    }
    
    #tablesCartModal .cart-product-price {
        font-size: 0.75rem;
    }
    
    #tablesCartModal .cart-product-stock {
        font-size: 0.65rem;
    }
}

@media (max-width: 991px) {
    #tablesCartModal .modal-dialog {
        max-width: 100vw;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    #tablesCartModal .modal-content {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
        display: flex;
        flex-direction: column;
    }
    
    #tablesCartModal .modal-header {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #dee2e6;
        flex-shrink: 0;
    }
    
    #tablesCartModal .modal-body {
        padding: 0.75rem;
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        min-height: 0;
        height: 100%;
    }
    
    /* Поиск на мобильных */
    #tablesCartModal .search-header {
        padding: 0.5rem 0;
        margin-bottom: 0.5rem;
        flex-shrink: 0;
    }
    
    #tablesCartModal .search-header input {
        border-radius: 8px;
        font-size: 1rem;
        padding: 0.75rem;
    }
    
    /* Категории на мобильных */
    #tablesCartModal .categories-filter-mobile {
        flex-shrink: 0;
        margin-bottom: 0.5rem;
    }
    
    #tablesCartModal .categories-filter-mobile .btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Контейнер товаров на всю высоту с скроллом */
    #tablesCartModal .items-container-mobile {
        flex: 1 1 auto;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        max-height: none;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    /* Стили скроллбара для контейнера товаров */
    #tablesCartModal .items-container-mobile::-webkit-scrollbar {
        width: 6px;
    }
    
    #tablesCartModal .items-container-mobile::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }
    
    #tablesCartModal .items-container-mobile::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 3px;
    }
    
    #tablesCartModal .items-container-mobile::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }
    
    /* Адаптивная сетка: 1 столбик на очень маленьких, 2 на маленьких, 3 на средних */
    #tablesCartModal .items-container-mobile .col-12,
    #tablesCartModal .items-container-mobile .col-sm-6,
    #tablesCartModal .items-container-mobile .col-md-4 {
        padding: 0.25rem;
    }
    
    /* Футер с кнопками - всегда видимый */
    #tablesCartModal .mobile-cart-footer {
        padding: 0.75rem;
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid #dee2e6;
        flex-shrink: 0;
        position: relative;
        z-index: 10;
        margin-top: 0;
    }
    
    /* Убеждаемся что modal-body правильно распределяет пространство */
    #tablesCartModal .modal-body > .d-lg-none {
        display: flex !important;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        flex: 1;
    }
    
    #tablesCartModal .mobile-cart-footer .btn {
        min-height: 48px;
        font-size: 1rem;
        font-weight: 600;
    }
    
    /* Скрываем вкладки */
    #tablesCartModal .mobile-tabs-container {
        display: none !important;
    }
    
    #tablesCartModal .tab-content {
        display: none !important;
    }
    
    /* Адаптивная сетка товаров - Bootstrap классы работают автоматически */
    /* col-12 = 1 столбик на всех экранах */
    /* col-sm-6 = 2 столбика на экранах >= 576px */
    /* col-md-4 = 3 столбика на экранах >= 768px */
    
    /* Убеждаемся что Bootstrap классы применяются правильно */
    #tablesCartModal .items-container-mobile .row {
        display: flex;
        flex-wrap: wrap;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }
    
    #tablesCartModal .items-container-mobile .col-12 {
        flex: 0 0 100%;
        max-width: 100%;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    
    @media (min-width: 576px) {
        #tablesCartModal .items-container-mobile .col-sm-6 {
            flex: 0 0 50% !important;
            max-width: 50% !important;
            padding-left: 0.25rem;
            padding-right: 0.25rem;
        }
    }
    
    @media (min-width: 768px) {
        #tablesCartModal .items-container-mobile .col-md-4 {
            flex: 0 0 33.333333% !important;
            max-width: 33.333333% !important;
            padding-left: 0.25rem;
            padding-right: 0.25rem;
        }
    }
    
    #tablesCartModal .cart-product-tile {
        height: 100px;
        margin-bottom: 0.25rem;
    }
    
    #tablesCartModal .cart-product-image {
        height: 55px;
    }
    
    #tablesCartModal .cart-product-info {
        padding: 0.375rem;
    }
    
    #tablesCartModal .cart-product-name {
        font-size: 0.7rem;
        line-height: 1.1;
        margin-bottom: 0.125rem;
    }
    
    #tablesCartModal .cart-product-price {
        font-size: 0.7rem;
        font-weight: 600;
    }
    
    #tablesCartModal .cart-product-stock {
        font-size: 0.6rem;
    }
    
    #tablesCartModal .cart-product-no-image i {
        font-size: 1.2rem;
    }
    
    /* Оптимизация корзины на мобильных */
    #tablesCartModal .cart-header {
        padding: 0.5rem;
    }
    
    #tablesCartModal .cart-header h6 {
        font-size: 0.9rem;
        margin: 0;
    }
    
    #tablesCartModal .cart-item {
        padding: 0.5rem;
        border-bottom: 1px solid #f1f3f4;
    }
    
    #tablesCartModal .cart-item-name {
        font-size: 0.75rem;
        line-height: 1.2;
        margin-bottom: 0.125rem;
    }
    
    #tablesCartModal .cart-item-price {
        font-size: 0.65rem;
    }
    
    #tablesCartModal .cart-quantity-controls {
        background: #f8f9fa;
        border-radius: 0.25rem;
    }
    
    #tablesCartModal .cart-quantity-controls button,
    #tablesCartModal .cart-quantity-controls span {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        min-width: 30px;
    }
    
    #tablesCartModal .cart-item-total {
        font-size: 0.75rem;
        font-weight: 600;
        min-width: 45px;
    }
    
    #tablesCartModal .cart-footer {
        padding: 0.5rem;
    }
    
    #tablesCartModal .cart-total {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
    }
    
    #tablesCartModal .cart-buttons {
        gap: 0.375rem;
    }
    
    #tablesCartModal .cart-buttons .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        font-weight: 600;
        min-height: 48px;
    }

    /* Безопасная зона снизу для жестовой навигации */
    #tablesCartModal .modal-content {
        padding-bottom: env(safe-area-inset-bottom, 16px);
    }
}

/* Дополнительная оптимизация для экстра маленьких экранов */
@media (max-width: 430px) {
    #tablesCartModal .cart-footer {
        padding: 0.375rem;
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }
    
    #tablesCartModal .cart-total {
        padding: 0.375rem;
        margin-bottom: 0.375rem;
        font-size: 0.85rem;
    }
    
    #tablesCartModal .cart-buttons {
        gap: 0.25rem;
    }
    
    #tablesCartModal .cart-buttons .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
        font-weight: 600;
        min-height: 44px;
    }
    
    /* Оптимизация планшетной версии для мобильных */
    .cart-footer {
        padding: 0.375rem !important;
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom)) !important;
    }
    
    .cart-buttons {
        gap: 0.25rem !important;
    }
    
    .cart-buttons .btn {
        padding: 0.5rem 0.875rem !important;
        font-size: 0.8rem !important;
        min-height: 44px !important;
    }
}

/* Оптимизация для очень маленьких экранов */
@media (max-width: 375px) {
    #tablesCartModal .cart-footer {
        padding: 0.25rem;
        padding-bottom: max(0.625rem, env(safe-area-inset-bottom));
    }
    
    #tablesCartModal .cart-total {
        padding: 0.25rem;
        margin-bottom: 0.25rem;
        font-size: 0.8rem;
    }
    
    #tablesCartModal .cart-buttons .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
        min-height: 40px;
    }
    
    /* Дополнительная оптимизация для планшетной версии */
    .cart-footer {
        padding: 0.25rem !important;
        padding-bottom: max(1rem, env(safe-area-inset-bottom)) !important;
    }
    
    .cart-buttons .btn {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.75rem !important;
        min-height: 40px !important;
    }
}

/* Оптимизация для устройств с маленькой высотой экрана */
@media (max-height: 667px) {
    .smartphone-modal-footer {
        padding: 0.75rem 0.5rem;
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
    
    .smartphone-cart-summary {
        margin-bottom: 0.5rem;
        padding: 0.5rem;
    }
    
    .smartphone-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
        min-height: 40px;
    }
    
    .smartphone-cart-buttons {
        gap: 0.25rem;
        margin-bottom: 0.75rem;
    }
}

/* Дополнительная оптимизация для очень маленькой высоты */
@media (max-height: 600px) {
    .smartphone-modal-footer {
        padding: 0.5rem 0.375rem;
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
    }
    
    .smartphone-cart-summary {
        margin-bottom: 0.375rem;
        padding: 0.375rem;
        flex-direction: column;
        gap: 0.125rem;
        text-align: center;
    }
    
    .smartphone-cart-total,
    .smartphone-cart-count {
        font-size: 0.8rem;
    }
    
    .smartphone-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
        min-height: 38px;
    }
    
    .smartphone-cart-buttons {
        gap: 0.2rem;
        margin-bottom: 0.5rem;
    }
}

/* Комбинированная оптимизация для маленькой ширины и высоты */
@media (max-width: 430px) and (max-height: 667px) {
    .smartphone-modal-footer {
        padding: 0.375rem 0.5rem;
        padding-bottom: max(1.75rem, env(safe-area-inset-bottom));
    }
    
    .smartphone-cart-summary {
        margin-bottom: 0.25rem;
        padding: 0.25rem;
        flex-direction: row;
        gap: 0.375rem;
        text-align: left;
    }
    
    .smartphone-cart-total {
        font-size: 0.85rem;
    }
    
    .smartphone-cart-count {
        font-size: 0.75rem;
    }
    
    .smartphone-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        min-height: 40px;
    }
    
    .smartphone-cart-buttons {
        gap: 0.25rem;
        margin-bottom: 0.75rem;
    }
}

/* Критическая оптимизация для экстремально маленьких экранов */
@media (max-width: 375px) and (max-height: 600px) {
    .smartphone-modal-footer {
        padding: 0.25rem 0.375rem;
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
    
    .smartphone-cart-summary {
        margin-bottom: 0.125rem;
        padding: 0.125rem;
        flex-direction: column;
        gap: 0.0625rem;
        text-align: center;
    }
    
    .smartphone-cart-total,
    .smartphone-cart-count {
        font-size: 0.75rem;
    }
    
    .smartphone-btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
        min-height: 36px;
    }
    
    .smartphone-cart-buttons {
        gap: 0.2rem;
        margin-bottom: 0.5rem;
    }
}

/* ============ ЗАЩИТА ОТ GHOST CLICKS ============ */

/* Стили для временного overlay, блокирующего ghost clicks */
.ghost-click-blocker {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    pointer-events: auto !important;
    background: transparent !important;
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* ============ МОБИЛЬНАЯ МОДАЛКА СТОЛИКОВ ============ */

/* Модалка столиков для смартфонов */
.smartphone-tables-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: none;
    background: #000;
}

.smartphone-tables-modal.show {
    display: block;
}

.smartphone-tables-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.smartphone-tables-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 100vh;
    max-height: 100vh;
}

/* Заголовок */
.smartphone-tables-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.smartphone-tables-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: #212529;
}

.smartphone-tables-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.smartphone-tables-close:hover {
    background: #f8f9fa;
    color: #495057;
}

.smartphone-tables-close:active {
    background: #e9ecef;
    color: #495057;
}

/* Фильтры */
.smartphone-tables-filters {
    padding: 1rem;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.smartphone-tables-filters .form-select {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
}

.smartphone-tables-filters .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.smartphone-tables-filters .form-label {
    color: #495057;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.smartphone-tables-filters .form-label i {
    font-size: 1rem;
}

.smartphone-filter-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    color: #495057;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.smartphone-filter-btn.active {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
}

.smartphone-filter-btn:not(.active):hover {
    background: #f8f9fa;
    border-color: #0d6efd;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* Контент со списком столиков */
.smartphone-tables-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.smartphone-tables-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: opacity 0.2s ease;
}

.smartphone-table-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.smartphone-table-item:hover {
    background: #f8f9fa;
    border-color: #0d6efd;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.smartphone-table-item:active {
    transform: scale(0.98);
}

.smartphone-table-item.occupied {
    border-left: 4px solid #dc3545;
}

.smartphone-table-item.free {
    border-left: 4px solid #198754;
}

.table-info {
    flex: 1;
}

.table-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.25rem;
}

.table-hall {
    font-size: 0.75rem;
    color: #6c757d;
    background: #f8f9fa;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    display: inline-block;
    font-weight: 500;
}

.table-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
    font-size: 0.875rem;
}

.smartphone-table-item.occupied .table-status {
    color: #dc3545;
}

.smartphone-table-item.free .table-status {
    color: #198754;
}

/* Пустое состояние */
.smartphone-tables-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: #6c757d;
    text-align: center;
}

.smartphone-tables-empty i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.smartphone-tables-empty p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Футер со статистикой */
.smartphone-tables-footer {
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    flex-shrink: 0;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.smartphone-tables-stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
}

/* Анимация появления модалки */
@keyframes smartphoneTablesSlideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.smartphone-tables-modal.show .smartphone-tables-container {
    animation: smartphoneTablesSlideUp 0.3s ease-out;
}

/* Оптимизация для экстра маленьких экранов */
@media (max-width: 375px) {
    .smartphone-tables-header {
        padding: 0.75rem;
    }
    
    .smartphone-tables-filters {
        padding: 0.75rem;
    }
    
    .smartphone-tables-content {
        padding: 0.25rem;
    }
    
    .smartphone-table-item {
        padding: 0.75rem;
    }
    
    .table-name {
        font-size: 1rem;
    }
    
    .smartphone-tables-footer {
        padding: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.1rem;
    }
}

/* ============ СМАРТФОННАЯ МОДАЛКА (без Bootstrap) ============ */

/* Модалка для смартфонов */
.smartphone-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: none;
    background: #000;
}

.smartphone-modal.show {
    display: block;
}

.smartphone-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.smartphone-modal-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Обеспечиваем правильное отображение на мобильных устройствах */
    min-height: 100vh;
    max-height: 100vh;
}

/* Заголовок */
.smartphone-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.smartphone-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: #212529;
}

.smartphone-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.smartphone-modal-close:active {
    background: #e9ecef;
    color: #495057;
}

/* Поиск */
.smartphone-search {
    padding: 0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.smartphone-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    font-size: 1rem;
    background: #f8f9fa;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.smartphone-search-input:focus {
    outline: none;
    border-color: #007bff;
    background: #fff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Контейнер товаров */
.smartphone-items-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    background: #f8f9fa;
}

.smartphone-items-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
}

/* Компактные горизонтальные карточки товаров */
.smartphone-product-tile-compact {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 0.75rem;
    gap: 0.75rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.smartphone-product-tile-compact:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.smartphone-product-image-compact {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smartphone-product-image-compact img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.smartphone-product-no-image-compact {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    background: #f8f9fa;
}

.smartphone-product-no-image-compact i {
    font-size: 1.5rem;
}

.smartphone-product-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #0d6efd;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.smartphone-product-info-compact {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.smartphone-product-name-compact {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.3;
    color: #212529;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.smartphone-product-price-compact {
    font-size: 0.95rem;
    font-weight: 600;
    color: #198754;
    margin: 0;
}

.smartphone-product-stock-compact {
    font-size: 0.7rem;
    color: #6c757d;
    margin: 0;
}

.smartphone-product-actions-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.smartphone-btn-action {
    border: none;
    border-radius: 8px;
    padding: 0.5rem;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.smartphone-btn-action:active {
    transform: scale(0.95);
}

.smartphone-btn-add {
    background: #0d6efd;
    color: #fff;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    min-width: auto;
}

.smartphone-btn-add:hover {
    background: #0b5ed7;
}

.smartphone-btn-add.disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.smartphone-btn-minus {
    background: #dc3545;
    color: #fff;
}

.smartphone-btn-minus:hover {
    background: #bb2d3b;
}

.smartphone-btn-plus {
    background: #198754;
    color: #fff;
}

.smartphone-btn-plus:hover {
    background: #157347;
}

.smartphone-btn-plus.disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.smartphone-quantity-display {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: #212529;
}

/* Для планшетов - можно показать 2 колонки */
@media (min-width: 768px) and (max-width: 1024px) {
    .smartphone-items-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .smartphone-product-tile-compact {
        padding: 1rem;
    }
    
    .smartphone-product-image-compact {
        width: 80px;
        height: 80px;
    }
}

/* Плитки товаров для смартфонов */
    .smartphone-product-tile {
        background: #fff;
        border-radius: 8px;
        border: 1px solid #e9ecef;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.2s ease;
        position: relative;
        height: 140px;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        touch-action: manipulation;
    }

    .smartphone-product-tile:active {
        transform: scale(0.98);
        background: #f8f9fa;
    }
    
    .smartphone-product-tile:hover {
        background: #f8f9fa;
        border-color: #007bff;
    }

.smartphone-product-image {
    height: 80px;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smartphone-product-no-image {
    background: #f8f9fa;
    color: #6c757d;
}

.smartphone-product-no-image i {
    font-size: 1.5rem;
}

/* Счетчик товаров на изображении */
.smartphone-product-counter {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: #007bff;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.smartphone-product-counter.hidden {
    display: none;
}

.smartphone-product-info {
    padding: 0.5rem;
    height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.smartphone-product-name {
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.2;
    color: #212529;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.smartphone-product-price-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.smartphone-product-price {
    font-size: 0.8rem;
    font-weight: 600;
    color: #198754;
}

.smartphone-product-stock {
    font-size: 0.65rem;
    color: #6c757d;
}

/* Футер */
.smartphone-modal-footer {
    padding: 0.75rem 1rem;
    background: #fff;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
    /* Добавляем безопасную зону снизу для жестовой навигации */
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

.smartphone-cart-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: #e7f3ff;
    border-radius: 8px;
    border: 1px solid #b8daff;
}

.smartphone-cart-total {
    font-size: 1rem;
    font-weight: 600;
    color: #0d6efd;
}

.smartphone-cart-count {
    font-size: 0.9rem;
    color: #6c757d;
}

.smartphone-cart-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.smartphone-btn {
    padding: 0.875rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.smartphone-btn:active {
    transform: scale(0.98);
}

.smartphone-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.smartphone-btn:disabled:active {
    transform: none;
}

.smartphone-btn-success {
    background: #198754;
    color: #fff;
}

.smartphone-btn-success:active:not(:disabled) {
    background: #157347;
}

.smartphone-btn-secondary {
    background: #6c757d;
    color: #fff;
}

.smartphone-btn-secondary:active:not(:disabled) {
    background: #5a6268;
}

/* Кастомный скроллбар для смартфонов */
.smartphone-items-container::-webkit-scrollbar {
    width: 4px;
}

.smartphone-items-container::-webkit-scrollbar-track {
    background: transparent;
}

.smartphone-items-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.smartphone-items-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Анимация появления */
@keyframes smartphoneModalSlideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.smartphone-modal.show .smartphone-modal-container {
    animation: smartphoneModalSlideUp 0.3s ease-out;
}

/* Оптимизация для экстра маленьких экранов (реальные мобильные устройства) */
@media (max-width: 430px) {
    .smartphone-modal-footer {
        padding: 0.5rem 0.75rem;
        padding-bottom: max(1.75rem, env(safe-area-inset-bottom));
    }
    
    .smartphone-cart-summary {
        margin-bottom: 0.375rem;
        padding: 0.375rem;
    }
    
    .smartphone-cart-total {
        font-size: 0.9rem;
    }
    
    .smartphone-cart-count {
        font-size: 0.8rem;
    }
    
    .smartphone-btn {
        padding: 0.75rem 0.875rem;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    .smartphone-cart-buttons {
        gap: 0.375rem;
        margin-bottom: 1rem;
    }
}

/* Дополнительная оптимизация для очень маленьких экранов */
@media (max-width: 375px) {
    .smartphone-modal-footer {
        padding: 0.375rem 0.5rem;
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }
    
    .smartphone-cart-summary {
        margin-bottom: 0.25rem;
        padding: 0.25rem;
        flex-direction: column;
        gap: 0.125rem;
        text-align: center;
    }
    
    .smartphone-cart-total {
        font-size: 0.85rem;
    }
    
    .smartphone-cart-count {
        font-size: 0.75rem;
    }
    
    .smartphone-btn {
        padding: 0.625rem 0.75rem;
        font-size: 0.85rem;
        min-height: 42px;
    }
    
    .smartphone-cart-buttons {
        gap: 0.25rem;
        margin-bottom: 0.75rem;
    }
}

/* Компактные карточки товаров в корзине */
#tablesCartModal .cart-product-tile {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 160px;
}

#tablesCartModal .cart-product-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #007bff;
}

#tablesCartModal .cart-product-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#tablesCartModal .cart-product-image {
    height: 110px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

#tablesCartModal .cart-product-no-image {
    background: #f8f9fa;
    color: #adb5bd;
}

#tablesCartModal .cart-product-no-image i {
    font-size: 2rem;
}

#tablesCartModal .cart-product-info {
    padding: 0.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#tablesCartModal .cart-product-name {
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.2;
    color: #212529;
    margin-bottom: 0.125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tablesCartModal .cart-product-price-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#tablesCartModal .cart-product-price {
    font-weight: 600;
    font-size: 0.875rem;
    color: #198754;
}

#tablesCartModal .cart-product-stock {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Кастомный скроллбар для списка заказов */
#tableOrdersList::-webkit-scrollbar {
    width: 6px;
}

#tableOrdersList::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#tableOrdersList::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#tableOrdersList::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.tables-modal-new .modal-dialog {
    max-width: 95vw;
}

.tables-modal-content-new {
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    border-radius: 16px;
    overflow: hidden;
}

.tables-modal-header-new {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.5rem;
}
/* Компактная версия шапки на узких экранах */
@media (max-width: 768px) {
  .tables-modal-header-new .form-select {
    max-width: 60vw;
  }
}

.tables-modal-icon-new {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.tables-modal-body-new {
    background: #ffffff;
    min-height: 60vh;
}

/* Фильтры столиков (теперь в шапке модального окна) */

.tables-filter-btn {
    transition: all 0.2s ease;
    border-width: 1px;
    font-weight: 500;
}

.tables-filter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* Панель плана ресторана */
.tables-layout-panel {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid #e9ecef;
    height: fit-content;
}

.tables-layout-container-new {
    min-height: 55vh;
    max-height: 70vh;
    overflow-y: auto;
}

.hall-section-new {
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.hall-section-new:nth-child(2) { animation-delay: 0.1s; }
.hall-section-new:nth-child(3) { animation-delay: 0.2s; }
.hall-section-new:nth-child(4) { animation-delay: 0.3s; }

.hall-header-new h6 {
    color: #495057;
}

/* Не перекрывать зал: делаем явный отступ между шапкой и холстом */
.hall-header-new {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* расстояние между строкой заголовка и контролами */
    margin-bottom: 0.75rem; /* отступ от шапки до холста */
}

.hall-header-new .hall-zoom-controls {
    flex-wrap: wrap;
}

.hall-canvas-wrapper-new {
    position: relative;
}

.hall-canvas-container-new {
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
}

.hall-svg-new {
    transition: all 0.3s ease;
    display: block;
}

/* Столики - новый дизайн */
.table-svg-new {
    transition: all 0.2s ease;
    cursor: pointer !important;
    pointer-events: auto !important;
}

.table-svg-new:hover {
    stroke-width: 4 !important;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3)) !important;
}

.table-svg-new.selected {
    stroke: #007bff !important;
    stroke-width: 5 !important;
    filter: drop-shadow(0 4px 12px rgba(0,123,255,0.3)) !important;
    animation: tablePulseNew 2s infinite;
}

.table-free {
    fill: #28a745 !important;
}

.table-occupied {
    fill: #dc3545 !important;
}

.table-bar-seat {
    fill: #6c757d !important;
}

/* Боковая панель */
.tables-sidebar {
    height: fit-content;
}

/* Hall Info Panel (заменил table-info-panel) */
.hall-info-panel {
    background: white;
    border-radius: 12px;
    padding: 1.2rem; /* Уменьшил с 1.5rem до 1.2rem */
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    height: fit-content;
    min-height: 200px; /* Минимальная высота для выравнивания */
}

.hall-stats-content {
    animation: fadeIn 0.4s ease;
}

.occupancy-overview {
    padding: 0.8rem; /* Уменьшил с 1rem до 0.8rem */
    background: rgba(0,0,0,0.02);
    border-radius: 12px;
    margin-bottom: 0.8rem; /* Уменьшил с 1rem до 0.8rem */
}

.occupancy-circle {
    position: relative;
}

.stat-item {
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stats-grid .stat-item {
    border-radius: 8px;
}

/* Анимации для статистики */
@keyframes statCountUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.stat-item .fw-bold {
    animation: statCountUp 0.5s ease;
}

.info-item i {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.info-item .fw-medium {
    font-size: 1.1rem;
    color: #495057;
}



/* Пустое состояние */
.tables-empty-state-new {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.tables-empty-icon-new {
    font-size: 3rem;
    color: #adb5bd;
    margin-bottom: 1rem;
}

/* Анимации */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes tablePulseNew {
    0%, 100% {
        stroke-opacity: 1;
    }
    50% {
        stroke-opacity: 0.6;
    }
}

/* Адаптивность */
@media (max-width: 992px) {
    .tables-modal-new .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
    }
    
    .hall-info-panel {
        margin-bottom: 1rem;
    }
    
    .tables-layout-container-new {
        max-height: 350px;
    }
    
    .hall-svg-new {
        height: 320px !important;
    }
}

@media (max-width: 576px) {
    .tables-modal-header-new {
        padding: 1rem;
    }
    
    .tables-modal-body-new {
        padding: 1rem !important;
    }
    
    .hall-info-panel {
        padding: 1rem;
    }
    

    
    .tables-filter-btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
}

/* Hall Info Panel (очищенная панель статистики зала без лишних кнопок) */
.hall-info-panel {
    background: white;
    border-radius: 12px;
    padding: 1.2rem; /* Уменьшил с 1.5rem до 1.2rem */
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    height: fit-content;
    min-height: 200px; /* Минимальная высота для выравнивания */
}

.hall-stats-content {
    animation: fadeIn 0.4s ease;
}

.occupancy-overview {
    padding: 0.8rem; /* Уменьшил с 1rem до 0.8rem */
    background: rgba(0,0,0,0.02);
    border-radius: 12px;
    margin-bottom: 0.8rem; /* Уменьшил с 1rem до 0.8rem */
}

.occupancy-circle {
    position: relative;
}

.stat-item {
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stats-grid .stat-item {
    border-radius: 8px;
}

/* Анимации для статистики */
@keyframes statCountUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.stat-item .fw-bold {
    animation: statCountUp 0.5s ease;
}

/* Стили для нередактируемого поля даты */
.readonly-field {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    color: #6c757d;
    cursor: default;
    min-height: 1.875rem;
    display: flex;
    align-items: center;
    user-select: none;
}

/* Оптимизация модалки оплаты (закрытие счета) */
#closeBillModal .modal-body {
    max-height: 60vh;
    overflow: hidden;
    padding: 0.75rem;
}

#close-bill-sales-list {
    max-height: 28vh;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem;
    background: #f8f9fa;
    margin-top: 0.75rem !important;
}

#close-bill-sales-list .list-group-item {
    border-left: none;
    border-right: none;
    border-top: 1px solid #dee2e6;
    padding: 0.375rem 0.5rem;
    background: #fff;
    margin-bottom: 0;
    font-size: 0.9rem;
}

#close-bill-sales-list .list-group-item:first-child {
    border-top: none;
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
}

#close-bill-sales-list .list-group-item:last-child {
    border-bottom: none;
    border-bottom-left-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

#close-bill-sales-list .item-photo-container {
    flex: 0 0 48px;
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f3f5;
    padding: 0 !important;
    margin: 0 !important;
}

#close-bill-sales-list .list-group-item .item-photo-container {
    margin-right: 12px !important;
}

#close-bill-sales-list .item-photo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#close-bill-guest-info {
    background: #e7f3ff;
    border: 1px solid #b8daff;
    border-radius: 0.375rem;
    padding: 0.6rem;
    font-size: 0.875rem;
}

#close-bill-total {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 0.375rem;
    padding: 0.6rem;
    text-align: center;
    font-size: 1rem;
    margin-top: 0.75rem !important;
}

/* Кастомный скроллбар для списка покупок в модалке оплаты */
#close-bill-sales-list::-webkit-scrollbar {
    width: 6px;
}

#close-bill-sales-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#close-bill-sales-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#close-bill-sales-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Мобильная адаптация модалки оплаты */
@media (max-width: 768px) {
    #closeBillModal .modal-body {
        max-height: 70vh;
        padding: 0.6rem;
    }
    
    #close-bill-sales-list {
        max-height: 35vh;
        padding: 0.4rem;
    }
    
    #close-bill-sales-list .list-group-item {
        padding: 0.3rem 0.4rem;
        font-size: 0.8rem;
    }
    
    #close-bill-guest-info {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
    
    #close-bill-total {
        padding: 0.4rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    #closeBillModal .modal-dialog {
        margin: 0.25rem;
    }
    
    #closeBillModal .modal-body {
        max-height: 75vh;
        padding: 0.4rem;
    }
    
    #close-bill-sales-list {
        max-height: 40vh;
        padding: 0.3rem;
    }
    
    #close-bill-sales-list .list-group-item {
        padding: 0.3rem 0.4rem;
        font-size: 0.8rem;
    }
    
    #close-bill-guest-info {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
    
    #close-bill-total {
        padding: 0.4rem;
        font-size: 0.9rem;
    }
    
    .pay-btns-grid .pay-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
}

/* Минимальные стили для десктопа в режиме "мало товаров" */
#tableManagementModal.few-items .modal-body {
    max-height: none;
    padding: 1rem;
}

#tableManagementModal.few-items #tableOrdersList {
    max-height: none;
    min-height: 200px;
    overflow-y: visible;
}



/* Мобильная адаптация для режима "мало товаров" в модалке управления счетом */
@media (max-width: 768px) {
    #tableManagementModal.few-items .modal-dialog {
        max-width: 95vw;
        margin: 1rem auto;
        display: flex;
        align-items: center;
        min-height: calc(100vh - 2rem);
    }
    
    #tableManagementModal.few-items .modal-content {
        min-height: 70vh;
        width: 100%;
        margin: auto;
    }
    
    #tableManagementModal.few-items .modal-body {
        padding: 1.5rem;
        gap: 1.25rem;
    }
    
    #tableManagementModal.few-items .form-label {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }
    
    #tableManagementModal.few-items .form-control,
    #tableManagementModal.few-items .readonly-field {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
    
    #tableManagementModal.few-items #tableOrdersList {
        min-height: 200px;
        max-height: 35vh;
        overflow-y: auto;
        padding: 0.75rem;
    }
    
    /* Кастомный скроллбар для мобильной версии списка товаров в режиме few-items */
    #tableManagementModal.few-items #tableOrdersList::-webkit-scrollbar {
        width: 4px;
    }
    
    #tableManagementModal.few-items #tableOrdersList::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 2px;
    }
    
    #tableManagementModal.few-items #tableOrdersList::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 2px;
    }
    
    /* Кастомный скроллбар для мобильной версии списка товаров */
    #tableManagementModal.few-items #tableOrdersList::-webkit-scrollbar {
        width: 4px;
    }
    
    #tableManagementModal.few-items #tableOrdersList::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 2px;
    }
    
    #tableManagementModal.few-items #tableOrdersList::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 2px;
    }
    
    #tableManagementModal.few-items .compact-order-item {
        padding: 1rem 1.25rem;
        margin-bottom: 0.75rem;
        min-height: 70px;
    }
    
    #tableManagementModal.few-items .order-name {
        font-size: 1.1rem;
        margin-bottom: 0.4rem;
    }
    
    #tableManagementModal.few-items .order-price {
        font-size: 0.95rem;
    }
    
    #tableManagementModal.few-items .btn-group .btn-sm {
        padding: 0.5rem 0.7rem;
        font-size: 0.95rem;
        min-width: 38px;
    }
    
    #tableManagementModal.few-items .quantity-display {
        padding: 0.5rem 0.8rem;
        font-size: 0.95rem;
        min-width: 45px;
    }
    
    #tableManagementModal.few-items .order-total {
        font-size: 1.1rem;
        min-width: 85px;
    }
    
    #tableManagementModal.few-items .modal-footer {
        padding: 1.25rem 1.5rem;
    }
    
    #tableManagementModal.few-items .modal-footer .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 576px) {
    #tableManagementModal.few-items .modal-dialog {
        margin: 0.5rem auto;
        min-height: calc(100vh - 1rem);
    }
    
    #tableManagementModal.few-items .modal-content {
        min-height: 75vh;
    }
    
    #tableManagementModal.few-items .modal-body {
        padding: 1.25rem;
        gap: 1rem;
    }
    
    #tableManagementModal.few-items #tableOrdersList {
        min-height: 180px;
        max-height: 40vh;
        overflow-y: auto;
        padding: 0.6rem;
    }
    
    #tableManagementModal.few-items .compact-order-item {
        padding: 0.85rem 1rem;
        margin-bottom: 0.6rem;
        min-height: 65px;
    }
    
    #tableManagementModal.few-items .order-name {
        font-size: 1rem;
    }
    
    #tableManagementModal.few-items .order-price {
        font-size: 0.9rem;
    }
    
    #tableManagementModal.few-items .btn-group .btn-sm {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
        min-width: 35px;
    }
    
    #tableManagementModal.few-items .quantity-display {
        padding: 0.4rem 0.7rem;
        font-size: 0.9rem;
        min-width: 40px;
    }
    
    #tableManagementModal.few-items .order-total {
        font-size: 1rem;
        min-width: 75px;
    }
    
    #tableManagementModal.few-items .modal-footer {
        padding: 1rem 1.25rem;
    }
    
    #tableManagementModal.few-items .modal-footer .btn {
        padding: 0.7rem 1.25rem;
        font-size: 0.9rem;
    }
}

/* Стили для пустого состояния в режиме "мало товаров" */
#tableManagementModal.few-items .text-center.text-muted {
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

#tableManagementModal.few-items .text-center.text-muted i {
    color: #adb5bd;
    opacity: 0.7;
    margin-bottom: 1rem;
}

#tableManagementModal.few-items .text-center.text-muted .fs-5 {
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

#tableManagementModal.few-items .text-center.text-muted .small {
    color: #adb5bd;
    font-size: 0.9rem;
    max-width: 250px;
    text-align: center;
    line-height: 1.4;
}

/* Мобильная адаптация для пустого состояния */
@media (max-width: 768px) {
    #tableManagementModal.few-items .text-center.text-muted {
        padding: 2.5rem 1.5rem;
        min-height: 200px;
    }
    
    #tableManagementModal.few-items .text-center.text-muted .small {
        font-size: 0.85rem;
        max-width: 200px;
    }
}

@media (max-width: 576px) {
    #tableManagementModal.few-items .text-center.text-muted {
        padding: 2rem 1rem;
        min-height: 180px;
    }
    
    #tableManagementModal.few-items .text-center.text-muted .small {
        font-size: 0.8rem;
        max-width: 180px;
    }
}

/* ============ СТИЛИ ДЛЯ ЛОАДЕРА В КНОПКЕ ============ */
.btn .spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
    border-width: 0.15em;
    animation-duration: 0.75s;
}

.btn:disabled .spinner-border-sm {
    opacity: 0.8;
}

/* Анимация для лоадера в кнопке */
@keyframes buttonSpinner {
    to {
        transform: rotate(360deg);
    }
}

.btn .spinner-border-sm {
    animation: buttonSpinner 0.75s linear infinite;
}

/* Стили для кнопки в состоянии загрузки */
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ============ СТИЛИ ДЛЯ ТАБЛИЦЫ ПОСЛЕДНИХ ПРОДАЖ ============ */
/* Исправление отображения заголовков на планшетах */
@media (min-width: 768px) and (max-width: 991px) {
    /* Таблица последних продаж */
    .table-responsive .table th {
        white-space: nowrap;
        font-size: 0.875rem;
        padding: 0.5rem 0.4rem;
        min-width: auto;
    }
    
    /* Специально для заголовка "Тип оплаты" */
    .table-responsive .table th:last-child {
        white-space: nowrap;
        font-size: 0.875rem;
        padding: 0.5rem 0.4rem;
    }
    
    /* Ячейки таблицы */
    .table-responsive .table td {
        font-size: 0.875rem;
        padding: 0.5rem 0.4rem;
        white-space: nowrap;
    }
    
    /* Для длинного текста в ячейках */
    .table-responsive .table td:last-child {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }
}

/* Дополнительные стили для средних планшетов */
@media (min-width: 768px) and (max-width: 1024px) {
    .table-responsive .table th,
    .table-responsive .table td {
        font-size: 0.8rem;
        padding: 0.4rem 0.3rem;
    }
    
    .table-responsive .table th:last-child,
    .table-responsive .table td:last-child {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100px;
    }
}

/* Специфичные стили для таблицы последних продаж */
#last-sales-tbody {
    font-size: 0.875rem;
}

/* Дополнительные стили для планшетов - принудительное исправление */
@media (min-width: 768px) and (max-width: 1199px) {
    /* Принудительно убираем перенос строк в заголовках */
    .table-responsive .table thead th {
        white-space: nowrap !important;
        word-break: keep-all !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: none !important;
        min-width: auto !important;
    }
    
    /* Уменьшаем размер шрифта для всех заголовков */
    .table-responsive .table thead th {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.3rem !important;
    }
    
    /* Уменьшаем размер шрифта для всех ячеек */
    .table-responsive .table tbody td {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.3rem !important;
    }
}

/* Стили для скролла списка гостей */
.guests-scroll-container {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

/* Стили скроллбара для контейнера гостей */
.guests-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.guests-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.guests-scroll-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.guests-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Мобильная версия - скролл при >10 гостей (5 строк по 2) */
@media (max-width: 768px) {
    .guests-scroll-container {
        max-height: 350px;
    }
}

/* Десктопная версия - скролл при >16 гостей (4 строки по 4) */
@media (min-width: 769px) {
    .guests-scroll-container {
        max-height: 300px;
    }
}

/* Отключаем скролл основной страницы при скролле в модалке */
.modal.show {
    overflow: hidden;
}

.modal.show .modal-body {
    overflow: hidden;
}

/* Предотвращаем скролл основной страницы при использовании колеса мыши в модалке */
.modal.show .guests-scroll-container {
    overscroll-behavior: contain;
}

/* Дополнительная защита от скролла фона */
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* Стили для скролла списка товаров */
.items-scroll-container {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

/* Стили скроллбара для контейнера товаров */
.items-scroll-container::-webkit-scrollbar {
    width: 6px;
}

.items-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.items-scroll-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.items-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Мобильная версия - скролл при >12 товаров (4 строки по 3) */
@media (max-width: 768px) {
    .items-scroll-container {
        max-height: 800px;
    }
}

/* Десктопная версия - скролл при >20 товаров (4 строки по 5) */
@media (min-width: 769px) {
    .items-scroll-container {
        max-height: 400px;
    }
}

/* Стили для квадратных плиток товаров */
.item-tile {
    aspect-ratio: 1;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    background: white;
    display: flex;
    flex-direction: column;
}

.item-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #0d6efd;
}

.item-tile:active {
    transform: translateY(0);
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }
    
    /* Дополнительная защита от залипания состояний для товаров */
    .item-tile:not(:focus):not(:active):not(:hover) {
        transform: none !important;
        background-color: initial !important;
        border-color: initial !important;
        box-shadow: none !important;
    }
    
    /* Принудительный сброс состояний для товаров на мобильных устройствах */
    @media (max-width: 768px) {
        .item-tile {
            -webkit-tap-highlight-color: transparent !important;
            -webkit-touch-callout: none !important;
            touch-action: manipulation !important;
        }
        
        .item-tile:active {
            transform: scale(0.98) !important;
            transition: transform 0.1s ease !important;
        }
        
        .item-tile:not(:active) {
            transform: none !important;
            transition: transform 0.1s ease !important;
        }
    }

.item-photo-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
    padding: 0.5rem;
}

.item-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.item-photo-placeholder {
    width: 100%;
    height: 100%;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.item-info {
    padding: 0.5rem;
    text-align: center;
    flex-shrink: 0;
}

.item-name {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-price {
    font-weight: 600;
    color: #0d6efd;
    font-size: 0.875rem;
}

.item-stock {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Адаптивные размеры для разных экранов */
@media (max-width: 576px) {
    .item-tile {
        aspect-ratio: 1;
    }
    
    .item-name {
        font-size: 0.8rem;
    }
    
    .item-price {
        font-size: 0.8rem;
    }
    
    .item-stock {
        font-size: 0.7rem;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .item-tile {
        aspect-ratio: 1;
    }
}

@media (min-width: 769px) {
    .item-tile {
        aspect-ratio: 1;
    }
    
    .item-name {
        font-size: 0.9rem;
    }
    
    .item-price {
        font-size: 0.9rem;
    }
    
    .item-stock {
        font-size: 0.8rem;
    }
}