/* Modern News Archive Styles */
:root {
    --primary-blue: #004b93;
    --secondary-blue: #0066cc;
    --accent-orange: #ff6b35;
    --text-dark: #333;
    --text-gray: #666;
    --text-light: #999;
    --border-light: #e8e8e8;
    --bg-light: #f5f5f5;
    --bg-hover: #fafafa;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 6px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* News Archive Container */
.news-archive-modern {
    max-width: 100%;
    margin: 0;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    position: relative;
    min-height: 400px;
}

/* Remove negative margins on mobile */
@media (max-width: 768px) {
    .page-container .news-archive-modern {
        margin: 0;
        padding: 15px;
    }
}

/* Loading overlay */
.news-archive-modern.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-archive-modern.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 101;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ensure proper page alignment */
#main-content.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

.page-container .news-archive-modern {
    background-color: #fafafa;
    margin: 0 -20px;
    padding: 20px;
}

@media (max-width: 768px) {
    .page-container .news-archive-modern {
        background-color: transparent;
        margin: 0;
        padding: 15px;
    }
}

.news-archive-header {
    margin-bottom: 20px;
    text-align: left;
}

.news-archive-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-blue);
    margin: 0;
    letter-spacing: -0.3px;
}

.news-archive-header .subtitle {
    font-size: 16px;
    color: var(--text-gray);
    margin-top: 8px;
    font-weight: 400;
}

/* Filter Bar */
.news-filter-bar {
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 25px;
    border: 1px solid var(--border-light);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.category-filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.primary-categories {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Mobile category select - hidden on desktop */
.mobile-category-select {
    display: none;
}

/* More categories dropdown */
.more-categories-wrapper {
    position: relative;
}

.more-categories-btn {
    padding: 4px 16px;
    border: 1px solid var(--primary-blue);
    border-radius: 5px;
    background: white;
    color: var(--primary-blue);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.more-categories-btn:hover {
    background: var(--primary-blue);
    color: white;
}

.more-categories-btn:hover i {
    color: white;
}

/* Add indicator when a secondary category is active */
.more-categories-btn.has-active {
    background: var(--primary-blue);
    color: white;
}

.more-categories-btn.has-active i {
    color: white;
}

.more-categories-btn i {
    font-size: 10px;
    transition: transform var(--transition-fast);
}

.more-categories-wrapper.open .more-categories-btn i {
    transform: rotate(180deg);
}

.more-categories-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 1000;
}

.more-categories-wrapper.open .more-categories-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-category-item {
    display: block;
    padding: 10px 16px;
    color: var(--text-gray);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
}

.dropdown-category-item:last-child {
    border-bottom: none;
}

.dropdown-category-item:hover {
    background: var(--bg-light);
    color: var(--primary-blue);
}

.dropdown-category-item.active {
    background: var(--primary-blue);
    color: white;
}

/* Mobile select styling */
.category-select-mobile {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: white;
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.category-filter {
    padding: 6px 14px;
    border: 1px solid var(--border-light);
    border-radius: 5px;
    background: white;
    color: var(--text-gray);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 13px;
    font-weight: 500;
}

.category-filter:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.category-filter.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

.view-switcher {
    display: flex;
    gap: 8px;
    background: var(--bg-light);
    padding: 4px;
    border-radius: 8px;
}

.view-switcher button {
    padding: 4px 12px;
    border: none;
    background: transparent;
    color: var(--text-gray);
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.view-switcher button.active {
    background: white;
    color: var(--primary-blue);
    box-shadow: var(--shadow-sm);
}

/* News Grid */
.news-articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* Article Card */
.article-card-modern {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    transition: all var(--transition-normal);
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.article-card-modern:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: transparent;
}

.article-card-modern .article-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: var(--bg-light);
}

.article-card-modern .article-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.article-card-modern:hover .article-image {
    transform: scale(1.05);
}

.article-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-light) 0%, #e0e7ef 100%);
    color: var(--text-light);
    font-size: 48px;
}

.article-category-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: calc(100% - 24px);
}

.article-category-badge {
    background: rgba(0, 75, 147, 0.9);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Adjust opacity for additional badges to create hierarchy */
.article-category-badge:nth-child(n+2) {
    background: rgba(0, 75, 147, 0.8);
}

.article-category-badge:nth-child(n+3) {
    background: rgba(0, 75, 147, 0.7);
}

/* On hover, show all badges clearly */
.article-card-modern:hover .article-category-badge {
    background: rgba(0, 75, 147, 0.95);
}

.article-card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-gray);
}

.article-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.author-avatar-placeholder {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-gray);
}

time.entry-date {
    color: var(--text-light);
    font-size: 13px;
}

time.entry-date::before {
    content: "•";
    margin: 0 8px;
    color: var(--text-light);
}

.article-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-dark);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-title a {
    color: inherit;
    text-decoration: none;
}

.article-card-modern:hover .article-title {
    color: var(--primary-blue);
}

.article-excerpt {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-gray);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.article-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    gap: 10px;
    min-height: 30px;
}

