/**
 * Estilos para el Widget Individual con Sistema de Capas
 * 
 * @package SM_Demo_Plugins
 * @since 1.2.0
 */

/* ========================================
   CONTENEDOR PRINCIPAL
   ======================================== */

.sm-plugin-item-wrapper {
    width: 100%;
    display: flex;
}

.sm-plugin-item-container {
    width: 100%;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sm-plugin-item-container.sm-plugin-item-trigger {
    cursor: pointer;
}

.sm-plugin-item-container.sm-plugin-item-trigger:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* ========================================
   CAPAS INDIVIDUALES
   ======================================== */

.sm-layer {
    transition: all 0.3s ease;
}

/* Imagen/Icono */
.sm-layer-image {
    line-height: 0;
}

.sm-layer-image img {
    transition: all 0.3s ease;
}

.sm-plugin-item-container:hover .sm-layer-image img {
    transform: scale(1.05);
}

/* Título */
.sm-layer-title {
    font-weight: 600;
    line-height: 1.3;
}

/* Subtítulo */
.sm-layer-subtitle {
    font-size: 14px;
    font-weight: 400;
}

/* Descripción */
.sm-layer-description {
    font-size: 15px;
    line-height: 1.7;
}

/* Meta Info */
.sm-layer-meta {
    font-size: 14px;
}

.sm-layer-meta i {
    color: inherit;
}

/* Precio */
.sm-layer-price {
    font-weight: 700;
    font-size: 20px;
}

/* Widgets Count */
.sm-layer-widgets-count {
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.sm-layer-widgets-count i {
    color: inherit;
}

/* Botón */
.sm-layer-button {
    margin-top: 15px;
}

.sm-plugin-button-link {
    display: inline-block;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sm-plugin-button-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Espaciador */
.sm-layer-spacer {
    width: 100%;
}

/* ========================================
   MODO EDITOR ACTIVADO
   ======================================== */

.sm-plugin-item-trigger::before {
    content: '🎨 Click para editar widgets';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 115, 170, 0.9);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sm-plugin-item-trigger:hover::before {
    opacity: 1;
}

/* En el editor de Elementor, ocultar el badge */
.elementor-editor-active .sm-plugin-item-trigger::before {
    display: none;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .sm-layer-title {
        font-size: 20px;
    }

    .sm-layer-subtitle {
        font-size: 12px;
    }

    .sm-layer-description {
        font-size: 14px;
    }

    .sm-layer-meta {
        font-size: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .sm-layer-image img {
        max-width: 60px !important;
    }
}

/* ========================================
   ANIMACIONES
   ======================================== */

@keyframes fadeInLayer {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sm-layer {
    animation: fadeInLayer 0.4s ease;
}

.sm-layer:nth-child(1) {
    animation-delay: 0.05s;
}

.sm-layer:nth-child(2) {
    animation-delay: 0.1s;
}

.sm-layer:nth-child(3) {
    animation-delay: 0.15s;
}

.sm-layer:nth-child(4) {
    animation-delay: 0.2s;
}

.sm-layer:nth-child(5) {
    animation-delay: 0.25s;
}

.sm-layer:nth-child(6) {
    animation-delay: 0.3s;
}

/* ========================================
   ESTADOS HOVER PERSONALIZADOS
   ======================================== */

.sm-plugin-item-container {
    position: relative;
    overflow: hidden;
}

.sm-plugin-item-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent 0%, rgba(0, 115, 170, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sm-plugin-item-container:hover::after {
    opacity: 1;
}

/* ========================================
   MODO ELEMENTOR (Vista previa)
   ======================================== */

.elementor-element .sm-plugin-item-container {
    min-height: 200px;
}

.elementor-editor-active .sm-plugin-item-trigger {
    cursor: default;
}

/* ========================================
   UTILITIES
   ======================================== */

/* Espaciado automático entre capas consecutivas */
.sm-layer+.sm-layer {
    margin-top: 15px;
}

.sm-layer:last-child {
    margin-bottom: 0 !important;
}

/* Alineaciones */
.sm-align-left {
    text-align: left;
    justify-content: flex-start;
}

.sm-align-center {
    text-align: center;
    justify-content: center;
}

.sm-align-right {
    text-align: right;
    justify-content: flex-end;
}

/* ========================================
   EFECTOS HOVER ADICIONALES
   ======================================== */

.sm-plugin-item-container:hover .sm-layer-title {
    color: #0073aa;
}

.sm-plugin-item-container:hover .sm-layer-button .sm-plugin-button-link {
    background-color: #005177;
}

/* ========================================
   LOADING STATE
   ======================================== */

.sm-plugin-item-container.loading {
    opacity: 0.6;
    pointer-events: none;
}

.sm-plugin-item-container.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1000;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .sm-plugin-item-trigger::before {
        display: none;
    }

    .sm-plugin-item-container {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}