.top40-mensaje {
    background: #dff0d8;
    padding: 8px 10px;
    border-left: 3px solid #3c763d;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    font-size: 14px;
    margin-top: 10px;
    border-radius: 4px;
}

.top40-contenedor {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

.top40-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
}

.top40-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.top40-posicion {
    background: #212121;
    color: white;
    font-weight: bold;
    padding: 70px 15px;
    font-size: 18px;
    text-align: center;
    border-radius: 4px;
    min-width: 70px;
    flex-shrink: 0;
    order: 1;
}

.top40-item.posicion-1 .top40-posicion {
    background: #FF4438;
}

.top40-posicion .tendencia {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 8px;
    vertical-align: middle;
    text-indent: -9999px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.top40-posicion .tendencia.sube {
    background-image: url('https://los40.com/pf/resources/dist/img/ico-l-up.svg?d=820&mxId=00000000');
}

.top40-posicion .tendencia.baja {
    background-image: url('https://los40.com/pf/resources/dist/img/ico-l-dwn.svg?d=820&mxId=00000000');
}

.top40-posicion .tendencia.igual {
    background-image: url('https://los40.com/pf/resources/dist/img/ico-l-igu.svg?d=820&mxId=00000000');
}

.top40-cover {
    display: none;
    /* Ocultamos la imagen en móviles por espacio */
}

.top40-info {
    flex: 1;
    order: 2;
}

.top40-info-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.top40-titulo {
    font-size: 18px;
    font-weight: 700;
    text-align: left;
    order: 1;
    line-height: 1.3;
}

.top40-autor {
    font-size: 14px;
    color: #555;
    font-weight: normal;
    text-align: left;
    order: 2;
    line-height: 1.2;
}

.top40-voto {
    order: 3;
    text-align: left;
}

.top40-voto form {
    display: inline-block;
}

.top40-voto small {
    display: none !important;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.top40-voto button {
    background: #FF4438;
    color: white;
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    width: auto;
    max-width: none;
}

.top40-voto button.votado {
    background: #FF4438 !important;
    cursor: default;
}

.top40-voto button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.top40-arrow {
    cursor: pointer;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    background: aliceblue;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    order: 3;
    flex-shrink: 0;
}

.top40-arrow svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.top40-arrow.rotado svg {
    transform: rotate(180deg);
}

.top40-extra {
    display: none;
    background: #f9f9f9;
    border-top: 1px solid #ddd;
    padding: 15px;
    flex-direction: column;
    align-items: center;
}

.top40-estadisticas {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: space-between;
}

.top40-video {
    width: 100%;
    box-sizing: border-box;
}

.top40-video iframe {
    width: 100%;
    height: 200px;
    border: none;
    border-radius: 5px;
    max-width: 100%;
}

.top40-estadistica {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 12px;
}

.top40-estadistica strong {
    display: block;
    font-size: 11px;
    color: #333;
    font-weight: normal;
    margin-top: 3px;
    line-height: 1.2;
}

.top40-estadistica svg {
    width: 18px;
    height: 18px;
    margin: 3px auto;
    display: block;
    fill: #666;
}

.top40-estadistica span {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: #222;
}

.top40-estadistica img.top40-icono {
    width: 18px;
    height: 18px;
    margin: 3px auto;
    display: block;
}

.top40-estadistica-dato {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    justify-content: center;
}

.top40-estadistica-dato img {
    width: 18px;
    height: 18px;
}

.top40-estadistica-dato span {
    font-size: 14px;
    font-weight: bold;
    color: #222;
}

@media (min-width: 344px) {
    .top40-item {
        padding-right: 5px;
    }

    .top40-mensaje {
        width: 128%;
        font-size: 13px;
    }
}

@media (min-width: 360px) {
    .top40-mensaje {
        width: 125%
    }

    .top40-titulo {
        width: 120%;
    }

    .top40-header {
        padding-right: 10px;
    }
}

@media (min-width: 375px) {
    .top40-mensaje {
        width: 112%
    }

    .top40-item {
        padding-right: 10px;
    }
}

/* Media Queries para tablets y desktop */
@media (min-width: 768px) {
    .top40-header {
        flex-direction: row;
        align-items: center;
        gap: 0px;
    }

    .top40-posicion {
        width: 90px;
        padding: 45px 0;
        font-size: 22px;
        order: 1;
    }

    .top40-cover {
        display: flex;
        width: 120px;
        height: 123px;
        order: 2;
    }

    .top40-cover img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 4px;
    }

    .top40-info {
        flex: 1;
        padding-left: 25px;
        order: 3;
    }

    .top40-info-row {
        flex-direction: row;
        align-items: center;
        gap: 20px;
    }

    .top40-titulo {
        font-size: 22px;
        text-align: left;
        flex: 1;
    }

    .top40-autor {
        text-align: left;
        margin-top: 5px;
    }

    .top40-voto {
        order: 4;
        margin-top: 0;
        margin-left: auto;
    }

    .top40-voto button {
        width: auto;
    }

    .top40-voto small {
        display: none !important;
    }

    .top40-arrow {
        order: 5;
        margin: 0 0 0 10px;
    }

    .top40-extra {
        flex-direction: row;
    }

    .top40-estadisticas {
        flex: 1;
        margin-bottom: 0;
        padding-right: 20px;
        flex-direction: row;
        gap: 15px;
    }

    .top40-estadistica {
        flex: 1;
        text-align: center;
        min-width: 0;
    }

    .top40-video {
        flex: 1;
        padding-left: 20px;
    }

    .top40-item {
        padding-right: 0px;
    }

    .top40-mensaje{
        width: 100%;
    }
}

@media (min-width: 992px) {
    .top40-posicion {
        padding: 100px 0;
    }

    .top40-cover {
        width: 160px;
        height: 160px;
    }

    .top40-titulo {
        font-size: 26px;
    }

    .top40-voto small {
        display: none !important;
        font-size: 14px;
        color: #666;
        margin-top: 5px;
        text-align: center;
    }
}

@media (min-width: 1024px) {
    .top40-cover {
        height: 233px;
    }
}

@media (min-width: 1200px) {
    .top40-cover {
        width: 200px;
        height: 233px;
    }

    .top40-extra {
        min-height: 270px;
    }

    .top40-estadisticas {
        flex: 1 1 50%;
    }

    .top40-video {
        flex: 1 1 50%;
    }
}

.elementor img {
    border: none;
    border-radius: 0;
    box-shadow: none;
    height: auto;
    max-width: 80%;
}

/* Estilos para la administración del plugin */
.wp-admin .top40-votos-form {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    margin-bottom: 5px !important;
}

.wp-admin .top40-votos-form input[type="number"] {
    width: 60px !important;
    max-width: 60px !important;
    min-width: 60px !important;
    padding: 2px 6px !important;
    font-size: 12px !important;
    text-align: center !important;
    border: 1px solid #ddd !important;
    border-radius: 3px !important;
    height: 26px !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.wp-admin .top40-votos-form button {
    padding: 3px 6px !important;
    font-size: 12px !important;
    line-height: 1 !important;
    min-height: auto !important;
    height: 26px !important;
    border-radius: 3px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.wp-admin .top40-votos-form button:hover {
    background-color: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.wp-admin table.widefat td {
    vertical-align: top;
    padding: 8px 10px;
}

/* Mejorar visibilidad del icono del plugin en el admin */
.wp-admin #adminmenu .menu-icon-generic .wp-menu-image img {
    filter: brightness(0) invert(1) !important;
    opacity: 0.9 !important;
}

.wp-admin #adminmenu .menu-icon-generic:hover .wp-menu-image img,
.wp-admin #adminmenu .menu-icon-generic.wp-has-current-submenu .wp-menu-image img {
    filter: brightness(0) invert(1) !important;
    opacity: 1 !important;
}

.wp-admin .top40-manual-indicator {
    color: #0073aa;
    font-size: 10px;
    margin-left: 5px;
    cursor: help;
}