﻿/* Estilos Generales */

/* Layout de Escritorio por defecto (mÃƒÂ¡s de 768px) */
.inv-dig-editor-container {
    display: grid;
    height: calc(100vh - 80px);
    grid-template-columns: 350px 1fr;
    /* Sidebar fija, canvas flexible */
    grid-template-rows: 1fr;
    grid-template-areas:
        "sidebar canvas";
    overflow: hidden;
    /* SOLUCIÃƒâ€œN DEFINITIVA: Evita que el contenido estire la grilla */
}

.canvas-area-container {
    grid-area: canvas;
    position: relative;
    /* El nuevo contenedor para posicionamiento */
    overflow: auto;
    /* SOLUCIÃƒâ€œN: Permite el scroll en el ÃƒÂ¡rea del canvas */
}

.inv-dig-canvas-wrapper {
    /* Este wrapper ahora solo se encarga del scroll */
    display: flex;
    justify-content: center;
    /* align-items: center; */
    overflow: auto;
    padding: 20px;
    background: #f0f0f1;
    height: 100%;
    box-sizing: border-box;
}

/* FIX: Permitir scroll vertical en mÃ³viles sobre el canvas */
.canvas-container,
.canvas-container canvas {
    touch-action: pan-y !important;
}

.inv-dig-editor-sidebar {
    grid-area: sidebar;
    display: grid;
    /* Header, Contenido (flexible), Footer */
    grid-template-rows: auto 1fr auto;
    border-right: 1px solid #ddd;
    overflow: hidden;
}

.inv-dig-drag-handle {
    display: none;
}



.sidebar-header {
    height: 70px;
    min-height: 70px;
    max-height: 70px;
    padding: 0 15px;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

/* NUEVO: Contenedor para acciones en el header */
.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* NUEVO: Estilo base para botones de icono */
.inv-dig-icon-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    line-height: 34px;
    text-align: center;
    font-size: 1.4em;
    cursor: pointer;
    padding: 0;
    color: #555;
}


/* --- NUEVO: AlineaciÃƒÂ³n para iconos en footer mÃƒÂ³vil --- */
.inv-dig-footer-actions-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h3 {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    /* LÃ­mite para evitar que empuje los botones */
}

.sidebar-content {
    display: grid;
    /* Para apilar paneles y que el padre no colapse */
    overflow-y: auto;
    overflow-x: hidden;
    flex-grow: 1;
    align-content: start;
    align-items: start;
}

/* Utilidades de visibilidad */
.hide-desktop {
    display: none;
}

.hide-mobile {
    display: block;
}

/* Paneles de contenido del sidebar */
.sidebar-panel {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    width: 100%;
    height: auto;
    align-self: start;
    padding: 15px;
    box-sizing: border-box;
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
    text-align: left;
    display: block;
    /* Asegurar que ocupe el ancho */
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid #ddd;
    flex-shrink: 0;
}

.sidebar-footer .single_add_to_cart_button {
    width: 100%;
}

/* Ocultar elementos mÃƒÂ³viles en escritorio */
.inv-dig-header-mobile,
.sidebar-header .close-panel-btn,
.inv-dig-editor-footer,
.inv-dig-editor-overlay {
    display: none;
}

