/**
 * Estilos para el Editor Integrado de Widgets
 * 
 * @package SM_Demo_Plugins
 * @since 1.2.0
 */

/* ========================================
   OVERLAY Y LAYOUT PRINCIPAL
   ======================================== */

.sm-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sm-editor-overlay.sm-editor-visible {
    opacity: 1;
    visibility: visible;
}

.sm-editor-layout {
    display: grid;
    grid-template-columns: 80px 1fr 1fr;
    height: 100vh;
    gap: 0;
}

/* ========================================
   SIDEBAR IZQUIERDO - Miniaturas
   ======================================== */

.sm-editor-sidebar {
    background: #1e1e1e;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sm-editor-sidebar-header {
    padding: 15px 10px;
    border-bottom: 1px solid #333;
    position: relative;
}

.sm-editor-sidebar-header h3 {
    color: #fff;
    font-size: 12px;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sm-close-editor {
    background: #ff4444;
    border: none;
    color: white;
    width: 100%;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.sm-close-editor:hover {
    background: #cc0000;
}

.sm-editor-sidebar-content {
    flex: 1;
    padding: 10px 5px;
}

.sm-plugin-sidebar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 5px;
    margin-bottom: 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.sm-plugin-sidebar-item:hover {
    background: #2a2a2a;
}

.sm-plugin-sidebar-item.active {
    background: #0073aa;
    border-color: #00a0d2;
}

.sm-plugin-sidebar-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sm-plugin-sidebar-icon img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

.sm-plugin-sidebar-icon i {
    font-size: 32px;
    color: #888;
}

.sm-plugin-sidebar-item.active .sm-plugin-sidebar-icon i {
    color: white;
}

.sm-plugin-sidebar-name {
    font-size: 10px;
    color: #aaa;
    text-align: center;
    word-wrap: break-word;
    max-width: 70px;
}

.sm-plugin-sidebar-item.active .sm-plugin-sidebar-name {
    color: white;
    font-weight: 600;
}

/* ========================================
   EXPLORADOR CENTRO - Widgets disponibles
   ======================================== */

.sm-editor-explorer {
    background: #252525;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
}

.sm-editor-explorer-header {
    padding: 20px;
    border-bottom: 1px solid #333;
}

.sm-editor-explorer-header h3 {
    color: #fff;
    font-size: 18px;
    margin: 0 0 15px 0;
}

.sm-editor-search {
    position: relative;
}

.sm-widget-search-input {
    width: 100%;
    padding: 10px 15px;
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
}

.sm-widget-search-input:focus {
    outline: none;
    border-color: #0073aa;
}

.sm-editor-explorer-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.sm-widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.sm-widget-card {
    background: #1e1e1e;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: grab;
    transition: all 0.3s ease;
}

.sm-widget-card:hover {
    border-color: #0073aa;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 115, 170, 0.3);
}

.sm-widget-card.sm-dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.sm-widget-icon {
    font-size: 32px;
    color: #0073aa;
    margin-bottom: 10px;
}

.sm-widget-name {
    font-size: 13px;
    color: #fff;
    margin-bottom: 5px;
    font-weight: 500;
}

.sm-widget-meta {
    font-size: 11px;
    color: #888;
}

.sm-loading,
.sm-error,
.sm-no-widgets {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 14px;
}

.sm-error {
    color: #ff4444;
}

/* ========================================
   CANVAS DERECHO - Dropzone
   ======================================== */

.sm-editor-canvas {
    background: #2d2d2d;
    display: flex;
    flex-direction: column;
}

.sm-editor-canvas-header {
    padding: 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sm-editor-canvas-header h3 {
    color: #fff;
    font-size: 18px;
    margin: 0;
}

.sm-editor-canvas-actions {
    display: flex;
    gap: 10px;
}

.sm-editor-canvas-actions button {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sm-clear-canvas {
    background: #ff4444;
    color: white;
}

.sm-clear-canvas:hover {
    background: #cc0000;
}

.sm-save-canvas {
    background: #00aa66;
    color: white;
}

.sm-save-canvas:hover {
    background: #008855;
}

.sm-editor-canvas-dropzone {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    position: relative;
}

.sm-editor-canvas-dropzone.sm-drag-over {
    background: rgba(0, 115, 170, 0.1);
    border: 2px dashed #0073aa;
}

.sm-canvas-empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #555;
}

.sm-canvas-empty-state i {
    font-size: 64px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.sm-canvas-empty-state p {
    font-size: 16px;
    margin: 0;
}

/* ========================================
   WIDGETS EN EL CANVAS
   ======================================== */

.sm-canvas-widget {
    background: #1e1e1e;
    border: 2px solid #444;
    border-radius: 8px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.sm-canvas-widget:hover {
    border-color: #0073aa;
    box-shadow: 0 3px 10px rgba(0, 115, 170, 0.2);
}

.sm-canvas-widget-ghost {
    opacity: 0.4;
}

.sm-canvas-widget-header {
    padding: 12px 15px;
    background: #252525;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sm-canvas-widget-handle {
    cursor: grab;
    color: #888;
    font-size: 16px;
}

.sm-canvas-widget-handle:active {
    cursor: grabbing;
}

.sm-canvas-widget-title {
    flex: 1;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.sm-canvas-widget-actions {
    display: flex;
    gap: 5px;
}

.sm-canvas-widget-actions button {
    background: transparent;
    border: 1px solid #444;
    color: #aaa;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sm-canvas-widget-settings:hover {
    background: #0073aa;
    border-color: #0073aa;
    color: white;
}

.sm-canvas-widget-delete:hover {
    background: #ff4444;
    border-color: #ff4444;
    color: white;
}

.sm-canvas-widget-preview {
    padding: 20px;
}

.sm-widget-preview-placeholder {
    text-align: center;
    padding: 40px;
    background: #252525;
    border: 2px dashed #444;
    border-radius: 6px;
    color: #666;
}

.sm-widget-preview-placeholder i {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.3;
}

.sm-widget-preview-placeholder p {
    margin: 0;
    font-size: 14px;
}

/* ========================================
   NOTIFICACIONES
   ======================================== */

.sm-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 9999999;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.sm-notification.sm-notification-visible {
    opacity: 1;
    transform: translateX(0);
}

.sm-notification-success {
    background: #00aa66;
    color: white;
}

.sm-notification-error {
    background: #ff4444;
    color: white;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1200px) {
    .sm-editor-layout {
        grid-template-columns: 70px 1fr 1fr;
    }

    .sm-widgets-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

@media (max-width: 768px) {
    .sm-editor-layout {
        grid-template-columns: 60px 1fr;
    }

    .sm-editor-explorer {
        position: absolute;
        top: 0;
        left: 60px;
        width: 300px;
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 10;
    }

    .sm-editor-explorer.sm-explorer-visible {
        transform: translateX(0);
    }

    .sm-editor-canvas {
        grid-column: 2 / 3;
    }
}

/* ========================================
   ANIMACIONES
   ======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sm-plugin-sidebar-item,
.sm-widget-card,
.sm-canvas-widget {
    animation: fadeInUp 0.3s ease;
}

/* ========================================
   MODO ELEMENTOR (cuando se usa en Elementor)
   ======================================== */

.elementor-editor-active .sm-plugin-item-trigger {
    cursor: default;
    pointer-events: none;
}

.elementor-editor-active .sm-plugin-item-trigger::after {
    content: 'Vista previa en Elementor';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.elementor-editor-active .sm-plugin-item-trigger:hover::after {
    opacity: 1;
}

/* ========================================
   SCROLLBAR PERSONALIZADO
   ======================================== */

.sm-editor-sidebar::-webkit-scrollbar,
.sm-editor-explorer-content::-webkit-scrollbar,
.sm-editor-canvas-dropzone::-webkit-scrollbar {
    width: 8px;
}

.sm-editor-sidebar::-webkit-scrollbar-track,
.sm-editor-explorer-content::-webkit-scrollbar-track,
.sm-editor-canvas-dropzone::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.sm-editor-sidebar::-webkit-scrollbar-thumb,
.sm-editor-explorer-content::-webkit-scrollbar-thumb,
.sm-editor-canvas-dropzone::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

.sm-editor-sidebar::-webkit-scrollbar-thumb:hover,
.sm-editor-explorer-content::-webkit-scrollbar-thumb:hover,
.sm-editor-canvas-dropzone::-webkit-scrollbar-thumb:hover {
    background: #555;
}