/* ==========================================================================
   ZIL WEB - LIVE VISUAL EDITOR 3.0 PRO MAX (UNIVERSAL FULL COVERAGE ENGINE)
   Every single text, heading, button, badge, price, card, modal & link is editable
   ========================================================================== */

:root {
    --zil-editor-gold: #E5C158;
    --zil-editor-gold-glow: rgba(229, 193, 88, 0.45);
    --zil-editor-bg: rgba(10, 10, 14, 0.96);
    --zil-editor-border: rgba(229, 193, 88, 0.35);
    --zil-editor-radius: 12px;
}

/* 1. Resaltado UNIVERSAL de TODOS los Elementos Editables cuando Modo Editor = ON */
body.zil-editor-active [contenteditable="true"] {
    outline: 1.5px dashed rgba(229, 193, 88, 0.55) !important;
    outline-offset: 2px;
    background-color: rgba(229, 193, 88, 0.05) !important;
    border-radius: 4px;
    cursor: text !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    transition: background-color 0.15s ease, outline 0.15s ease, box-shadow 0.15s ease;
    display: inline-block;
    min-width: 12px;
}

/* Evitar que elementos block se rompan al poner inline-block */
body.zil-editor-active p[contenteditable="true"],
body.zil-editor-active h1[contenteditable="true"],
body.zil-editor-active h2[contenteditable="true"],
body.zil-editor-active h3[contenteditable="true"],
body.zil-editor-active h4[contenteditable="true"],
body.zil-editor-active h5[contenteditable="true"],
body.zil-editor-active h6[contenteditable="true"],
body.zil-editor-active div[contenteditable="true"],
body.zil-editor-active blockquote[contenteditable="true"],
body.zil-editor-active li[contenteditable="true"] {
    display: block;
}

body.zil-editor-active [contenteditable="true"]:hover {
    outline: 1.5px solid var(--zil-editor-gold) !important;
    background-color: rgba(229, 193, 88, 0.14) !important;
    box-shadow: 0 0 10px rgba(229, 193, 88, 0.2);
}

body.zil-editor-active [contenteditable="true"]:focus {
    outline: 2px solid var(--zil-editor-gold) !important;
    outline-offset: 3px;
    background-color: rgba(229, 193, 88, 0.22) !important;
    box-shadow: 0 0 22px var(--zil-editor-gold-glow);
}

/* Protección de interacción en enlaces y botones mientras se edita */
body.zil-editor-active a,
body.zil-editor-active button,
body.zil-editor-active .quiz-option-btn,
body.zil-editor-active .oraculo-cat-card,
body.zil-editor-active .theme-card,
body.zil-editor-active .bg-mode-chip,
body.zil-editor-active .channel-card,
body.zil-editor-active .faq-question {
    cursor: text !important;
}

/* 2. Barra Principal de Control del Editor (Editor Dock Toolbar) */
#zil-editor-toolbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999990;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--zil-editor-bg);
    border: 1px solid var(--zil-editor-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 7px 14px;
    border-radius: 50px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.9), 0 0 25px rgba(229, 193, 88, 0.25);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.82rem;
    color: #FFF;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 98vw;
    flex-wrap: nowrap;
}

#zil-editor-toolbar:hover {
    border-color: var(--zil-editor-gold);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.95), 0 0 35px rgba(229, 193, 88, 0.4);
}