/* Estilos para MÃ³vil (hasta 768px) */
@media (max-width: 768px) {

    /* FIX: Global overflow prevention for mobile */
    html,
    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    .hide-desktop {
        display: block;
    }

    .hide-mobile {
        display: none;
    }

    .inv-dig-editor-container {
        display: flex;
        flex-direction: column;
        /* Fallback para navegadores antiguos */
        height: calc(100vh - 60px);
        /* SoluciÃ³n moderna para mÃ³viles (barra de direcciÃ³n) */
        height: calc(100dvh - 60px);
        overflow: hidden;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        /* Evitar que elementos anchos rompan el layout */
    }

    .inv-dig-header-mobile {
        display: block;
        padding: 10px;
        border-bottom: 1px solid #ddd;
        text-align: center;
        flex-shrink: 0;
        /* No encoger */
        background: #fff;
        z-index: 999;
        box-sizing: border-box;
        /* Position fixed removido para flujo flex */
    }

    .inv-dig-header-mobile h3 {
        margin: 0;
        font-size: 1em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .canvas-area-container {
        flex-grow: 1;
        height: auto;
        /* Dejar que flex maneje la altura */
        overflow-y: auto;
        position: relative;
    }

    .inv-dig-canvas-wrapper {
        height: 100%;
        padding: 10px;
        /* Padding reducido ya que no hay elementos fijos tapando */
        box-sizing: border-box;
    }

    /* Ocultar el footer de la sidebar de escritorio */
    .sidebar-footer {
        display: none;
    }

    /* --- NUEVO: Layout de Footer de dos niveles (MÃ“VIL) --- */
    .inv-dig-editor-footer {
        display: flex;
        flex-direction: column;
        /* Cambiado a columna para dos niveles */
        flex-shrink: 0;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid #ddd;
        padding: 0;
        /* Padding manejado internamente */
        z-index: 1000;
        box-sizing: border-box;
    }

    /* Fila de acciones secundarias (Iconos circulares) */
    .inv-dig-footer-secondary-actions {
        display: flex;
        justify-content: space-around;
        /* ACTUALIZADO: space-around */
        gap: 30px;
        padding: 10px 10px;
        /* ACTUALIZADO: 10px 10px */
        background: transparent;
    }

    /* BotÃ³n Circular Estilizado */
    .inv-dig-circular-action {
        background: none;
        border: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        cursor: pointer;
        transition: transform 0.2s ease, opacity 0.3s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .inv-dig-circular-action .circular-icon {
        width: 30px;
        /* ACTUALIZADO: 30px */
        height: 30px;
        /* ACTUALIZADO: 30px */
        flex-shrink: 0;
        /* EVITAR QUE SE ESTIRE (OVAlO) */
        aspect-ratio: 1/1;
        border-radius: 50%;
        background: #fff;
        border: 1px solid #e0e0e0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #555;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        transition: all 0.2s ease;
    }

    .inv-dig-circular-action span {
        font-size: 11px;
        font-weight: 500;
        color: #666;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Efecto PresiÃ³n */
    .inv-dig-circular-action:active .circular-icon {
        transform: scale(0.92);
        background-color: #f0f0f0;
    }

    /* GHOST STATE (Para el botÃ³n de Editar) */
    .inv-dig-circular-action.is-disabled {
        opacity: 0.35;
        pointer-events: none;
        filter: grayscale(1);
    }

    /* Fila de acciÃ³n principal (BotÃ³n CTA) */
    .inv-dig-footer-primary-action {
        padding: 5px 0 0 0;
        /* FLUSH TO SIDES: removido padding lateral */
        background: transparent;
    }

    .inv-dig-footer-primary-action .single_add_to_cart_button {
        display: block;
        /* Asegurar que se comporte como bloque para width 100% */
        width: 100% !important;
        margin: 0;
        height: 52px;
        /* Ligeramente mÃ¡s alto */
        border-radius: 0;
        /* FLUSH: sin bordes redondeados si es 100% de pantalla, o mantener si es solo contenedor */
        font-size: 16px;
        font-weight: 600;
        text-transform: none;
        box-shadow: none;
        box-sizing: border-box;
        /* Incluir bordes en el ancho */
    }

    /* Comportamiento del panel deslizante */
    .inv-dig-editor-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        max-height: 85vh;
        /* Aumentado a 85vh para cubrir casi toda la pantalla si es necesario */
        background: #fff;
        z-index: 1002;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        /* SPRING PHYSICS: Cubic Bezier personalizado para efecto rebote premium */
        transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        border-right: none;
        /* CorrecciÃƒÂ³n: Usar Flexbox para el layout interno en mÃƒÂ³vil */
        display: flex;
        flex-direction: column;
        height: auto !important;
        /* FIX DO NOT REMOVE: Evita el pull-to-refresh nativo del navegador al arrastrar el panel */
        overscroll-behavior-y: contain;
        touch-action: pan-y;
    }

    /* Drag Handle (PÃ­ldora visual) - REFACTORED */
    .inv-dig-drag-handle {
        display: block;
        width: 100%;
        /* Ocupa todo el ancho para facilitar el agarre */
        height: 30px;
        /* Altura generosa para el "Ã¡rea tÃ¡ctil" */
        background: transparent !important;
        /* Transparente para no heredar colores */
        border: none !important;
        /* Sin bordes heredados */
        margin: 0;
        padding: 10px 0 0 0;
        /* Padding superior para posicionar la lÃ­nea */
        flex-shrink: 0;
        cursor: grab;
        position: relative;
        z-index: 9999;
        touch-action: none;
        /* Importante: el navegador no debe manejar gestos aquÃ­ */
        /* Flex para centrar la pÃ­ldora visual */
        display: flex;
        justify-content: center;
        align-items: flex-start;
    }

    /* La parte visual "Gris" de la pÃ­ldora usando pseudo-elemento para aislar estilos */
    .inv-dig-drag-handle::after {
        content: '';
        display: block;
        width: 40px;
        height: 5px;
        background-color: #e0e0e0;
        border-radius: 10px;
    }

    .inv-dig-editor-sidebar.is-open {
        transform: translateY(0);
    }

    .sidebar-header {
        display: none !important;
        /* Oculto en mÃ³vil para ganar espacio (decisiÃ³n UX) */
        justify-content: space-between;
        align-items: center;
    }

    .sidebar-header .close-panel-btn {
        display: block;
    }

    /* Overlay */
    .inv-dig-editor-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1001;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
        overscroll-behavior: contain;
        /* TambiÃ©n prevenir scroll en overlay */
    }

    .inv-dig-editor-overlay.is-open {
        opacity: 1;
        visibility: visible;
    }

    /* Ocultar encabezado contextual en mÃ³vil */
    .contextual-header {
        display: none !important;
    }

    /* FIX: Evitar que el contenido estire el sidebar innecesariamente */
    .sidebar-content {
        display: block !important;
        /* FIX: Usar block en vez de grid para asegurar altura correcta */
        flex-grow: 1;
        /* Permitir crecer */
        overflow-y: auto;
        /* Scroll interno para el contenido */
        overscroll-behavior-y: contain;
        /* El scroll termina aquÃ­, no pasa al body */
        -webkit-overflow-scrolling: touch;
        /* Scroll suave en iOS */
        padding-bottom: 20px;
        /* Espacio extra al final */
    }

    /* FIX CRÃTICO: En mÃ³vil, el panel oculto debe desaparecer del flujo para que la altura se recalcule */
    #inv-dig-global-settings.is-hidden,
    #inv-dig-contextual-settings.is-hidden {
        display: none !important;
    }

    /* FIX: Evitar doble scrollbar. El scroll lo maneja .sidebar-content */
    .sidebar-panel {
        overflow-y: visible !important;
        height: auto !important;
    }

    /* FIX: Textarea UX Mejorada (Auto-grow overrides) */
    .editor-field textarea {
        min-height: 100px;
        /* Altura inicial cÃ³moda */
        resize: none;
        /* Ocultar tirador nativo (usaremos auto-grow) */
        overflow-y: hidden;
        /* Ocultar scrollbar mientras crece */
        line-height: 1.4;
        /* AJUSTE: Reducido de 1.6 a 1.4 */
        font-size: 16px;
        /* Evitar zoom en iOS y mejorar lectura */
        padding: 12px;
        transition: height 0.1s ease;
        box-sizing: border-box;
    }

    /* Contador de caracteres */
    .char-count {
        display: block;
        text-align: right;
        font-size: 0.85em;
        color: #888;
        margin-top: 4px;
    }

    .char-count.warning {
        color: #ff9800;
    }

    .char-count.limit-reached {
        color: #f44336;
        font-weight: bold;
    }
}

