/* Stili per il sistema di posizionamento tavoli in modalità cassa */

.sala-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 15px;
    flex-wrap: wrap;
}

@media (min-width: 769px) {
    .sala-header {
        flex-wrap: nowrap;
    }
}

.sala-title {
    margin: 0;
    flex: 1;
}

.sala-header-controls {
    display: none;
}

.sale-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
}

.sale-buttons-container .sala-btn {
    flex: 0 1 auto;
    min-width: 80px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sale-buttons-container .sala-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.sale-buttons-container .sala-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sala-posizionamento-container {
    position: relative;
    width: 100%;
    min-height: 450px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    overflow: hidden;
}

.sala-container-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    z-index: 100;
    flex-direction: column;
}

.sala-container-controls .btn {
    white-space: nowrap;
    padding: 8px 16px;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.sala-container-controls .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sala-posizionamento-container.edit-mode {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.tavolo-item {
    position: absolute;
    width: 56px;
    height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 4px;
    padding-bottom: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 2px solid transparent;
}

.tavolo-item.dragging {
    will-change: transform;
    transition: none;
}

.tavolo-item:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    z-index: 20;
}

.tavolo-item.dragging {
    opacity: 0.7;
    z-index: 1000;
    cursor: grabbing;
    transform: scale(1.15);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.tavolo-item.edit-mode {
    cursor: move;
    border-color: #3b82f6;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.sala-posizionamento-container.edit-mode {
    touch-action: none;
}

.tavolo-item.edit-mode:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.tavolo-item i {
    font-size: 20px;
    margin-bottom: 2px;
    margin-top: 4px;
    border-radius: 4px !important; /* Quadrato con leggero arrotondamento */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 34px;
}

.tavolo-numero {
    font-size: 11px;
    font-weight: 700;
    color: inherit;
    margin-top: auto;
    margin-bottom: 2px;
}

.tavolo-nome {
    font-size: 7px;
    font-weight: 500;
    color: #64748b;
    margin-top: 0;
    margin-bottom: 2px;
    text-align: center;
    max-width: 49px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Stili per stato tavoli */
.tavolo-item[data-stato="1"] {
    border-color: #8cc152;
}

.tavolo-item[data-stato="2"] {
    border-color: #f6bb42;
}

.tavolo-item[data-stato="3"] {
    border-color: #da4453;
}

.tavolo-item[data-stato="1"]:hover {
    box-shadow: 0 4px 12px rgba(140, 193, 82, 0.4);
}

.tavolo-item[data-stato="2"]:hover {
    box-shadow: 0 4px 12px rgba(246, 187, 66, 0.4);
}

.tavolo-item[data-stato="3"]:hover {
    box-shadow: 0 4px 12px rgba(218, 68, 83, 0.4);
}

/* Bottoni sala - stato attivo */
.sale-buttons-container .sala-btn.active {
    background: #1e3a8a !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.4);
    transform: scale(1.02);
    font-weight: 900;
}

.sale-buttons-container .sala-btn.active:hover {
    background: #1e40af !important;
    box-shadow: 0 6px 16px rgba(30, 58, 138, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .sala-posizionamento-container {
        min-height: 380px;
        padding: 15px;
    }
    
    .tavolo-item {
        width: 49px;
        height: 49px;
        padding-top: 3px;
        padding-bottom: 2px;
    }
    
    .tavolo-item i {
        font-size: 16px;
        margin-top: 3px;
        margin-bottom: 2px;
        width: 18px;
        height: 26px;
    }
    
    .tavolo-numero {
        font-size: 10px;
        margin-top: auto;
        margin-bottom: 2px;
    }
    
    .tavolo-nome {
        font-size: 6px;
        margin-bottom: 1px;
    }
    
    .sala-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .sale-buttons-container {
        width: 100%;
        gap: 6px;
    }
    
    .sale-buttons-container .sala-btn {
        min-width: calc(50% - 3px);
        max-width: none;
        padding: 8px 12px;
        font-size: 12px;
        flex: 1 1 calc(50% - 3px);
    }
    
    .sala-container-controls {
        top: 10px;
        right: 10px;
        gap: 6px;
    }
    
    .sala-container-controls .btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Animazioni */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.tavolo-item.saving {
    animation: pulse 1s infinite;
}

/* ============================================
   STILI TEMA DARK
   ============================================ */

/* Container principale - tema dark */
.theme-dark .sala-posizionamento-container {
    background: linear-gradient(135deg, #1b1d21 0%, #0f1117 100%);
    border-color: rgba(255, 255, 255, 0.1);
}

.theme-dark .sala-posizionamento-container.edit-mode {
    border-color: #4A89DC;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

/* Tavoli - tema dark */
.theme-dark .tavolo-item {
    background: rgba(27, 29, 33, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    color: #e2e5ea;
}

.theme-dark .tavolo-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    background: rgba(33, 37, 42, 0.95);
}

.theme-dark .tavolo-item.dragging {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
    background: rgba(33, 37, 42, 0.9);
}

.theme-dark .tavolo-item.edit-mode {
    border-color: #4A89DC;
}

.theme-dark .tavolo-item.edit-mode:hover {
    border-color: #5D9CEC;
    box-shadow: 0 4px 12px rgba(74, 137, 220, 0.5);
}

/* Nome tavolo - tema dark */
.theme-dark .tavolo-nome {
    color: #AAB2BD;
}

/* Stati tavoli - tema dark (mantengono i colori ma con bordi più visibili) */
.theme-dark .tavolo-item[data-stato="1"] {
    border-color: #8cc152;
    background: rgba(27, 29, 33, 0.95);
}

.theme-dark .tavolo-item[data-stato="2"] {
    border-color: #f6bb42;
    background: rgba(27, 29, 33, 0.95);
}

.theme-dark .tavolo-item[data-stato="3"] {
    border-color: #da4453;
    background: rgba(27, 29, 33, 0.95);
}

.theme-dark .tavolo-item[data-stato="1"]:hover {
    box-shadow: 0 4px 12px rgba(140, 193, 82, 0.6);
    background: rgba(33, 37, 42, 0.95);
}

.theme-dark .tavolo-item[data-stato="2"]:hover {
    box-shadow: 0 4px 12px rgba(246, 187, 66, 0.6);
    background: rgba(33, 37, 42, 0.95);
}

.theme-dark .tavolo-item[data-stato="3"]:hover {
    box-shadow: 0 4px 12px rgba(218, 68, 83, 0.6);
    background: rgba(33, 37, 42, 0.95);
}

/* Bottoni sala - tema dark */
.theme-dark .sale-buttons-container .sala-btn {
    background: rgba(27, 29, 33, 0.9);
    color: #e2e5ea;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.theme-dark .sale-buttons-container .sala-btn:hover {
    background: rgba(33, 37, 42, 0.95);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.theme-dark .sale-buttons-container .sala-btn.active {
    background: #4A89DC !important;
    color: #ffffff !important;
    border-color: #5D9CEC;
    box-shadow: 0 4px 12px rgba(74, 137, 220, 0.5);
}

.theme-dark .sale-buttons-container .sala-btn.active:hover {
    background: #5D9CEC !important;
    box-shadow: 0 6px 16px rgba(74, 137, 220, 0.6);
}

/* Controlli container - tema dark */
.theme-dark .sala-container-controls .btn {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.theme-dark .sala-container-controls .btn:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

