/* ==========================================================================
   v6.3 · ZOOM DEL PLANO 2D, ILUSTRACIONES Y CAPA EXTERIOR
   ========================================================================== */
/* El plano nunca empuja la barra lateral: hace scroll dentro de su caja */
.wabi-editor-layout > .wabi-canvas-area,
.wabi-canvas-area { min-width: 0; }

.wabi-viewport-shell {
    position: relative;
    min-width: 0;
    width: 100%;
}

.wabi-viewport-shell .wabi-viewport {
    overflow: auto;
    justify-content: flex-start;
    align-items: stretch;
    max-width: 100%;
    box-sizing: border-box;
}

.wabi-viewport-shell .camper-exterior-wrapper {
    margin: auto;      /* centrado que no recorta cuando hay scroll */
    flex-shrink: 0;
}

/* Controles de zoom */
.wabi-zoom-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #d3dec3;
    border-radius: 8px;
    padding: 3px 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.wabi-zoom-controls button {
    min-width: 28px;
    height: 26px;
    border: 1px solid #cfd8d1;
    background: #ffffff;
    color: #1e2d24;
    border-radius: 6px;
    font-weight: 800;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    padding: 0 8px;
}

.wabi-zoom-controls button#btn-zoom-fit { font-size: 11px; }
.wabi-zoom-controls button:hover { background: #1e2d24; color: #ffffff; }
.wabi-zoom-controls span { font-size: 11px; font-weight: 800; color: #5b655d; min-width: 38px; text-align: center; }

/* Objetos con ilustración: la imagen sustituye al recuadro de color */
.canvas-module-item.has-icon {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
    border-radius: 0;
}
.canvas-module-item.has-icon.selected {
    border: 2px dashed #1e2d24;
    box-shadow: none;
    border-radius: 4px;
}
.canvas-module-item.has-icon .mod-label,
.canvas-module-item.has-icon .mod-dims-tag {
    background: rgba(255, 255, 255, 0.72);
    border-radius: 3px;
    padding: 0 3px;
}

/* Tarjetas del catálogo */
.object-catalog-card .thumb-img {
    width: 100%;
    max-width: 110px;
    height: 76px;
    object-fit: contain;
}


/* ==========================================================================
   v6.3 · UBICACIÓN / ANCLAJE, MENÚ LATERAL CON SCROLL Y BOTONES SIN ROSA
   ========================================================================== */
/* Los objetos exteriores se dibujan fuera de la carrocería */
.camper-interior { overflow: visible; }
.canvas-module-item.ext-pared { z-index: 6; }

/* Cómo se distingue cada anclaje en el plano */
.canvas-module-item.ub-exterior.anc-techo { outline: 2px dashed #2980b9; outline-offset: -2px; opacity: 0.92; }
.canvas-module-item.ub-exterior.anc-bajo  { outline: 2px dotted #7f8c8d; outline-offset: -2px; opacity: 0.6; }
.canvas-module-item.ub-interior.anc-techo { outline: 2px dashed #8e6bbf; outline-offset: -2px; }
.canvas-module-item.ext-pared.selected    { outline: 2px dashed #1e2d24; outline-offset: 2px; }

/* Menú lateral: nunca más alto que el editor visual; scroll propio */
@media (min-width: 993px) {
    .wabi-sidebar-area {
        align-self: start;
        max-height: 720px;            /* valor de respaldo; el JS lo iguala a la altura del editor */
        overflow-y: auto;
        overflow-x: hidden;
        padding-right: 4px;
        scrollbar-width: thin;
        scrollbar-color: #c9d3c4 transparent;
    }
    .wabi-sidebar-area::-webkit-scrollbar { width: 6px; }
    .wabi-sidebar-area::-webkit-scrollbar-thumb { background: #c9d3c4; border-radius: 3px; }
}

/* El tema (Hello) pinta de rosa los botones al enfocarlos o pulsarlos.
   Aquí cada botón conserva su color en reposo, foco y pulsado. */
.wabi-editor-container button { -webkit-tap-highlight-color: transparent; }
.wabi-editor-container button:focus,
.wabi-editor-container button:active { outline: none; box-shadow: none; }
.wabi-editor-container button:focus-visible { outline: 2px solid #1e2d24; outline-offset: 2px; }

.wabi-editor-container .btn-primary-green,
.wabi-editor-container .btn-primary-green:focus,
.wabi-editor-container .btn-primary-green:active { background-color: #1e2d24; color: #ffffff; }
.wabi-editor-container .btn-primary-green:hover { background-color: #2d4033; color: #ffffff; }

.wabi-editor-container .btn-secondary,
.wabi-editor-container .btn-secondary:focus,
.wabi-editor-container .btn-secondary:active { background-color: #ffffff; color: #1e2d24; border-color: #dcd7cc; }
.wabi-editor-container .btn-secondary:hover { background-color: #f5f4ef; color: #000000; }

.wabi-editor-container .btn-danger,
.wabi-editor-container .btn-danger:focus,
.wabi-editor-container .btn-danger:active { background-color: #c0392b; color: #ffffff; }
.wabi-editor-container .btn-danger:hover { background-color: #e74c3c; color: #ffffff; }

.wabi-editor-container .btn-quick-delete,
.wabi-editor-container .btn-quick-delete:focus,
.wabi-editor-container .btn-quick-delete:active { background-color: #c0392b; color: #ffffff; }
.wabi-editor-container .btn-quick-delete:hover { background-color: #e74c3c; }

.wabi-editor-container .wabi-view-modes button:not(.active),
.wabi-editor-container .wabi-view-modes button:not(.active):focus,
.wabi-editor-container .wabi-view-modes button:not(.active):active { background-color: transparent; color: #4a544c; }
.wabi-editor-container .wabi-view-modes button:not(.active):hover { background-color: #dcd7cc; color: #1e2d24; }
.wabi-editor-container .wabi-view-modes button.active,
.wabi-editor-container .wabi-view-modes button.active:focus,
.wabi-editor-container .wabi-view-modes button.active:hover { background-color: #1e2d24; color: #ffffff; }

.wabi-editor-container .wabi-3d-toolbar button,
.wabi-editor-container .wabi-3d-toolbar button:focus,
.wabi-editor-container .wabi-3d-toolbar button:active { background-color: #ffffff; color: #1e2d24; }
.wabi-editor-container .wabi-3d-toolbar button:hover { background-color: #f5f4ef; color: #1e2d24; }

.wabi-editor-container .wabi-zoom-controls button,
.wabi-editor-container .wabi-zoom-controls button:focus,
.wabi-editor-container .wabi-zoom-controls button:active { background-color: #ffffff; color: #1e2d24; }
.wabi-editor-container .wabi-zoom-controls button:hover { background-color: #1e2d24; color: #ffffff; }

.wabi-editor-container .btn-bulb-toggle,
.wabi-editor-container .btn-bulb-toggle:focus,
.wabi-editor-container .btn-bulb-toggle:active { background-color: transparent; color: inherit; }
.wabi-editor-container .btn-bulb-toggle:hover { background-color: #e2e7e0; }

.wabi-editor-container .wabi-context-menu button,
.wabi-editor-container .wabi-context-menu button:focus,
.wabi-editor-container .wabi-context-menu button:active { background-color: transparent; color: #1e2d24; }
.wabi-editor-container .wabi-context-menu button:hover { background-color: #f4f3ef; }
.wabi-editor-container .wabi-context-menu button.danger,
.wabi-editor-container .wabi-context-menu button.danger:focus { color: #c0392b; }
.wabi-editor-container .wabi-context-menu button.danger:hover { background-color: #fadbd8; }


/* ==========================================================================
   v6.4 · BOTÓN "+" ÚNICO, ALTURA DE PUERTAS/VENTANAS E INCLINACIÓN
   ========================================================================== */
.wabi-add-abertura {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 41;
}

.wabi-add-abertura-btn {
    background: #1e2d24;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.wabi-add-abertura-menu {
    margin-top: 6px;
    background: #ffffff;
    border: 1px solid #d3dec3;
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    min-width: 290px;
}

.wabi-add-row { display: flex; align-items: center; gap: 4px; padding: 3px 0; }
.wabi-add-tipo { flex: 0 0 82px; font-size: 12px; font-weight: 800; color: #1e2d24; }
.wabi-add-row button {
    flex: 1;
    border: 1px solid #cfd8d1;
    background: #ffffff;
    color: #1e2d24;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 4px;
    cursor: pointer;
}

.wabi-editor-container .wabi-add-abertura-btn,
.wabi-editor-container .wabi-add-abertura-btn:focus,
.wabi-editor-container .wabi-add-abertura-btn:active { background-color: #1e2d24; color: #ffffff; }
.wabi-editor-container .wabi-add-abertura-btn:hover { background-color: #2d4033; color: #ffffff; }
.wabi-editor-container .wabi-add-row button,
.wabi-editor-container .wabi-add-row button:focus,
.wabi-editor-container .wabi-add-row button:active { background-color: #ffffff; color: #1e2d24; }
.wabi-editor-container .wabi-add-row button:hover { background-color: #1e2d24; color: #ffffff; }

/* Medidas de cada puerta / ventana en el menú lateral */
.abertura-sidebar-item { border-bottom: 1px solid #eef1ec; padding-bottom: 6px; margin-bottom: 4px; }
.ab-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 2px 4px 0; }
.ab-fields label { display: flex; flex-direction: column; font-size: 10px; font-weight: 700; color: #5b655d; gap: 2px; }
.ab-fields input { width: 100%; box-sizing: border-box; padding: 4px; font-size: 12px; border: 1px solid #dcd7cc; border-radius: 4px; }

/* Objeto de pared inclinado: se ve como una pieza fina pegada a la chapa */
.canvas-module-item.tilted {
    background-image: none;
    border: 1px solid #1e2d24;
    border-radius: 2px;
}
.canvas-module-item.tilted .mod-content { display: none; }


/* ==========================================================================
   v6.5 · EDITOR MÁS ALTO, MENÚ LATERAL APROVECHANDO ESA ALTURA Y CATÁLOGO APARTE
   ========================================================================== */
/* Misma altura para el plano 2D y el 3D: el editor ya no crece con el contenido */
.wabi-viewport-shell .wabi-viewport { height: 640px; min-height: 640px; }
.wabi-viewport-3d { height: 640px; }

/* "Objetos de tu furgoneta": bloque independiente debajo, con scroll propio */
.wabi-objects-selector {
    margin-top: 22px;
    padding: 16px 18px;
    background: #fbfaf6;
    border: 1px solid #e8e6df;
    border-radius: 12px;
    box-sizing: border-box;
}
.wabi-objects-selector h3 { margin-top: 0; }
.wabi-objects-selector .objects-grid {
    flex-wrap: wrap;
    max-height: 380px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c9d3c4 transparent;
}
.wabi-objects-selector .objects-grid::-webkit-scrollbar { width: 6px; }
.wabi-objects-selector .objects-grid::-webkit-scrollbar-thumb { background: #c9d3c4; border-radius: 3px; }


/* v6.7 · anclaje "Libre": se mueve por el plano y también en altura (3D) */
.canvas-module-item.ub-interior.anc-libre { outline: 2px dotted #2e8b57; outline-offset: -2px; }


/* ==========================================================================
   v6.9 · ZONAS EN ROJO AL TOCARSE Y BARRA 3D CON MÁS BOTONES
   ========================================================================== */
.cruce-zona {
    position: absolute;
    background: rgba(220, 38, 38, 0.42);
    border: 1px dashed #b91c1c;
    pointer-events: none;
    z-index: 8;
}
.canvas-module-item.en-cruce { outline: 2px solid #dc2626 !important; outline-offset: -1px; }

.wabi-3d-toolbar { flex-wrap: wrap; row-gap: 6px; }


/* ==========================================================================
   v7 · ESCENARIO GIRABLE DEL PLANO, BARRA 3D EN UNA FILA, PASOS DE RUEDA Y AVISOS
   ========================================================================== */
/* El plano 2D vive dentro de un escenario que se puede girar (horizontal / vertical) */
.wabi-viewport-shell .wabi-viewport .wabi-stage { position: relative; margin: auto; flex-shrink: 0; }
.wabi-rotator { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.wabi-rotator .camper-exterior-wrapper { margin: 0; }

.wabi-zoom-controls button.activo { background-color: #1e2d24; color: #ffffff; }
.wabi-zoom-controls button#btn-rotate-plano,
.wabi-zoom-controls button#btn-fullscreen { font-size: 14px; padding: 0 7px; }

/* Barra 3D compacta: una sola fila (con scroll lateral si la pantalla es muy estrecha) */
.wabi-3d-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    padding: 6px;
    scrollbar-width: none;
}
.wabi-3d-toolbar::-webkit-scrollbar { display: none; }
.wabi-3d-toolbar button {
    flex: 0 0 auto;
    font-size: 11px;
    padding: 4px 7px;
    white-space: nowrap;
    line-height: 1.2;
}
.wabi-viewport-3d .wabi-3d-hint {
    position: absolute;
    left: 8px;
    bottom: 8px;
    max-width: calc(100% - 16px);
    font-size: 11px;
    color: #4a544c;
    background: rgba(255, 255, 255, 0.82);
    border-radius: 6px;
    padding: 3px 8px;
    pointer-events: none;
}

/* Pasos de rueda */
.wabi-ruedas-panel {
    margin: 12px 0;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e8e6df;
    border-radius: 12px;
    box-sizing: border-box;
}
.wabi-ruedas-panel > summary { cursor: pointer; font-weight: 800; font-size: 13px; color: #1e2d24; }
.wabi-ruedas-panel > p { margin: 8px 0 12px; font-size: 13px; color: #5b655d; }
.wabi-ruedas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 14px; }
.wabi-ruedas-grid .input-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wabi-ruedas-grid label { font-size: 12px; font-weight: 700; color: #1e2d24; }
.wabi-ruedas-grid input { width: 100%; box-sizing: border-box; }

/* Avisos */
.wabi-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 20px);
    opacity: 0;
    background: #1e2d24;
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    z-index: 1000000;
    transition: opacity 0.25s, transform 0.25s;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    text-align: center;
}
.wabi-toast.visible { opacity: 1; transform: translate(-50%, 0); }
.wabi-toast.error { background: #c0392b; }


/* Tiradores para girar un objeto desde sus esquinas */
.obj-rotate-handle {
    position: absolute;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #1e2d24;
    cursor: grab;
    z-index: 12;
    box-sizing: border-box;
}
.obj-rotate-handle:active { cursor: grabbing; background: #1e2d24; }
.obj-rotate-handle.handle-nw { left: -9px; top: -9px; }
.obj-rotate-handle.handle-ne { right: -9px; top: -9px; }
.obj-rotate-handle.handle-sw { left: -9px; bottom: -9px; }
.obj-rotate-handle.handle-se { right: -9px; bottom: -9px; }