/* Estilos para la parrilla de 3 columnas de FilePond */
.filepond-gallery-grid .filepond--list {
    display: flex;
    flex-wrap: wrap;
}

.filepond-gallery-grid .filepond--item {
    width: calc(33.33% - .5em);
    margin-right: .5em;
}

.editor-field {
    padding: 6px 0px 6px 0px;
}

/* Estilos del AcordeÃƒÂ³n */
.inv-dig-accordion .accordion-item {
    border-bottom: 1px solid #e0e0e0;
}

.inv-dig-accordion .accordion-item:last-child {
    border-bottom: none;
}

.inv-dig-accordion .accordion-title {
    padding: 15px;
    cursor: pointer;
    margin: 0;
    font-size: 1em;
    font-weight: 600;
    display: flex;
    justify-content: flex-start !important;
    /* Forzar inicio */
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s ease;
    text-align: left !important;
    width: 100%;
    box-sizing: border-box;
}

.inv-dig-accordion .accordion-title:hover {
    background-color: #f9f9f9;
}

.inv-dig-accordion .accordion-title::after {
    content: '+';
    font-size: 1.2em;
    font-weight: bold;
    transition: transform 0.2s ease;
    margin-left: auto;
    /* Empuja el icono al final a la derecha */
}

.inv-dig-accordion .accordion-item.is-open .accordion-title::after {
    transform: rotate(45deg);
}

