/* writing-portfolio.css - Styles for writing portfolio cards and categories */
body {
    font-family: 'Quicksand', Arial, Helvetica, sans-serif;
    background-color: #f9f5ff;
    color: #333;
}

/* Portfolio title styling */
.section-title {
    color: #9f7aea; /* Magenta color to match the theme */
    text-align: center;
    margin: 2rem 0;
    font-size: 2.5rem;
    font-weight: 700;
}

/* --- Main Container --- */
.articles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
    padding: 0 1rem;
}

/* --- Article Cards --- */
.article-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e8e0f0;
    overflow: hidden; /* Ensures thumbnails don't overflow the card */
}

/* Article Thumbnails */
.article-card .article-thumbnail {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid #f0f0f0;
    background: #f8f9fa;
}

.article-card .article-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
}

.article-card:hover .article-thumbnail img {
    transform: scale(1.05);
}

/* Article Logo Overlay */
.article-card .article-logo {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-card .article-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.article-card .article-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.article-card:hover .article-title {
    color: #8e24aa;
}



.article-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.article-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
    color: #4a148c;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.article-meta {
    margin-bottom: 0.75rem;
}

.article-org {
    display: inline-block;
    background: #f3e5f5;
    color: #6a1b9a;
    padding: 0.2rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.8rem 0;
}

.article-preview {
    color: #333;
    margin: 0.8rem 0;
    line-height: 1.6;
    font-size: 0.95rem;
}

.article-tags .tag {
    background: #f0e5ff;
    color: #6a1b9a;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.read-article-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #8e24aa 0%, #ba68c8 100%);
    color: white;
    text-decoration: none;
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: auto;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    width: fit-content;
}

.read-article-btn:hover {
    background: linear-gradient(135deg, #7b1fa2 0%, #9c27b0 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.3);
}

/* --- Filter Bar --- */
.writing-filter-bar {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
}

.filter-btns-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
}

.filter-btn {
    background: #f5f5f5;
    border: none;
    border-radius: 20px;
    padding: 0.6rem 1.2rem;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: #e8e0f0;
    color: #6a1b9a;
}

.filter-btn.active {
    background: linear-gradient(135deg, #8e24aa 0%, #ba68c8 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(138, 43, 226, 0.2);
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-container .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

#article-search {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    border: 1px solid #e0d0e8;
    border-radius: 8px;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

#article-search:focus {
    outline: none;
    border-color: #ba68c8;
    box-shadow: 0 0 0 3px rgba(186, 104, 200, 0.2);
}

/* Loading and Error States */
.loading-state,
.error-state,
.no-articles {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    margin: 1rem 0;
}

.loading-state .spinner,
.error-state i,
.no-articles i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #8b5cf6;
}

.loading-state .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(139, 92, 246, 0.1);
    border-radius: 50%;
    border-top-color: #8b5cf6;
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-state i {
    color: #ef4444;
}

/* Loading state for individual article cards */
.article-card.loading-thumbnail {
    position: relative;
    min-height: 200px;
    overflow: hidden;
}

.article-card.loading-thumbnail::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #8b5cf6, #c4b5fd, #8b5cf6);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .articles-container {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
    
    .article-card .article-thumbnail {
        height: 160px;
    }
}

@media (max-width: 480px) {
    .article-card .article-thumbnail {
        height: 140px;
    }
}

@media (max-width: 768px) {
    .writing-filter-bar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-btns-row {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .search-container {
        width: 100%;
        max-width: 100%;
    }
    
    .articles-container {
        grid-template-columns: 1fr;
    }
}