/**
 * 🎨 Styles pour le Mode Édition WYSIWYG
 * WebCraft Builder Pro V3.2
 */

/* ========================================
   TOOLBAR FLOTTANTE
   ======================================== */

#wysiwyg-toolbar {
    display: flex !important;
    gap: 0.25rem;
}

#wysiwyg-toolbar button:active {
    transform: scale(0.95) !important;
}

/* ========================================
   DRAG HANDLES (Poignées de déplacement)
   ======================================== */

.webcraft-drag-handle {
    transition: all 0.3s ease !important;
}

.webcraft-drag-handle:hover {
    background: rgba(0, 240, 255, 1) !important;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 240, 255, 0.5);
}

.webcraft-drag-handle:active {
    cursor: grabbing !important;
    transform: scale(0.95);
}

/* ========================================
   DROP INDICATOR (Ligne de drop)
   ======================================== */

.webcraft-drop-indicator {
    animation: pulse-drop 1s ease-in-out infinite;
}

.webcraft-drop-indicator::before {
    content: '↓ Déposer ici ↓';
    position: absolute;
    left: 50%;
    top: -20px;
    transform: translateX(-50%);
    background: rgba(0, 240, 255, 0.95);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ========================================
   ZONES DE DROP D'IMAGES
   ======================================== */

.webcraft-image-dropzone {
    position: relative;
}

.webcraft-image-dropzone::after {
    content: '🖼️ Déposez une image ici';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 240, 255, 0.95);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.webcraft-image-dropzone[style*="outline"]:not([style*="outline: none"])::after {
    opacity: 1;
}

/* ========================================
   IMAGES REDIMENSIONNABLES
   ======================================== */

.webcraft-resizable-image {
    display: inline-block;
    position: relative;
}

.webcraft-resizable-image:hover .resize-handle {
    opacity: 1 !important;
}

.resize-handle {
    position: absolute;
    transition: all 0.2s ease;
}

.resize-handle:hover {
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.8);
}

.resize-handle:active {
    transform: scale(1.1);
    background: #667eea !important;
}

/* ========================================
   MENU CONTEXTUEL
   ======================================== */

#webcraft-context-menu {
    animation: slideInContextMenu 0.2s ease;
}

@keyframes slideInContextMenu {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.context-menu-item:active {
    transform: scale(0.98);
}

/* ========================================
   SÉLECTION VISUELLE D'ÉLÉMENTS
   ======================================== */

[data-webcraft-selected="true"] {
    outline: 3px solid rgba(0, 240, 255, 0.8) !important;
    outline-offset: 4px;
    position: relative;
    z-index: 999;
}

[data-webcraft-selected="true"]::before {
    content: attr(data-element-type);
    position: absolute;
    top: -25px;
    left: 0;
    background: rgba(0, 240, 255, 0.95);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ========================================
   HOVER EFFECTS POUR MODE ÉDITION
   ======================================== */

[contenteditable="true"]:hover::after {
    content: '✏️';
    position: absolute;
    top: -20px;
    right: 0;
    background: rgba(0, 240, 255, 0.9);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
}

/* ========================================
   TOOLTIPS D'AIDE
   ======================================== */

.webcraft-tooltip {
    animation: bounceIn 0.3s ease;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.8);
    }
    50% {
        transform: translateY(-5px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========================================
   ANIMATIONS DE FEEDBACK
   ======================================== */

@keyframes element-saved {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
}

.webcraft-saved-flash {
    animation: element-saved 0.6s ease;
}

/* ========================================
   RESPONSIVE - AJUSTEMENTS MOBILE
   ======================================== */

@media (max-width: 768px) {
    .webcraft-drag-handle {
        padding: 0.5rem !important;
        font-size: 1.2rem !important;
    }
    
    .resize-handle {
        width: 16px !important;
        height: 16px !important;
    }
    
    #wysiwyg-toolbar {
        flex-wrap: wrap;
        max-width: 90vw;
    }
    
    #webcraft-context-menu {
        max-width: 90vw;
    }
}

/* ========================================
   GUIDES VISUELS & GRILLE
   ======================================== */

#webcraft-guides {
    pointer-events: none;
    opacity: 0.4;
}

/* ========================================
   ÉTATS DE DRAG
   ======================================== */

.dragging-section {
    opacity: 0.5 !important;
    border: 2px dashed #00f0ff !important;
    transform: rotate(2deg);
}

.drop-target-active {
    background: rgba(0, 240, 255, 0.1) !important;
    outline: 2px solid rgba(0, 240, 255, 0.6) !important;
    outline-offset: 8px;
}

/* ========================================
   IMAGES EN COURS DE DRAG DEPUIS OUTILS
   ======================================== */

.media-item img[draggable="true"] {
    cursor: grab !important;
}

.media-item img[draggable="true"]:active {
    cursor: grabbing !important;
}

/* ========================================
   TRANSITIONS SMOOTH POUR TOUT
   ======================================== */

.webcraft-drag-handle,
.resize-handle,
.webcraft-drop-indicator,
[contenteditable="true"],
.webcraft-image-dropzone {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   FOCUS ÉTATS AMÉLIORÉS
   ======================================== */

[contenteditable="true"]:focus {
    animation: focus-glow 0.3s ease;
}

@keyframes focus-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 240, 255, 0);
    }
    50% {
        box-shadow: 0 0 20px 5px rgba(0, 240, 255, 0.5);
    }
    100% {
        box-shadow: 0 0 20px 3px rgba(0, 240, 255, 0.3);
    }
}