.inv-dig-accordion .accordion-content {
    padding: 0 15px 15px 15px;
    display: none;
    /* Oculto por defecto */
    border-top: 1px solid #e0e0e0;
    background-color: #fafafa;
}

/* Estilos para el input de cantidad (tamaÃƒÂ±o de fuente) */
.quantity-input {
    display: flex;
    align-items: center;
}

.quantity-input .font-size-input {
    -moz-appearance: textfield;
    text-align: center;
    width: 60px;
    border-left: none;
    border-right: none;
    border-radius: 0;
}

.quantity-input .font-size-input::-webkit-outer-spin-button,
.quantity-input .font-size-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-input .button {
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 1.2em;
    line-height: 36px;
    cursor: pointer;
    border-color: #ddd;
}

button.quantity-minus.button {
    background: none !important;
    color: #141414 !important;
    height: 42px;
    border-color: #dedede !important;
}

button.quantity-plus.button {
    background: none !important;
    color: #141414 !important;
    height: 42px;
    border-color: #dedede !important;
}

button#inv-dig-add-tienda-btn {
    background: none;
    color: #141414;
    border-color: #939393;
}

button.button.inv-dig-remove-tienda-btn {
    background: none;
    color: #141414;
    border-color: #939393;
}

/* NUEVO: Estilos para campos en lÃƒÂ­nea */
.inline-fields {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.inline-fields .editor-field {
    flex: 1;
}

.quantity-input .quantity-minus {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.quantity-input .quantity-plus {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Panel de Controles Contextual */
.contextual-controls-panel {
    display: none;
    /* Oculto por defecto */
    /* Los estilos de posicionamiento absoluto fueron eliminados para integrar
       este panel dentro del flujo normal del sidebar unificado. */
}

.contextual-controls-panel .inline-fields {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.contextual-controls-panel .inline-fields .editor-field {
    flex: 1;
    padding-bottom: 0;
}

.contextual-controls-panel .inline-fields .editor-field label {
    font-size: 0.9em;
    margin-bottom: 2px;
}

.contextual-controls-panel .inline-fields .editor-field select {
    width: 100%;
}

/* Estilos para Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    vertical-align: middle;
}

/* --- NUEVO: Transiciones para paneles del Sidebar --- */
#inv-dig-global-settings,
#inv-dig-contextual-settings {
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

#inv-dig-global-settings.is-hidden,
#inv-dig-contextual-settings.is-hidden {
    opacity: 0;
    transform: translateX(10px);
    pointer-events: none;
    /* Evita interacciÃƒÂ³n cuando estÃƒÂ¡ oculto */
}

/* --- NUEVO: Estilos para el header y botÃƒÂ³n de cierre contextual --- */
.contextual-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 15px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 15px;
}

.contextual-header h4 {
    margin: 0;
    font-size: 1.1em;
}

/* NUEVO: Estilo unificado para botones de cierre */
.inv-dig-close-btn {
    background: transparent;
    border: none;
    color: #555;
    font-size: 1.8em;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease, background-color 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.inv-dig-close-btn:hover {
    transform: scale(1.15);
    background-color: rgba(0, 0, 0, 0.05);
}

/* El estilo .inv-dig-close-context-btn ya no es necesario, se usa .inv-dig-close-btn */


.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: #2196F3;
    /* Color azul cuando estÃƒÂ¡ activo */
}

input:checked+.toggle-slider:before {
    transform: translateX(22px);
}

/* Contenedor para alinear texto y toggle */
.editor-field-toggle {
    display: flex;
    align-items: center;
    padding: 8px 0;
    gap: 10px;
}

.editor-field-toggle span {
    margin: 0;
}

/* --- NUEVO: Estilos para Controles de Zoom --- */
.inv-dig-zoom-controls {
    position: absolute;
    top: 15px;
    right: 30px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    /* RESTAURADO: Vertical */
    align-items: center;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 8px 4px;
}

/* Ocultar el lÃ¡piz flotante en mÃ³vil mediante selector externo para no anidar si no es necesario */
@media (max-width: 768px) {
    #edit-text-button {
        display: none !important;
    }
}

.inv-dig-zoom-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background-color: #fff;
    font-size: 1.4em;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    color: #333;
    transition: background-color 0.2s;
    margin: 4px 0;
    /* Espacio entre botones */
}

