.news-section {
    margin: 20px 0;
}

.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.category-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: all 0.3s ease;
}

.category-btn:hover,
.category-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.refresh-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 15px;
}

.loading {
    text-align: center;
    padding: 20px;
    font-size: 16px;
    color: #666;
}

.news-list {
    display: grid;
    gap: 20px;
}

.news-item {
    display: flex;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s ease;
    overflow: hidden;
}

.news-item:hover {
    transform: translateY(-2px);
}

.news-image {
    width: 120px;
    min-width: 120px;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-image-placeholder {
    width: 100%;
    height: 100%;
    background: #007bff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
}

.news-content {
    flex: 1;
}

.news-category {
    color: #007bff;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.news-title {
    font-size: 16px;
    font-weight: bold;
    margin: 0 0 8px 0;
    color: #333;
}

.news-description {
    font-size: 14px;
    color: #666;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
}

.error-message {
    text-align: center;
    padding: 40px;
    color: #666;
}

.error-message button {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}

/* News Modal Styles */
.news-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: white;
    margin: 2% auto;
    width: 100%;
    max-width: 800px;
    height: auto; /* Changed from fixed height */
    max-height: 90vh; /* Maximum height but can be less */
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column; /* Use flexbox for proper layout */
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    padding: 17px 15px;
    justify-content: space-between;
    align-items: center;
    background: #db1f1f00;
    position: static;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 5px 10px;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.modal-close:hover {
    background-color: #e0e0e0;
    color: #333;
}

.modal-body {
    padding: 10px;
    flex: 1; /* Take available space */
    overflow-y: auto; /* Scroll only when needed */
    height: auto; /* Content determines height */
}

.modal-body h1 {
    font-size: 28px;
    margin: 0 0 20px 0;
    color: #333;
    line-height: 1.3;
    font-weight: 700;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    color: #666;
}

.article-source {
    font-weight: 600;
    color: #007bff;
}

.article-time {
    font-style: italic;
}

.article-image {
    margin: 20px 0;
    text-align: center;
}

.article-image img {
    max-width: 100%;
    max-height: 400px;
    padding: 5px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.article-content {
    line-height: 1.7;
    font-size: 16px;
    color: #333;
    margin: 15px;
}

.article-content p {
    margin-bottom: 20px;
    text-align: justify;
}

.article-content img {
    max-width: 100%;
    height: auto;
    margin: 15px 0;
    border-radius: 8px;
}

.loading-content {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.fallback-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.original-link {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    margin-top: 15px;
    font-weight: 600;
    transition: background-color 0.3s;
}

.original-link:hover {
    background: #0056b3;
}

.article-summary {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #007bff;
}

.loading-indicator {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.error-message {
    background: #fff3cd;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ffeaa7;
    margin-top: 15px;
}

/* Responsive design */
@media (max-width: 768px) {
    .modal-content {
        width: 100%;
        margin: 0;
        max-height: 100vh; /* Full screen on mobile */
        border-radius: 0;
        height: 100vh; /* Full viewport on mobile */
    }
    
    .modal-body {
        padding-top: 49px;
        flex: 1;
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 15px 0 0;
        margin-top: 15px;
    }
    
    .modal-body h1 {
        font-size: 22px;
        margin-bottom: 15px;
    }
    
    .article-meta {
        /*flex-direction: column;*/
        align-items: flex-start;
        gap: 5px;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
/* Styles for the bottom close button */
.modal-footer {
    text-align: center;
    margin-top: 20px;
    padding: 20px 0 0;
    border-top: 1px solid #e0e0e0;
    position: relative; /* Normal flow */
    background: white; /* Ensure background */
    flex-shrink: 0; /* Don't shrink footer */
}
.close-bottom-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 3px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.close-bottom-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
}

.close-bottom-btn:active {
    transform: translateY(0);
}

.article-full-content {
    margin-top: 20px;
}

.fallback-message {
    background: #fff3cd;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ffeaa7;
    text-align: center;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
}

.navbar {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #007bff;
    text-decoration: none;
}

.refresh-btn, .back-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.refresh-btn:hover, .back-btn:hover {
    background: #0056b3;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 0.5rem;
}

/* Category Filter */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.category-btn {
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    text-decoration: none;
    color: #666;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.category-btn:hover, .category-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.news-item {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    gap: 1rem;
}

.news-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.news-image {
    flex-shrink: 0;
    width: 120px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
}

.news-content {
    flex: 1;
}

.news-category {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.news-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
    line-height: 1.4;
}

.news-description {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #999;
}

.news-source {
    font-weight: 600;
    color: #007bff;
}

.error-message {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.error-message button {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Article Page Styles */
.article-container {
    max-width: 700px;
}

.article-header {
    margin-bottom: 2rem;
}

.article-category {
    display: inline-block;
    /*background: #007bff;*/
    color: white;
    /*padding: 0.3rem 0.8rem;*/
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.article-header h1 {
    font-size: 2.2rem;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: #333;
}

.article-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #666;
}

.article-image {
    margin: 2rem 0;
}

.article-image img {
    width: 100%;
    border-radius: 12px;
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #444;
}

.extracted-content p {
    margin-bottom: 1.5rem;
}

.extracted-content h1,
.extracted-content h2,
.extracted-content h3 {
    margin: 2rem 0 1rem 0;
    color: #333;
    line-height: 1.4;
}

.extracted-content h1 { font-size: 1.8rem; }
.extracted-content h2 { font-size: 1.6rem; }
.extracted-content h3 { font-size: 1.4rem; }

.extracted-content ul,
.extracted-content ol {
    margin: 1rem 0 1rem 2rem;
}

.extracted-content li {
    margin-bottom: 0.5rem;
}

.extracted-content blockquote {
    border-left: 4px solid #007bff;
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #666;
}

.extracted-content strong,
.extracted-content b {
    font-weight: 600;
    color: #333;
}

.fallback-content {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.article-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.article-footer p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

.article-footer a {
    color: #007bff;
    text-decoration: none;
}

.article-footer a:hover {
    text-decoration: underline;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .news-item {
        flex-direction: column;
    }
    
    .news-image {
        width: 100%;
        height: 200px;
    }
    
    .article-header h1 {
        font-size: 1.8rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .category-filter {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
}