/* css/components/tables.css - Styles des tables du plan de salle */

/* Base table styles */
.table {
    position: absolute;
    background: var(--bg-card);
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-xs);
    user-select: none;
    box-shadow: var(--shadow-sm);
    font-size: var(--font-size-sm);
    min-width: 60px;
    min-height: 60px;
}

.table:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-dark);
}

.table.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    z-index: 10;
}

.table.dragging {
    opacity: 0.8;
    transform: rotate(5deg);
    z-index: 20;
}

/* Table shapes */
.table.rectangle {
    border-radius: var(--radius-md);
}

.table.square {
    border-radius: var(--radius-md);
    aspect-ratio: 1;
}

.table.circle {
    border-radius: var(--radius-round);
    aspect-ratio: 1;
}

.table.oval {
    border-radius: 50px;
}

/* Table status colors */
.table.available {
    background: var(--success-light);
    border-color: var(--success);
    color: var(--success);
}

.table.reserved {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.table.occupied {
    background: var(--warning-light);
    border-color: var(--warning);
    color: var(--warning);
}

.table.late {
    background: var(--error-light);
    border-color: var(--error);
    color: var(--error);
    animation: pulse 2s infinite;
}

.table.cleaning {
    background: var(--info-light);
    border-color: var(--info);
    color: var(--info);
}

.table.unavailable {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
    color: var(--text-muted);
    opacity: 0.6;
    cursor: not-allowed;
}

.table.locked {
    border-style: dashed;
    opacity: 0.7;
}

/* Table content */
.table-number {
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-base);
    line-height: 1;
    margin-bottom: 2px;
}

.table-capacity {
    font-size: var(--font-size-xs);
    opacity: 0.8;
    line-height: 1;
    margin-bottom: 2px;
}

.table-reservation {
    font-size: var(--font-size-xs);
    line-height: 1.2;
    opacity: 0.9;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 100%;
}

.table-time {
    font-weight: var(--font-weight-medium);
}

/* Table sizes */
.table.size-sm {
    min-width: 50px;
    min-height: 50px;
    font-size: var(--font-size-xs);
}

.table.size-sm .table-number {
    font-size: var(--font-size-sm);
}

.table.size-lg {
    min-width: 80px;
    min-height: 80px;
    font-size: var(--font-size-base);
    padding: var(--space-sm);
}

.table.size-lg .table-number {
    font-size: var(--font-size-lg);
}

.table.size-xl {
    min-width: 100px;
    min-height: 100px;
    font-size: var(--font-size-base);
    padding: var(--space-md);
}

.table.size-xl .table-number {
    font-size: var(--font-size-xl);
}

/* Table indicators */
.table-indicator {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    border-radius: var(--radius-round);
    background: var(--error);
    border: 2px solid var(--bg-card);
    z-index: 5;
}

.table-indicator.warning {
    background: var(--warning);
}

.table-indicator.success {
    background: var(--success);
}

.table-indicator.info {
    background: var(--info);
}

/* Table tooltip on hover */
.table-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    font-size: var(--font-size-xs);
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    z-index: var(--z-tooltip);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    pointer-events: none;
}

.table:hover .table-tooltip {
    opacity: 1;
    visibility: visible;
}

.table-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 6px 0 6px;
    border-color: var(--border-light) transparent transparent transparent;
}

/* Floor plan canvas */
.floor-plan-canvas {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    min-height: 500px;
    overflow: hidden;
    cursor: default;
}

.floor-plan-canvas.edit-mode {
    cursor: crosshair;
}

.floor-plan-canvas.edit-mode .table {
    cursor: move;
}

/* Grid overlay for edit mode */
.floor-plan-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.floor-plan-canvas.edit-mode .floor-plan-grid {
    opacity: 1;
}

/* Room sections */
.room-section {
    position: absolute;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-lg);
    pointer-events: none;
}

.room-label {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    background: var(--bg-card);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

/* Drop zones for table placement */
.drop-zone {
    position: absolute;
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
    background: var(--primary-light);
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
}

.drop-zone.active {
    opacity: 0.5;
}

/* Table selection tools */
.table-selection-tools {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-md);
    display: flex;
    gap: var(--space-sm);
    z-index: 15;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
    transition: all var(--transition-bounce);
}

.table-selection-tools.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.table-tool-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
}

.table-tool-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.table-tool-btn.delete:hover {
    background: var(--error-light);
    color: var(--error);
    border-color: var(--error);
}

/* Shape selector for table creation */
.shape-selector {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.shape-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
}

.shape-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.shape-btn.active {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
}

/* Table status legend */
.table-legend {
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid currentColor;
}

.legend-color.available {
    background: var(--success-light);
    color: var(--success);
}

.legend-color.reserved {
    background: var(--primary-light);
    color: var(--primary);
}

.legend-color.occupied {
    background: var(--warning-light);
    color: var(--warning);
}

.legend-color.late {
    background: var(--error-light);
    color: var(--error);
}

.legend-color.cleaning {
    background: var(--info-light);
    color: var(--info);
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

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

/* Responsive */
@media (max-width: 768px) {
    .table {
        min-width: 50px;
        min-height: 50px;
        font-size: var(--font-size-xs);
    }
    
    .table-number {
        font-size: var(--font-size-sm);
    }
    
    .floor-plan-canvas {
        min-height: 400px;
    }
    
    .table-legend {
        flex-wrap: wrap;
        gap: var(--space-md);
    }
    
    .table-selection-tools {
        position: static;
        margin: var(--space-md) 0;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
}