button#zoom-out-btn,
button#zoom-in-btn {
    border-radius: 50px;
    /* Hacerlos mÃƒÂ¡s ovalados si se desea, o mantener 50% para circular */
    border: 0px;
    /* Eliminar el borde */
}

.inv-dig-zoom-btn:hover {
    background-color: #f5f5f5;
    color: #333;
}

/* =========================================
   DISEÃ‘O "CRISTAL + ONDAS" (Glassmorphism)
   ========================================= */

/* 1. Fondo con Ondas SVG */
.inv-dig-editor-container {
    /* Base suave */
    background-color: #f8f9fa;
    /* Ondas SVG (Optimizado) */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%23e2e8f0' fill-opacity='0.7' d='M0,192L48,197.3C96,203,192,213,288,229.3C384,245,480,267,576,250.7C672,235,768,181,864,181.3C960,181,1056,235,1152,234.7C1248,235,1344,181,1392,154.7L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3Cpath fill='%23cbd5e1' fill-opacity='0.4' d='M0,256L48,245.3C96,235,192,213,288,192C384,171,480,149,576,160C672,171,768,213,864,224C960,235,1056,213,1152,192C1248,171,1344,149,1392,138.7L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E");
    background-size: cover;
    background-position: bottom;
    background-repeat: no-repeat;
}

/* 2. Efecto Cristal en Sidebar */
.inv-dig-editor-sidebar {
    background: rgba(255, 255, 255, 0.75);
    /* Blanco semitransparente */
    backdrop-filter: blur(12px);
    /* Desenfoque del fondo */
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.03);
    /* Sombra muy suave */
}

/* 3. Canvas Wrapper Transparente (para ver las ondas) */
.inv-dig-canvas-wrapper {
    background: transparent !important;
    /* Sobrescribir el gris plano */
}

/* 4. Sombra flotante para el Canvas (lo hace resaltar) */
.inv-dig-canvas-wrapper canvas,
.upper-canvas {
    box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07) !important;
    border-radius: 4px;
}

