/**
 * MetaShare Pro Widget Styles
 * VERSIÓN 2.0 - COMPLETAMENTE REESCRITA
 * Arquitectura simple y robusta
 */

/* Box-sizing para todo */
.elementor-metashare-widget-wrapper,
.elementor-metashare-widget-wrapper * {
    box-sizing: border-box;
}

/* Wrapper del widget */
.elementor-metashare-widget-wrapper {
    position: relative;
    display: inline-flex;
    width: 100%;
    margin: 0;
    padding: 0;
    min-height: auto;
    background: transparent;
    z-index: auto;
    justify-content: center;
    align-items: center;
}

/* BACKDROP - Overlay oscuro detrás del modal */
.elementor-share-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.05s ease-in-out, visibility 0.05s ease-in-out;
}

/* Cuando el modal está visible, mostrar el backdrop */
.elementor-share-backdrop.elementor-show-modal {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* MODAL - La pieza crítica */
.elementor-share-modal {
    position: fixed;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: rgba(149, 157, 165, 0.2) 0 8px 24px;
    z-index: 999999;
    padding: 8px 2px;
    min-width: max-content;
    white-space: nowrap;
    width: auto;
    margin: 0;

    /* Animación de entrada */
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: visible;
    transition: opacity 0.05s ease-in-out, visibility 0.05s ease-in-out, max-height 0.05s ease-in-out;

    /* CRÍTICO: Sin valores hardcodeados de posición */
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;

    pointer-events: none;
}

/* Cuando el modal está visible */
.elementor-share-modal.elementor-show-modal {
    opacity: 1;
    visibility: visible;
    max-height: 1000px;
    pointer-events: auto;
}

/* Grid de iconos */
.elementor-icons-share {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    line-height: 5px;
    padding: 6px;
}

/* Icono individual */
.elementor-icon {
    flex: 1;
    margin: 0 6px;
    display: flex;
    flex-wrap: wrap;
    font-family: Roboto, sans-serif;
    font-size: 14px;
    gap: 4px;
    justify-content: center;
    text-align: center;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 6px 6px 2px 6px;
    border-radius: 6px;
}

.elementor-icon:hover {
    background-color: #f5f5f5;
    transform: scale(1.05);
}

/* Link dentro del icono */
.elementor-icon a {
    font-family: Roboto, sans-serif;
    width: 50px;
    max-width: 100%;
    text-decoration: none;
    margin-bottom: 4px;
    color: #0f0f0f;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    align-items: center;
    font-size: 13px;
}

/* Imagen del icono */
.elementor-icon img {
    max-width: 100%;
    height: auto;
    width: auto;
    margin-bottom: 3px;
}

/* Botón de compartir */
.elementor-share-button {
    position: relative;
    padding: 6px 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 999998;
}

/* Estilo del botón */
.elementor-btn-share {
    display: inline-flex;
    flex-wrap: nowrap;
    flex-direction: row;
    background-color: #ededed;
    padding: 6px 19px;
    border-radius: 50px;
    font-size: 15px;
    color: #000000;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: 0.4s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    z-index: 100;
    min-width: auto;
    height: auto;
}

.elementor-btn-share:hover {
    background-color: #e2e0e0;
    transform: translateY(-1px);
}

.elementor-btn-share:active {
    transform: translateY(0);
}

/* SVG dentro del botón */
.elementor-btn-share svg {
    width: 16px;
    height: 16px;
    margin-right: 3px;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

/* Texto del botón */
.elementor-btn-share span {
    display: inline;
    font-weight: 600;
    font-size: 14px;
    vertical-align: middle;
}

/* ===================================== */
/* RESPONSIVE */
/* ===================================== */

@media screen and (max-width: 768px) {
    .elementor-icons-share {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
        padding: 5px;
    }

    .elementor-icon {
        margin: 0 4px;
        padding: 5px;
    }

    .elementor-icon a {
        font-size: 9px;
    }
}

@media screen and (max-width: 500px) {
    .elementor-icons-share {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        padding: 5px;
        max-width: calc(100vw - 30px);
    }

    .elementor-icon {
        margin: 0 5px;
        padding: 5px;
    }

    .elementor-icon a {
        font-size: 9px;
    }

    .elementor-btn-share {
        padding: 4px 12px;
        font-size: 12px;
    }

    .elementor-btn-share svg {
        width: 16px;
    }

    .elementor-share-modal {
        max-width: calc(100vw - 30px);
    }
}

@media screen and (max-width: 378px) {
    .elementor-icon {
        margin: 0 4px;
    }

    .elementor-icon a {
        font-size: 8px;
        width: 35px;
    }
}

/* ===================================== */
/* ELEMENTOR EDITOR */
/* ===================================== */

.elementor-editor-active .elementor-metashare-widget-wrapper {
    position: relative;
}

.elementor-editor-active .elementor-share-modal {
    position: relative;
    top: auto;
    left: auto;
    margin-top: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.elementor-editor-active .elementor-share-button {
    position: relative;
}

.elementor-editor-active .elementor-share-backdrop {
    display: none;
}
