/**
 * Popular & Random Posts Widget - Styles
 * Version: 2.0.1
 * Advanced layout, comments, updated posts and responsive features
 */

.popular-random-posts-wrapper {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.popular-random-posts-list {
    list-style: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* ===== LAYOUTS PARA DESKTOP ===== */

/* Layout Horizontal (por defecto) */
.prp-layout-horizontal .popular-random-post-item {
    display: flex;
    align-items: flex-start;
    flex-direction: row;
}

.prp-layout-horizontal .popular-random-post-thumb {
    margin-right: 15px;
    margin-bottom: 0;
    flex-shrink: 0;
}

/* Layout Vertical */
.prp-layout-vertical .popular-random-post-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.prp-layout-vertical .popular-random-post-thumb {
    margin-right: 0;
    margin-bottom: 12px;
    width: 100%;
    text-align: center;
}

.prp-layout-vertical .popular-random-post-thumb img {
    margin: 0 auto;
}

/* Layout Compacto (2 columnas) */
.prp-layout-compact .popular-random-posts-list {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.prp-layout-compact .popular-random-post-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    min-height: 120px;
}

.prp-layout-compact .popular-random-post-thumb {
    margin-right: 0;
    margin-bottom: 8px;
    text-align: center;
}

.prp-layout-compact .popular-random-post-content {
    text-align: center;
}

/* ===== ESTILOS BASE ===== */

.popular-random-post-item {
    margin-bottom: 0;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: #ffffff;
    box-sizing: border-box;
    overflow: hidden;
}

.popular-random-post-item:last-child {
    margin-bottom: 0;
}

.popular-random-post-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.popular-random-post-thumb {
    line-height: 0;
    flex-shrink: 0;
}

.popular-random-post-thumb img {
    border-radius: 4px;
    object-fit: cover;
    display: block;
    max-width: 100%;
    height: auto;
}

.popular-random-post-content {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

.popular-random-post-title {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.popular-random-post-title a {
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.popular-random-post-title a:hover {
    text-decoration: underline;
}

.popular-random-post-excerpt {
    margin: 0 0 5px 0;
    font-size: 12px;
    line-height: 1.4;
    color: #666;
}

.popular-random-post-views {
    font-size: 11px;
    color: #999;
    font-style: italic;
    display: block;
    margin-top: 5px;
}

/* Badge de actualizado */
.prp-updated-badge {
    background: #0073aa;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    margin-left: 5px;
}

/* ===== ESTILOS PARA COMENTARIOS ===== */

.prp-comments-wrapper .popular-random-post-item {
    align-items: flex-start;
}

.prp-comment-avatar {
    margin-right: 12px;
}

.prp-comment-avatar img {
    border-radius: 50% !important;
    width: 40px;
    height: 40px;
}

.prp-comment-title {
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 6px;
}

.prp-comment-author {
    font-weight: 600;
}

.prp-comment-excerpt {
    font-size: 12px;
    line-height: 1.4;
    margin: 5px 0;
    font-style: italic;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #e9ecef;
}

.prp-comment-date {
    font-size: 10px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-top: 5px;
}

/* ===== DISEÑOS PARA MÓVIL ===== */

@media (max-width: 768px) {
    
    /* Layout apilado (por defecto en móvil) */
    .prp-mobile-stack .popular-random-post-item {
        flex-direction: column !important;
        text-align: center;
    }
    
    .prp-mobile-stack .popular-random-post-thumb {
        margin-right: 0 !important;
        margin-bottom: 12px;
        align-self: center;
    }
    
    /* Layout horizontal en móvil */
    .prp-mobile-horizontal .popular-random-post-item {
        flex-direction: row !important;
        text-align: left;
    }
    
    .prp-mobile-horizontal .popular-random-post-thumb {
        margin-right: 12px !important;
        margin-bottom: 0;
    }
    
    /* Grid en móvil (2 columnas) - CORREGIDO */
    .prp-mobile-grid .popular-random-posts-list {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    
    .prp-mobile-grid .popular-random-post-item {
        flex-direction: column !important;
        text-align: center !important;
        margin-bottom: 0 !important;
        padding: 10px !important;
        display: flex !important;
    }
    
    .prp-mobile-grid .popular-random-post-thumb {
        margin-right: 0 !important;
        margin-bottom: 8px !important;
        align-self: center !important;
    }
    
    .prp-mobile-grid .popular-random-post-content {
        text-align: center !important;
    }
    
    /* Comentarios en móvil */
    .prp-mobile-stack .prp-comment-item {
        text-align: left;
    }
    
    .prp-mobile-stack .prp-comment-avatar {
        align-self: flex-start;
    }
    
    /* Ajustes generales para móvil */
    .popular-random-post-item {
        padding: 12px;
    }
    
    .popular-random-post-title {
        font-size: 13px;
        justify-content: center;
    }
    
    .popular-random-post-excerpt {
        font-size: 11px;
    }
    
    /* Badge en móvil */
    .prp-updated-badge {
        font-size: 8px;
        padding: 1px 4px;
    }
    
    /* Ajustes para comentarios en móvil */
    .prp-comment-title {
        font-size: 12px;
    }
    
    .prp-comment-excerpt {
        font-size: 11px;
        padding: 6px;
    }
    
    /* Layout compacto se convierte en una columna en móvil */
    .prp-layout-compact .popular-random-posts-list {
        grid-template-columns: 1fr !important;
    }
}

/* ===== MÓVIL PEQUEÑO ===== */

@media (max-width: 480px) {
    .popular-random-post-item {
        margin-bottom: 0;
        padding: 10px;
    }
    
    .popular-random-post-title {
        font-size: 12px;
        justify-content: center;
    }
    
    .popular-random-post-excerpt {
        font-size: 11px;
    }
    
    /* Grid se convierte en una columna en móviles muy pequeños - CORREGIDO */
    .prp-mobile-grid .popular-random-posts-list {
        grid-template-columns: 1fr !important;
    }
    
    /* Comentarios en móvil pequeño */
    .prp-comment-item {
        padding: 8px;
    }
    
    .prp-comment-avatar {
        margin-right: 8px;
    }
    
    .prp-comment-avatar img {
        width: 32px;
        height: 32px;
    }
    
    .prp-comment-title {
        font-size: 11px;
    }
    
    .prp-comment-excerpt {
        font-size: 10px;
        padding: 5px;
    }
    
    .prp-comment-date {
        font-size: 9px;
    }
    
    /* Badge en móvil pequeño */
    .prp-updated-badge {
        font-size: 7px;
        padding: 1px 3px;
    }
}

/* ===== ESTILOS PARA ALTA DENSIDAD ===== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .popular-random-post-thumb img {
        border-radius: 6px;
    }
    
    .prp-comment-avatar img {
        border-radius: 50% !important;
    }
}

/* ===== ACCESIBILIDAD ===== */

.popular-random-post-title a:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ===== SIN THUMBNAILS ===== */

.prp-no-thumbnails .popular-random-post-item {
    padding-left: 15px;
}

.prp-no-thumbnails .popular-random-post-content {
    width: 100%;
}