/* 5. Ajustes para MÃ³vil (Header y Footer Cristal) */
@media (max-width: 768px) {

    .inv-dig-header-mobile,
    .inv-dig-editor-footer {
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-color: rgba(255, 255, 255, 0.5);
    }

    .inv-dig-editor-sidebar {
        background: rgba(255, 255, 255, 0.95);
        /* MÃ¡s opaco en mÃ³vil para legibilidad */
    }
}

/* FIX: Asegurar que las sugerencias de Google Maps (PAC) estÃ©n por encima del sidebar y modales */
.pac-container {
    z-index: 100000 !important;
    /* Valor muy alto para superar cualquier modal o sidebar */
}

/* --- Custom Reset Modal --- */
.inv-dig-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 11000;
    /* Higher than sidebar */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.inv-dig-modal-overlay.is-visible {
    display: flex;
    opacity: 1;
}

.inv-dig-modal {
    background: #fff;
    width: 90%;
    max-width: 400px;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.inv-dig-modal-overlay.is-visible .inv-dig-modal {
    transform: scale(1);
}

.inv-dig-modal h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    font-size: 1.25em;
    font-weight: 600;
}

.inv-dig-modal p {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
    font-size: 0.95em;
}

.inv-dig-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.inv-dig-btn-secondary {
    background: #f0f0f1;
    color: #333;
    border: 1px solid #ccc;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.inv-dig-btn-secondary:hover {
    background: #e5e5e5;
    border-color: #bbb;
}

.inv-dig-btn-danger {
    background: #d63638;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(214, 54, 56, 0.3);
    transition: all 0.2s;
}

.inv-dig-btn-danger:hover {
    background: #b32d2e;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(214, 54, 56, 0.4);
}

/* --- Alignment Buttons --- */
.inv-dig-align-group {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 10px;
    background: #f0f0f1;
    border-radius: 8px;
    padding: 4px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.inv-dig-align-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 6px 10px;
    border-radius: 6px;
    color: #666;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inv-dig-align-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.inv-dig-align-btn.active {
    background: #fff;
    color: #2196F3;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* --- Watermark Protection --- */
.inv-dig-canvas-wrapper {
    position: relative;
}

/* NEW: Wrapper to handle overflow clipping */
.inv-dig-watermark-wrapper {
    display: none;
    /* Oculto temporariamente por petición UX */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.inv-dig-watermark-overlay {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    pointer-events: none;
    opacity: 0.15;
    background-repeat: repeat;
    background-position: center;
    background-size: 150px;
    mix-blend-mode: multiply;
    transform: rotate(-15deg);
}

.inv-dig-watermark-overlay.is-textual {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 200'%3E%3Ctext x='50%25' y='50%25' font-size='20' fill='rgb(0,0,0)' font-family='Arial' transform='rotate(-45 100 100)' text-anchor='middle' opacity='0.5'%3EVISTA PREVIA%3C/text%3E%3C/svg%3E");
    background-size: 100px 100px;
}

/* --- NUEVO: Estilos para el Modal de Instrucciones --- */
.inv-dig-modal.is-instructions {
    max-width: 400px;
    text-align: left;
    padding: 30px;
}

.inv-dig-modal.is-instructions h4 {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
    font-size: 1.3em;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
    padding: 10px;
    background: #fdfdfd;
    border-radius: 12px;
    border: 1px solid #f0f0f0;
}

.instruction-icon {
    font-size: 1.8em;
    flex-shrink: 0;
    line-height: 1;
}

.instruction-text {
    font-size: 0.95em;
    line-height: 1.5;
    color: #444;
}

.instruction-text strong {
    display: block;
    color: #111;
    margin-bottom: 2px;
}

/* Botón primario para el modal */
.inv-dig-btn-primary {
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin-top: 10px;
}

.inv-dig-btn-primary:hover {
    background-color: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

#info-instructions-btn {
    font-family: 'Georgia', serif;
    font-style: italic;
    font-weight: normal;
    font-size: 1.1em;
    text-transform: lowercase;
}