﻿/* =========================================================
   MI PIZARRA
   OBJETOS 3D GENERADOS DINÁMICAMENTE
   ========================================================= */


/* ---------------------------------------------------------
   OBJETO PRINCIPAL
   --------------------------------------------------------- */

.wb-graph3d-object {
    position: absolute;
    z-index: 60;
    display: grid;
    grid-template-rows: 2.65rem minmax(0, 1fr);
    min-width: 320px;
    min-height: 240px;
    overflow: hidden;
    border: 1px solid rgba(96, 165, 250, 0.34);
    border-radius: 1rem;
    color: #f8fafc;
    background: linear-gradient( 145deg, rgba(15, 23, 42, 0.78), rgba(15, 23, 42, 0.46) );
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.30);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: auto;
    isolation: isolate;
}


/* ---------------------------------------------------------
   CABECERA
   --------------------------------------------------------- */

.wb-graph3d-object-header {
    position: relative;
    z-index: 5;
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0 0.65rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(15, 23, 42, 0.68);
    user-select: none;
}


.wb-graph3d-object-title {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.55rem;
}


    .wb-graph3d-object-title > span {
        display: grid;
        width: 1.7rem;
        height: 1.7rem;
        flex: 0 0 auto;
        place-items: center;
        border-radius: 0.5rem;
        color: #dbeafe;
        background: linear-gradient( 135deg, rgba(59, 130, 246, 0.55), rgba(139, 92, 246, 0.42) );
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
        font-size: 0.55rem;
        font-weight: 900;
    }


    .wb-graph3d-object-title > strong {
        min-width: 0;
        overflow: hidden;
        color: #f8fafc;
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        font-size: 0.62rem;
        font-weight: 750;
        text-overflow: ellipsis;
        white-space: nowrap;
    }


/* ---------------------------------------------------------
   BOTONES DE CABECERA
   --------------------------------------------------------- */

.wb-graph3d-object-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.25rem;
}


    .wb-graph3d-object-actions button {
        display: grid;
        width: 1.75rem;
        height: 1.75rem;
        place-items: center;
        padding: 0;
        border: 1px solid rgba(148, 163, 184, 0.17);
        border-radius: 0.5rem;
        color: #cbd5e1;
        background: rgba(148, 163, 184, 0.07);
        font: inherit;
        font-size: 0.76rem;
        line-height: 1;
        cursor: pointer;
        transition: color 140ms ease, border-color 140ms ease, background 140ms ease, transform 140ms ease;
    }


        .wb-graph3d-object-actions button:hover {
            color: #ffffff;
            border-color: rgba(96, 165, 250, 0.48);
            background: rgba(59, 130, 246, 0.16);
            transform: translateY(-1px);
        }


/* ---------------------------------------------------------
   HOST THREE.JS / WEBGL
   --------------------------------------------------------- */

.wb-graph3d-render-host {
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: transparent;
    touch-action: none;
}


/* ---------------------------------------------------------
   CANVAS WEBGL
   --------------------------------------------------------- */

.wb-graph3d-canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    border: 0;
    outline: 0;
    background: transparent;
    touch-action: none;
    cursor: grab;
}


    .wb-graph3d-canvas:active {
        cursor: grabbing;
    }


/* ---------------------------------------------------------
   RESPONSIVE
   --------------------------------------------------------- */

@media (max-width: 700px) {

    .wb-graph3d-object {
        min-width: 260px;
        min-height: 220px;
        border-radius: 0.85rem;
    }


    .wb-graph3d-object-header {
        padding: 0 0.5rem;
    }


    .wb-graph3d-object-title > strong {
        font-size: 0.58rem;
    }
}


/* =========================================================
   FONDO 3D
   ========================================================= */

.wb-graph3d-object--transparent {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}


    .wb-graph3d-object--transparent
    .wb-graph3d-render-host {
        background: transparent;
    }


    /*
 * Conservamos una pequeña cabecera flotante
 * para que el objeto siga siendo manejable.
 */
    .wb-graph3d-object--transparent
    .wb-graph3d-object-header {
        margin: 0.35rem 0.35rem 0;
        border: 1px solid rgba(148, 163, 184, 0.16);
        border-radius: 0.72rem;
        background: rgba(15, 23, 42, 0.68);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

/* =========================================================
   CONFIGURACIÓN 3D
   ========================================================= */

.wb-graph3d-settings {
    position: absolute;
    z-index: 40;
    top: 3.15rem;
    right: 0.55rem;
    width: 14rem;
    box-sizing: border-box;
    padding: 0.75rem;
    border: 1px solid rgba(96, 165, 250, 0.22);
    border-radius: 0.9rem;
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.92);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.34);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}


    .wb-graph3d-settings[hidden] {
        display: none;
    }


.wb-graph3d-setting-group {
    display: grid;
    gap: 0.45rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.10);
}


    .wb-graph3d-setting-group:first-child {
        padding-top: 0;
    }


    .wb-graph3d-setting-group:last-child {
        padding-bottom: 0;
        border-bottom: 0;
    }


.wb-graph3d-setting-label {
    color: #94a3b8;
    font-size: 0.55rem;
    font-weight: 850;
    letter-spacing: 0.03em;
}


.wb-graph3d-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}


    .wb-graph3d-setting-row strong {
        color: #dbeafe;
        font-size: 0.57rem;
    }

