/* Cosmic News Feed Styles */
.cosmic-news-feed-section {
    position: relative;
    padding: 3rem 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(15, 15, 40, 0.95));
    overflow: hidden;
    margin: 2rem 0;
}

.news-feed-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 240, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 0, 247, 0.1) 0%, transparent 50%),
        linear-gradient(45deg, transparent 30%, rgba(0, 240, 255, 0.05) 50%, transparent 70%);
    pointer-events: none;
}

.section-title {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-bottom: 2rem;
}

.sparkle-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { 
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% { 
        transform: scale(1.2) rotate(10deg);
        opacity: 0.8;
    }
}

.cosmic-news-title,
.news-title-main {
    font-size: 2.5rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--primary);
    background: linear-gradient(45deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    display: block;
    z-index: 2;
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.news-subtitle {
    text-align: center;
    color: var(--text);
    font-size: 1rem;
    margin: 0 auto 2rem auto;
    opacity: 0.8;
    max-width: 100%;
    display: block;
}

.news-categories {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.news-category-btn {
    background: rgba(0, 240, 255, 0.1);
    border: 2px solid rgba(0, 240, 255, 0.3);
    color: var(--primary);
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    backdrop-filter: blur(10px);
}

.news-category-btn:hover {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 240, 255, 0.3);
}

.news-category-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-color: transparent;
    box-shadow: 0 5px 20px rgba(0, 240, 255, 0.4);
}

.news-category-btn i {
    font-size: 1rem;
}

.news-feed-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 3rem;
    position: relative;
}

.news-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
    color: var(--primary);
}

.cosmic-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 240, 255, 0.3);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.news-card {
    background: rgba(15, 15, 40, 0.8);
    border-radius: 0.8rem;
    overflow: hidden;
    border: 1px solid rgba(0, 240, 255, 0.2);
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
    position: relative;
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 12px 35px rgba(0, 240, 255, 0.4), 0 0 20px rgba(0, 240, 255, 0.2);
}

.news-card:hover .news-fresh-badge {
    transform: scale(1.2) rotate(10deg);
}

.news-image {
    height: 140px;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.news-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
}

.news-source {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    background: rgba(0, 240, 255, 0.9);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 2;
}

.news-fresh-badge {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: white;
    padding: 0.3rem 0.5rem;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 2;
    animation: freshPulse 2s ease-in-out infinite;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

@keyframes freshPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
    }
}

.news-content {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.news-content h3,
.news-title {
    color: var(--primary);
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    margin: 0 0 0.5rem 0 !important;
    padding: 0 !important;
    line-height: 1.25 !important;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-transform: none !important;
}

.news-summary {
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.8rem;
    opacity: 0.9;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.news-time {
    color: var(--accent);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.news-read-more {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.3s ease;
}

.news-read-more:hover {
    color: var(--accent);
    transform: translateX(3px);
}

.news-error {
    text-align: center;
    padding: 3rem;
    color: var(--text);
}

.retry-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 240, 255, 0.4);
}

.news-refresh-info {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 240, 255, 0.2);
}

.refresh-indicator {
    color: var(--text);
    font-size: 0.9rem;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.refresh-indicator i {
    animation: rotate 2s linear infinite;
}

.refresh-text {
    font-weight: 500;
    letter-spacing: 0.5px;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes refreshPulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
        color: var(--primary);
    }
    100% {
        transform: scale(1);
        opacity: 0.7;
    }
}

.no-news {
    text-align: center;
    color: var(--text);
    font-size: 1.1rem;
    padding: 3rem;
    opacity: 0.7;
}

/* Animation for news cards */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Smooth category transition */
.news-grid.transitioning {
    opacity: 0;
    transform: translateY(20px);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .news-feed-container {
        max-width: 1200px;
        padding: 0 2rem;
    }
    
    .news-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (max-width: 1024px) {
    .news-feed-container {
        padding: 0 1.5rem;
    }
    
    .news-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1.2rem;
    }
}

@media (max-width: 768px) {
    .cosmic-news-title {
        font-size: 2rem;
    }
    
    .news-categories {
        gap: 0.5rem;
    }
    
    .news-category-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .news-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
    }
    
    .news-feed-container {
        padding: 0 1rem;
    }
    
    .news-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .cosmic-news-title {
        font-size: 1.5rem;
    }
    
    .news-categories {
        gap: 0.5rem;
    }
    
    .news-category-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
    }
}

/* News Article Modal Styles */
.news-article-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

.news-article-modal.show {
    opacity: 1;
}

.news-article-modal-content {
    background: rgba(15, 15, 40, 0.98);
    border: 2px solid var(--primary);
    border-radius: 1rem;
    padding: 0;
    max-width: 700px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.4);
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s ease;
    backdrop-filter: blur(20px);
}

.news-article-modal-content.news-article-preview {
    max-width: 750px;
    width: 95%;
    max-height: 90vh;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.news-article-modal.show .news-article-modal-content {
    transform: scale(1) translateY(0);
}

.news-modal-close {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--primary);
    color: var(--primary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.news-modal-close:hover {
    color: var(--accent);
    transform: rotate(90deg);
}

.news-modal-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2rem;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.5));
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    border-radius: 1rem 1rem 0 0;
}

.news-modal-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.news-modal-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.news-modal-open-external {
    color: var(--primary);
    font-size: 1.2rem;
    padding: 0.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.news-modal-open-external:hover {
    color: var(--accent);
    transform: scale(1.1);
}

.news-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.news-modal-source {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.news-modal-time {
    color: var(--accent);
    font-size: 0.85rem;
}

.news-modal-image {
    width: 100%;
    height: 280px;
    background-size: cover;
    background-position: center;
    position: relative;
    border-radius: 1rem 1rem 0 0;
}

.news-modal-body {
    padding: 2rem 2.5rem;
    min-height: 200px;
}

.modal-article-title {
    color: #00f0ff !important;
    font-size: 1.6rem !important;
    font-weight: 700 !important;
    margin: 0 0 1.5rem 0 !important;
    line-height: 1.5 !important;
    display: block !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

.modal-article-summary {
    color: var(--text) !important;
    font-size: 1.05rem !important;
    line-height: 1.8 !important;
    margin-bottom: 2rem !important;
    display: block !important;
    opacity: 0.95 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

.news-modal-note {
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text);
    font-size: 0.9rem;
}

.news-modal-note i {
    color: var(--primary);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.news-modal-actions {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.news-modal-read-full {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.3);
}

.news-modal-read-full:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 240, 255, 0.5);
}

.news-modal-read-full i {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .news-article-modal-content {
        padding: 0;
        width: 95vw;
        max-height: 85vh;
    }
    
    .news-article-modal-content.news-article-preview {
        max-width: 95vw;
        width: 95vw;
    }
    
    .news-modal-image {
        height: 180px;
    }
    
    .news-modal-body {
        padding: 1.5rem 1.8rem;
    }
    
    .modal-article-title {
        font-size: 1.3rem !important;
    }
    
    .modal-article-summary {
        font-size: 0.95rem !important;
    }
    
    .news-modal-header-bar {
        padding: 1rem 1.5rem;
    }
    
    .news-modal-close {
        font-size: 1.6rem;
        width: 40px;
        height: 40px;
        top: 1rem;
        right: 1rem;
    }
    
    .news-modal-read-full {
        padding: 0.9rem 2rem;
        font-size: 0.95rem;
    }
}