.zil-editor-brand {
    color: var(--zil-editor-gold);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.zil-editor-stats-badge {
    background: rgba(229, 193, 88, 0.15);
    color: var(--zil-editor-gold);
    border: 1px solid rgba(229, 193, 88, 0.3);
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
}

.zil-editor-group {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.zil-editor-group:last-child {
    border-right: none;
    padding-right: 0;
}

.zil-editor-btn {
    background: rgba(255, 255, 255, 0.07);
    color: #F0F0F0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 6px 11px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.zil-editor-btn:hover:not(:disabled) {
    background: var(--zil-editor-gold);
    color: #08080C;
    border-color: var(--zil-editor-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(229, 193, 88, 0.35);
}

.zil-editor-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.06);
}

.zil-editor-btn.active {
    background: var(--zil-editor-gold);
    color: #08080C;
    font-weight: 700;
    border-color: var(--zil-editor-gold);
    box-shadow: 0 0 15px var(--zil-editor-gold-glow);
}

.zil-editor-btn.primary {
    background: linear-gradient(135deg, #E5C158, #D4AF37);
    color: #08080C;
    border-color: #E5C158;
    font-weight: 700;
}

.zil-editor-btn.primary:hover {
    background: linear-gradient(135deg, #FFE082, #E5C158);
    box-shadow: 0 0 18px rgba(229, 193, 88, 0.6);
}

.zil-editor-btn.danger:hover {
    background: #EF4444;
    color: #FFF;
    border-color: #EF4444;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

/* Dropdown para Modales */
.zil-dropdown {
    position: relative;
    display: inline-block;
}

.zil-dropdown-menu {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #0E0E16;
    border: 1px solid var(--zil-editor-border);
    border-radius: 12px;
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.9);
    z-index: 9999999;
}

.zil-dropdown.open .zil-dropdown-menu {
    display: flex;
}

.zil-dropdown-item {
    background: transparent;
    border: none;
    color: #E2E8F0;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 0.76rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.zil-dropdown-item:hover {
    background: rgba(229, 193, 88, 0.18);
    color: var(--zil-editor-gold);
}

/* 3. Floating Bubble Menu (Notion/Medium Text Selection Toolbar) */
#zil-bubble-menu {
    position: absolute;
    z-index: 9999995;
    display: none;
    align-items: center;
    gap: 3px;
    background: rgba(12, 12, 18, 0.96);
    border: 1px solid var(--zil-editor-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 5px 8px;
    border-radius: 30px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(229, 193, 88, 0.3);
    font-family: 'Plus Jakarta Sans', sans-serif;
    transform: translate(-50%, -100%) translateY(-10px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: auto;
}

#zil-bubble-menu.visible {
    display: flex;
}

#zil-bubble-menu::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: rgba(12, 12, 18, 0.96) transparent transparent transparent;
}

.zil-bubble-btn {
    background: transparent;
    border: none;
    color: #E2E8F0;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.zil-bubble-btn:hover {
    background: rgba(229, 193, 88, 0.2);
    color: var(--zil-editor-gold);
}

.zil-bubble-btn.active {
    background: var(--zil-editor-gold);
    color: #08080C;
}

.zil-bubble-separator {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 2px;
}

/* 4. Asset Swapper (Hover Overlay sobre Imágenes) */
.zil-image-container-active {
    position: relative !important;
}

.zil-image-swap-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 99999;
    background: rgba(10, 10, 14, 0.9);
    border: 1px solid var(--zil-editor-gold);
    color: #FFF;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7), 0 0 12px var(--zil-editor-gold-glow);
    transition: all 0.2s ease;
    opacity: 0.85;
}

.zil-image-swap-badge:hover {
    opacity: 1;
    background: var(--zil-editor-gold);
    color: #08080C;
    transform: scale(1.05);
}

/* 5. Card & Block Action Controls (Reorder, Duplicate, Hide, Delete) */
.zil-card-target {
    position: relative !important;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

.zil-card-hidden {
    opacity: 0.35 !important;
    filter: grayscale(80%) !important;
    outline: 2px dashed rgba(239, 68, 68, 0.6) !important;
}

.zil-card-actions {
    position: absolute;
    top: -12px;
    right: 14px;
    z-index: 99998;
    display: none;
    align-items: center;
    gap: 4px;
    background: rgba(10, 10, 14, 0.94);
    border: 1px solid var(--zil-editor-border);
    backdrop-filter: blur(12px);
    padding: 3px 6px;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8);
}

body.zil-editor-active .zil-card-target:hover .zil-card-actions {
    display: flex;
}

.zil-card-action-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #E2E8F0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.72rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.zil-card-action-btn:hover {
    background: var(--zil-editor-gold);
    color: #08080C;
    border-color: var(--zil-editor-gold);
    transform: scale(1.15);
}

.zil-card-action-btn.delete:hover {
    background: #EF4444;
    color: #FFF;
    border-color: #EF4444;
}

/* 6. Modal de Reemplazo de Imagen */
#zil-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

#zil-image-modal.show {
    display: flex;
}

.zil-modal-box {
    background: #0E0E14;
    border: 1px solid var(--zil-editor-gold);
    border-radius: var(--zil-editor-radius);
    padding: 24px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(229, 193, 88, 0.3);
    color: #FFF;
    animation: zilModalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zilModalPop {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.zil-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(229, 193, 88, 0.2);
}

.zil-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--zil-editor-gold);
}

.zil-modal-close {
    background: transparent;
    border: none;
    color: #94A3B8;
    font-size: 1.2rem;
    cursor: pointer;
}

.zil-modal-close:hover {
    color: #FFF;
}

.zil-upload-dropzone {
    border: 2px dashed rgba(229, 193, 88, 0.4);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    background: rgba(229, 193, 88, 0.03);
    cursor: pointer;
    margin-bottom: 14px;
    transition: all 0.2s ease;
}

.zil-upload-dropzone:hover {
    border-color: var(--zil-editor-gold);
    background: rgba(229, 193, 88, 0.08);
}

.zil-modal-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px 14px;
    color: #FFF;
    font-size: 0.85rem;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.zil-modal-input:focus {
    outline: none;
    border-color: var(--zil-editor-gold);
    box-shadow: 0 0 10px rgba(229, 193, 88, 0.3);
}

.zil-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 7. Viewport Simulation Frames (Desktop / Tablet / Mobile) */
body.zil-viewport-mobile #site-container,
body.zil-viewport-mobile main,
body.zil-viewport-mobile .experiencias-section,
body.zil-viewport-mobile .quiz-section,
body.zil-viewport-mobile .funciona-section,
body.zil-viewport-mobile .testimonios-section,
body.zil-viewport-mobile .sobre-liz-section,
body.zil-viewport-mobile .contenido-section,
body.zil-viewport-mobile .faq-section,
body.zil-viewport-mobile .cta-final-section {
    max-width: 414px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

body.zil-viewport-tablet #site-container,
body.zil-viewport-tablet main,
body.zil-viewport-tablet .experiencias-section,
body.zil-viewport-tablet .quiz-section,
body.zil-viewport-tablet .funciona-section,
body.zil-viewport-tablet .testimonios-section,
body.zil-viewport-tablet .sobre-liz-section,
body.zil-viewport-tablet .contenido-section,
body.zil-viewport-tablet .faq-section,
body.zil-viewport-tablet .cta-final-section {
    max-width: 768px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* 8. Toast de Notificaciones */
#zil-editor-toast {
    position: fixed;
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 99999999;
    background: rgba(14, 12, 20, 0.96);
    border: 1px solid var(--zil-editor-gold);
    color: #FFF;
    padding: 9px 20px;
    border-radius: 30px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.8), 0 0 20px rgba(229, 193, 88, 0.3);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

#zil-editor-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
    #zil-editor-toolbar {
        bottom: 10px;
        padding: 5px 8px;
        gap: 4px;
        border-radius: 20px;
        overflow-x: auto;
    }
    .zil-editor-brand span {
        display: none;
    }
}