.wb-graph3d-segmented {
    display: grid;
    grid-template-columns: repeat( 2, minmax(0, 1fr) );
    gap: 0.3rem;
    padding: 0.2rem;
    border: 1px solid rgba(148, 163, 184, 0.13);
    border-radius: 0.65rem;
    background: rgba(148, 163, 184, 0.045);
}


    .wb-graph3d-segmented button {
        min-height: 1.9rem;
        border: 0;
        border-radius: 0.48rem;
        color: #94a3b8;
        background: transparent;
        font: inherit;
        font-size: 0.54rem;
        font-weight: 800;
        cursor: pointer;
    }


        .wb-graph3d-segmented button.active {
            color: #eff6ff;
            background: linear-gradient( 135deg, rgba(37, 99, 235, 0.65), rgba(99, 102, 241, 0.48) );
            box-shadow: 0 5px 14px rgba(37, 99, 235, 0.18);
        }

.wb-graph3d-toggle-list {
    display: grid;
    gap: 0.38rem;
}


.wb-graph3d-toggle {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
}


    .wb-graph3d-toggle input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }


.wb-graph3d-toggle-switch {
    position: relative;
    width: 1.8rem;
    height: 1rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.42);
    transition: background 140ms ease;
}


    .wb-graph3d-toggle-switch::after {
        content: "";
        position: absolute;
        top: 0.15rem;
        left: 0.15rem;
        width: 0.7rem;
        height: 0.7rem;
        border-radius: 999px;
        background: #e2e8f0;
        transition: transform 140ms ease;
    }


.wb-graph3d-toggle
input:checked +
.wb-graph3d-toggle-switch {
    background: #3b82f6;
}


    .wb-graph3d-toggle
    input:checked +
    .wb-graph3d-toggle-switch::after {
        transform: translateX(0.8rem);
    }


.wb-graph3d-toggle strong {
    color: #cbd5e1;
    font-size: 0.57rem;
    font-weight: 750;
}

.wb-graph3d-color-field {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2rem;
}


    .wb-graph3d-color-field
    input[type="color"] {
        width: 2.2rem;
        height: 1.7rem;
        padding: 0;
        border: 0;
        border-radius: 0.45rem;
        background: transparent;
        cursor: pointer;
    }


    .wb-graph3d-color-field span {
        color: #cbd5e1;
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        font-size: 0.57rem;
    }


.wb-graph3d-setting-group
input[type="range"] {
    width: 100%;
    accent-color: #3b82f6;
}

/* =========================================================
   MOVIMIENTO / RESIZE DEL OBJETO 3D
   ========================================================= */

.wb-graph3d-object-header {
    cursor: move;
    touch-action: none;
}


.wb-graph3d-object-actions {
    cursor: default;
}


.wb-graph3d-object.is-moving {
    user-select: none;
    box-shadow: 0 22px 52px rgba(2, 6, 23, 0.38);
}


.wb-graph3d-object.is-resizing {
    user-select: none;
}


/* ---------------------------------------------------------
   TIRADOR
   --------------------------------------------------------- */

.wb-graph3d-resize-handle {
    position: absolute;
    z-index: 55;
    right: 0.35rem;
    bottom: 0.35rem;
    width: 1rem;
    height: 1rem;
    min-width: 1rem;
    min-height: 1rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 0.32rem;
    background: linear-gradient( 135deg, #3b82f6, #6366f1 );
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.30);
    cursor: nwse-resize;
    touch-action: none;
    opacity: 0.82;
    transition: opacity 120ms ease, transform 120ms ease;
}


    .wb-graph3d-resize-handle:hover {
        opacity: 1;
        transform: scale(1.15);
    }

.wb-graph3d-object--transparent
.wb-graph3d-resize-handle {
    opacity: 0.45;
}


    .wb-graph3d-object--transparent:hover
    .wb-graph3d-resize-handle,
    .wb-graph3d-object--transparent
    .wb-graph3d-resize-handle:hover {
        opacity: 1;
    }

/* =========================================================
   HERRAMIENTA 3D EN TOOLBAR
   ========================================================= */

.wb-tool-button-3d .wb-tool-icon-3d {
    display: grid;
    min-width: 1.7rem;
    height: 1.35rem;
    place-items: center;
    padding: 0 0.24rem;
    border: 1px solid rgba(96, 165, 250, 0.24);
    border-radius: 0.42rem;
    background: rgba(59, 130, 246, 0.10);
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: -0.03em;
}


.wb-tool-button-3d.active .wb-tool-icon-3d {
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.wb-tool-button-3d.active .wb-tool-icon-3d {
    box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.18), 0 0 14px rgba(59, 130, 246, 0.38);
    transform: translateY(-1px);
}

.wb-ink-recognition-actions {
    flex-wrap: wrap;
}

    .wb-ink-recognition-actions .graph-action {
        display: inline-flex;
        flex: 1 1 100%;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-height: 34px;
        padding: 0 12px;
        border: 1px solid rgba(56, 189, 248, 0.40);
        border-radius: 9px;
        color: #ffffff;
        background: linear-gradient( 135deg, rgba(2, 132, 199, 0.95), rgba(37, 99, 235, 0.95) );
        font: inherit;
        font-size: 9px;
        font-weight: 850;
        cursor: pointer;
    }


        .wb-ink-recognition-actions
        .graph-action:hover {
            filter: brightness(1.08);
        }

.wb-3d-upload-native-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}


.wb-3d-upload-picker {
    display: grid;
    gap: 10px;
}


.wb-3d-upload-custom-button {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}


.wb-3d-upload-file-status {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
    opacity: 0.82;
}