/**
 * Modern Article Carousel Styles with Compact Layout and Pagination
 * Version: 1.1.0
 */

.article-carousel-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.carousel-header {
    text-align: center;
    margin-bottom: 2rem;
}

.carousel-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.carousel-subtitle {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1rem;
}

.carousel-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.search-container {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
    background: white;
}

.search-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 1rem;
}

.category-filter {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e2e8f0;
    background: white;
    color: #64748b;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    font-size: 0.85rem;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.filter-btn:hover::before {
    left: 100%;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Compact cards layout */
.compact-cards .articles-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.compact-cards .article-card {
    min-height: auto;
}

.compact-cards .article-card .article-image {
    height: 160px;
}

.compact-cards .article-content {
    padding: 1rem;
}

.compact-cards .article-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.compact-cards .article-excerpt {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.compact-cards .article-meta {
    margin-bottom: 0.75rem;
}

.compact-cards .article-category {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
}

.compact-cards .article-date {
    font-size: 0.8rem;
}

.compact-cards .article-footer {
    margin-top: 0.75rem;
}

.compact-cards .article-link {
    font-size: 0.85rem;
}

.compact-cards .article-author {
    font-size: 0.8rem;
}

.articles-masonry {
    column-count: 3;
    column-gap: 1.5rem;
}

.article-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    break-inside: avoid;
    margin-bottom: 1.5rem;
    border: 1px solid #f1f5f9;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border-color: #e2e8f0;
}

.article-card.featured {
    grid-column: span 2;
}

.article-card.tall {
    grid-row: span 2;
}

.article-image-container {
    position: relative;
    overflow: hidden;
}

.article-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-card.featured .article-image {
    height: 240px;
}

.article-card.tall .article-image {
    height: 200px;
}

.article-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.article-card:hover .article-image {
    transform: scale(1.02);
}

.article-card:hover .article-overlay {
    opacity: 1;
}

.article-content {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.article-content.no-image {
    padding-top: 1.5rem;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.article-category {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.article-date {
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 500;
}

.article-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.article-title a:hover {
    color: #667eea;
}

.article-card.featured .article-title {
    font-size: 1.3rem;
    -webkit-line-clamp: 3;
}

.article-excerpt {
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 1rem;
    flex-grow: 1;
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
}

.article-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.article-link:hover {
    color: #764ba2;
    transform: translateX(2px);
}

.article-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #64748b;
}

.article-author img {
    border-radius: 50%;
    flex-shrink: 0;
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #f1f5f9;
}

.pagination-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #64748b;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e2e8f0;
    background: white;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.pagination-btn:hover:not(:disabled) {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.pagination-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pagination-dots {
    padding: 0 0.5rem;
    color: #64748b;
    font-weight: 500;
}

.prev-btn,
.next-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: #64748b;
    grid-column: 1 / -1;
}

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: #64748b;
    grid-column: 1 / -1;
}

.no-results-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.error-message {
    text-align: center;
    padding: 3rem;
    color: #dc2626;
    grid-column: 1 / -1;
}

.error-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* Animation styles */
.fade-in {
    animation: fadeIn 0.4s ease-in;
}

.slide-in {
    animation: slideIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 1024px) {
    .articles-masonry {
        column-count: 2;
    }
    
    .pagination-info {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .article-carousel-container {
        padding: 1rem;
    }
    
    .carousel-title {
        font-size: 1.75rem;
    }
    
    .carousel-controls {
        gap: 1rem;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .compact-cards .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .articles-masonry {
        column-count: 1;
    }
    
    .article-card.featured {
        grid-column: span 1;
    }
    
    .category-filter {
        gap: 0.4rem;
    }
    
    .filter-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .article-footer {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .pagination-numbers {
        order: -1;
    }
    
    .prev-btn,
    .next-btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .article-carousel-container {
        padding: 0.75rem;
    }
    
    .carousel-title {
        font-size: 1.5rem;
    }
    
    .carousel-subtitle {
        font-size: 0.9rem;
    }
    
    .category-filter {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .search-container {
        max-width: 100%;
    }
    
    .article-content {
        padding: 1rem;
    }
    
    .compact-cards .article-content {
        padding: 0.75rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .article-card {
        background: #1a1a1a;
        color: #e2e8f0;
        border-color: #374151;
    }
    
    .article-title {
        color: #e2e8f0;
    }
    
    .article-title a {
        color: inherit;
    }
    
    .article-title a:hover {
        color: #667eea;
    }
    
    .article-excerpt {
        color: #a0aec0;
    }
    
    .article-author {
        color: #a0aec0;
    }
    
    .article-footer {
        border-color: #374151;
    }
    
    .search-input {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .search-input:focus {
        border-color: #667eea;
    }
    
    .filter-btn,
    .pagination-btn {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .filter-btn:hover,
    .pagination-btn:hover {
        background: #4a5568;
    }
    
    .pagination-container {
        border-color: #374151;
    }
}

/* Widget styles */
.widget .article-carousel-container {
    padding: 1rem;
}

.widget .articles-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
}

.widget .article-card.featured {
    grid-column: span 1;
}

.widget .carousel-title {
    font-size: 1.25rem;
}

.widget .carousel-subtitle {
    font-size: 0.9rem;
}

.widget .category-filter {
    gap: 0.4rem;
}

.widget .filter-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
}

.widget .pagination-container {
    margin-top: 1rem;
    padding-top: 1rem;
}

.widget .pagination-info {
    font-size: 0.8rem;
}

.widget .pagination-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    min-width: 36px;
    height: 36px;
}

/* Print styles */
@media print {
    .category-filter,
    .search-container,
    .pagination-container {
        display: none;
    }
    
    .article-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .article-image {
        height: 120px;
    }
    
    .article-link {
        display: none;
    }
}

/* Accessibility improvements */
.filter-btn:focus,
.search-input:focus,
.article-link:focus,
.pagination-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.article-card:focus-within {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .article-card,
    .filter-btn,
    .pagination-btn,
    .article-link,
    .article-image {
        transition: none;
    }
    
    .fade-in,
    .slide-in {
        animation: none;
    }
    
    .loading-spinner {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .article-card {
        border: 2px solid #000;
    }
    
    .filter-btn,
    .pagination-btn {
        border: 2px solid #000;
    }
    
    .article-category {
        background: #000;
        color: #fff;
    }
    
    .article-footer {
        border-color: #000;
    }
}