/**
 * BreachFeed Recent Articles - Responsive Styles
 * Fixes mobile responsiveness issues
 */

/* Container layout */
.breachfeed-recent-articles {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

.breachfeed-articles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 24px;
    margin-top: 20px;
    padding: 0 15px; /* Add padding on mobile */
}

/* Article card */
.breachfeed-article {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.breachfeed-article:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Article image */
.breachfeed-article-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.breachfeed-article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Article content */
.breachfeed-article-content {
    padding: 20px;
}

.breachfeed-article-content h4 {
    margin: 0 0 12px 0;
    font-size: 18px;
    line-height: 1.4;
}

.breachfeed-article-content h4 a {
    color: #333;
    text-decoration: none;
}

.breachfeed-article-content h4 a:hover {
    color: #007cba;
}

/* Article meta */
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #666;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.article-meta .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

/* Article description */
.article-description {
    font-size: 15px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 15px;
}

/* Article tags */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.article-tag {
    display: inline-block;
    padding: 4px 10px;
    background: #f0f0f0;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
}

.article-tag.severity {
    background: #ffeaa7;
    color: #333;
}

.article-tag.incident {
    background: #fab1a0;
    color: #333;
}

.article-tag.cve {
    background: #74b9ff;
    color: #fff;
}

.article-tag.tech {
    background: #a29bfe;
    color: #fff;
}

.article-tag.industry {
    background: #00b894;
    color: #fff;
}

/* Article actions */
.article-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.article-read-more,
.article-source-link {
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.article-read-more {
    color: #007cba;
}

.article-source-link {
    color: #666;
}

.article-read-more:hover,
.article-source-link:hover {
    text-decoration: underline;
}

/* Severity badge */
.article-severity-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 1;
}

.breachfeed-article {
    position: relative;
}

/* Responsive styles for mobile */
@media screen and (max-width: 768px) {
    .breachfeed-recent-articles {
        margin: 0 -15px; /* Compensate for container padding */
    }
    
    .breachfeed-articles-container {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0 15px;
    }
    
    .breachfeed-article {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }
    
    .breachfeed-article-content {
        padding: 16px;
    }
    
    .breachfeed-article-content h4 {
        font-size: 16px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    .article-meta {
        font-size: 13px;
    }
    
    .article-description {
        font-size: 14px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .article-tag {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .article-actions {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .article-read-more,
    .article-source-link {
        font-size: 13px;
    }
}

@media screen and (max-width: 480px) {
    .breachfeed-recent-articles {
        width: 100vw;
        margin: 0 -10px;
    }
    
    .breachfeed-articles-container {
        gap: 12px;
        padding: 0 10px;
        grid-template-columns: 1fr !important;
    }
    
    .breachfeed-article {
        width: 100%;
        max-width: 100%;
    }
    
    .breachfeed-article-image {
        height: 150px;
    }
    
    .breachfeed-article-content {
        padding: 12px;
    }
    
    .breachfeed-article-content h4 {
        font-size: 15px;
        margin-bottom: 10px;
        line-height: 1.3;
    }
    
    .article-meta {
        font-size: 12px;
        gap: 10px;
    }
    
    .article-tags {
        gap: 6px;
    }
    
    .article-severity-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
}

/* Ensure images don't break layout */
.breachfeed-article-image img {
    max-width: 100%;
    height: auto;
}

/* Fix for WordPress themes that might interfere */
.breachfeed-recent-articles * {
    box-sizing: border-box;
}

.breachfeed-recent-articles a {
    transition: color 0.2s ease;
}

/* Additional mobile fixes */
@media screen and (max-width: 768px) {
    /* Prevent horizontal overflow */
    body {
        overflow-x: hidden !important;
    }
    
    /* Fix article card width */
    .breachfeed-article {
        max-width: calc(100vw - 30px);
        overflow: hidden;
    }
    
    /* Ensure all text wraps properly */
    .breachfeed-article h4,
    .breachfeed-article p,
    .breachfeed-article a {
        word-break: break-word;
        overflow-wrap: break-word;
        -webkit-hyphens: auto;
        -ms-hyphens: auto;
        hyphens: auto;
    }
    
    /* Fix tag overflow */
    .article-tags {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Ensure meta information doesn't overflow */
    .article-meta {
        max-width: 100%;
    }
    
    /* Fix for themes that use fixed widths */
    .breachfeed-recent-articles,
    .breachfeed-articles-container,
    .breachfeed-article {
        min-width: 0 !important;
    }
}

/* No articles state */
.breachfeed-no-articles {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.breachfeed-no-articles p {
    margin: 0 0 10px 0;
    color: #666;
}

.breachfeed-no-articles small {
    color: #999;
}