.article-shares {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    flex: 1 1 auto;
    overflow: hidden;
    align-items: center;
    min-width: 0;
}

/* Mobile adjustments for stock tags */
@media (max-width: 480px) {
    .article-footer {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .article-shares {
        max-width: 100%;
        flex: 1 1 100%;
        order: 2;
    }
    
    .read-more-link {
        order: 1;
        margin-left: auto;
    }
}

.share-tag {
    background: #f0f4f8;
    color: var(--text-gray);
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all var(--transition-fast);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

a.share-tag:hover {
    background: var(--primary-blue);
    color: white;
    text-decoration: none;
}

.share-tag.more-shares {
    background: #e8e8e8;
    color: var(--text-gray);
    font-weight: 600;
    cursor: default;
    max-width: 50px;
    flex-shrink: 0;
}

.read-more-link {
    color: var(--primary-blue);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    white-space: nowrap;
}

.read-more-link:hover {
    gap: 6px;
    color: var(--secondary-blue);
}

.read-more-link::after {
    content: "→";
    font-size: 16px;
}

/* Featured Article (First in Grid) */
.article-card-modern.featured {
    grid-column: span 2;
}

.article-card-modern.featured .article-title {
    font-size: 24px;
    -webkit-line-clamp: 3;
}

.article-card-modern.featured .article-excerpt {
    font-size: 15px;
    -webkit-line-clamp: 4;
}

/* List View */
.news-articles-list {
    display: block !important;
}

.news-articles-list .article-card-modern {
    flex-direction: row;
    max-width: 100%;
    margin-bottom: 20px;
    display: flex;
}

.news-articles-list .article-image-wrapper {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
    padding-top: 0;
    height: 180px;
}

.news-articles-list .article-card-content {
    padding: 20px 24px;
    flex: 1;
    min-width: 0;
}

.news-articles-list .article-category-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    right: auto;
}

/* Load More Button */
.load-more-wrapper {
    text-align: center;
    margin-top: 30px;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.load-more-btn:hover {
    background: var(--secondary-blue);
    transform: translateY(-1px);
}

.load-more-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .news-articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    }

    .article-card-modern.featured {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .news-archive-header h1 {
        font-size: 32px;
    }

    .news-filter-bar {
        flex-direction: column;
        gap: 16px;
    }

    .category-filters {
        width: 100%;
    }

    /* Hide desktop category buttons on mobile */
    .category-filters > .category-filter,
    .primary-categories,
    .more-categories-wrapper {
        display: none;
    }

    /* Show mobile select on small screens */
    .mobile-category-select {
        display: block;
        width: 100%;
    }

    .news-articles-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .news-articles-list .article-card-modern {
        flex-direction: column;
    }

    .news-articles-list .article-image-wrapper {
        width: 100%;
        height: 200px;
    }
}

/* Loading State */
.article-skeleton {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.skeleton-image {
    width: 100%;
    padding-top: 56.25%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.skeleton-content {
    padding: 24px;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 12px;
}

.skeleton-line.title {
    height: 24px;
    width: 80%;
}

.skeleton-line.text {
    width: 100%;
}

.skeleton-line.text:last-child {
    width: 60%;
}

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

/* Pagination */
.pagination-modern {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 60px;
}

.pagination-modern a,
.pagination-modern span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-gray);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.pagination-modern a:hover {
    border-color: var(--secondary-blue);
    color: var(--secondary-blue);
    background: var(--bg-hover);
}

.pagination-modern .current {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

.pagination-modern .disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state-icon {
    font-size: 64px;
    color: var(--text-light);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 24px;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-gray);
    font-size: 16px;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .news-archive-modern {
        padding: 15px;
    }
    
    .page-container .news-archive-modern {
        margin: 0;
        padding: 15px;
        background-color: transparent;
    }

    .news-archive-header h1 {
        font-size: 28px;
    }

    .news-archive-header .subtitle {
        font-size: 16px;
    }

    .news-filter-bar {
        padding: 16px;
    }

    .category-filter {
        padding: 6px 12px;
        font-size: 13px;
    }

    .article-card-modern {
        border-radius: 8px;
    }

    .article-card-content {
        padding: 16px;
    }

    .article-title {
        font-size: 18px;
    }

    .article-excerpt {
        font-size: 14px;
        -webkit-line-clamp: 2;
    }

    .load-more-btn {
        width: 100%;
        padding: 12px 24px;
    }
}

/* Hover Effects (desktop only) */
@media (hover: hover) {
    .article-card-modern {
        transition: all var(--transition-normal);
    }

    .article-card-modern:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
    }

    .article-card-modern:hover .article-image {
        transform: scale(1.05);
    }

    .article-card-modern:hover .article-title {
        color: var(--secondary-blue);
    }
}


/* Print Styles */
@media print {
    .news-filter-bar,
    .view-switcher,
    .load-more-wrapper {
        display: none !important;
    }

    .news-articles-grid {
        display: block !important;
    }

    .article-card-modern {
        page-break-inside: avoid;
        margin-bottom: 20px;
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}
