/* Layout Editor Styles */

/* Main Container */
.layout-editor-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 150px);
    min-height: 500px;
    background-color: #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
}

/* Toolbar */
.layout-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(to bottom, #fff, #f8f9fa);
    border-bottom: 1px solid #dee2e6;
    flex-wrap: wrap;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toolbar-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
}

.toolbar-divider {
    width: 1px;
    height: 28px;
    background-color: #dee2e6;
    margin: 0 0.5rem;
}

.toolbar-spacer {
    flex: 1;
}

.zoom-display {
    min-width: 60px;
    text-align: center;
}

.dropdown-menu-elementos {
    max-height: 400px;
    overflow-y: auto;
}

/* Editor Body */
.layout-editor-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Canvas Wrapper */
.layout-canvas-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    background-color: #e9ecef;
    background-image:
        linear-gradient(45deg, #ddd 25%, transparent 25%),
        linear-gradient(-45deg, #ddd 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ddd 75%),
        linear-gradient(-45deg, transparent 75%, #ddd 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Canvas Container */
.layout-canvas-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* Canvas */
.layout-canvas {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    transition: transform 0.1s ease-out;
}

/* Grid */
.layout-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Layout Elements */
.layout-element {
    position: absolute;
    cursor: move;
    user-select: none;
    transition: box-shadow 0.15s ease;
}

.layout-element:hover {
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.5);
}

.layout-element.selected {
    box-shadow: 0 0 0 3px #1976d2;
    z-index: 1000 !important;
}

.layout-element.dragging {
    opacity: 0.8;
    z-index: 1001 !important;
}

/* Areas */
.layout-area {
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 5px;
}

.area-label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Mesas */
.layout-mesa {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-width: 2px;
    border-style: solid;
    transition: background-color 0.2s ease;
}

/* Mesa Shapes */
.layout-mesa.mesa-cuadrada {
    border-radius: 4px;
}

.layout-mesa.mesa-rectangular {
    border-radius: 4px;
}

.layout-mesa.mesa-circular {
    border-radius: 50%;
}

.layout-mesa.mesa-ovalada {
    border-radius: 50%;
}

.layout-mesa.mesa-hexagonal {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

/* Mesa States */
.layout-mesa.mesa-estado-disponible {
    background-color: var(--color-disponible, #28a745);
}

.layout-mesa.mesa-estado-ocupada {
    background-color: var(--color-ocupada, #dc3545);
}

.layout-mesa.mesa-estado-reservada {
    background-color: var(--color-reservada, #ffc107);
}

.mesa-numero {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.mesa-capacidad {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
}

/* Elementos Decorativos */
.layout-elemento {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.elemento-icono {
    font-size: 24px;
    color: #333;
}

.elemento-texto {
    text-align: center;
    word-break: break-word;
}

.elemento-imagen {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Element Type Specific Styles */
.layout-elemento.elemento-pared,
.layout-elemento.elemento-columna {
    background-color: #666;
    border-radius: 2px;
}

.layout-elemento.elemento-puerta,
.layout-elemento.elemento-ventana {
    background-color: #a1887f;
    border: 2px solid #795548;
}

.layout-elemento.elemento-barra {
    background-color: #5d4037;
    border-radius: 4px;
}

.layout-elemento.elemento-banios {
    background-color: #90caf9;
    border-radius: 4px;
}

.layout-elemento.elemento-cocina {
    background-color: #ff8a65;
    border-radius: 4px;
}

.layout-elemento.elemento-salidaemergencia {
    background-color: #ef5350;
    border-radius: 4px;
}

.layout-elemento.elemento-planta {
    background-color: #81c784;
    border-radius: 50%;
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #1976d2;
    border: 1px solid #fff;
    border-radius: 2px;
    z-index: 100;
}

.resize-handle.resize-n {
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    cursor: n-resize;
}

.resize-handle.resize-s {
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    cursor: s-resize;
}

.resize-handle.resize-e {
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    cursor: e-resize;
}

.resize-handle.resize-w {
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
    cursor: w-resize;
}

.resize-handle.resize-ne {
    top: -5px;
    right: -5px;
    cursor: ne-resize;
}

.resize-handle.resize-nw {
    top: -5px;
    left: -5px;
    cursor: nw-resize;
}

.resize-handle.resize-se {
    bottom: -5px;
    right: -5px;
    cursor: se-resize;
}

.resize-handle.resize-sw {
    bottom: -5px;
    left: -5px;
    cursor: sw-resize;
}

/* Property Panel */
.layout-property-panel {
    width: 280px;
    min-width: 280px;
    background: #fff;
    border-left: 1px solid #dee2e6;
    padding: 1rem;
    overflow-y: auto;
}

.property-section {
    margin-bottom: 1rem;
}

.property-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

/* Form Adjustments for Property Panel */
.layout-property-panel .form-label {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.layout-property-panel .form-control,
.layout-property-panel .form-select {
    font-size: 0.85rem;
}

.layout-property-panel .form-control-color {
    width: 100%;
    height: 32px;
}

/* Responsive */
@media (max-width: 992px) {
    .layout-editor-body {
        flex-direction: column;
    }

    .layout-property-panel {
        width: 100%;
        min-width: 100%;
        max-height: 250px;
        border-left: none;
        border-top: 1px solid #dee2e6;
    }
}

@media (max-width: 768px) {
    .toolbar-label {
        display: none;
    }

    .toolbar-divider {
        display: none;
    }

    .layout-toolbar {
        justify-content: center;
    }
}
