/**
 * FalakTech News Feed v2.0 Styles
 * Multi-Category Design with Images
 * Theme: Dark Space with Gradient Accents
 */

/* ========================================
   News Section Container
   ======================================== */
#news-section {
    background: linear-gradient(180deg, #0a0a1a 0%, #0f0f2e 50%, #0a0a1a 100%);
    position: relative;
    overflow: hidden;
}

#news-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.5), transparent);
}

#news-container {
    max-width: 1280px;
    margin: 0 auto;
}

/* ========================================
   News Grid
   ======================================== */
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 20px 0;
}

@media (max-width: 1024px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .news-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ========================================
   News Card
   ======================================== */
.news-card {
    background: linear-gradient(145deg, #12122a 0%, #1a1a3a 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.news-card:hover {
    transform: translateY(-8px);
    border-color: rgba(0, 255, 136, 0.3);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(0, 255, 136, 0.1);
}

/* ========================================
   Card Image
   ======================================== */
.news-image {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.news-card:hover .news-image img {
    transform: scale(1.08);
}

.news-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(transparent, rgba(18, 18, 42, 0.95));
    pointer-events: none;
}

/* ========================================
   Category Badges
   ======================================== */
.news-category {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Astronomy - Purple Gradient */
.badge-astronomy {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Weather - Blue Gradient */
.badge-weather {
    background: linear-gradient(135deg, rgba(86, 204, 242, 0.9), rgba(47, 128, 237, 0.9));
    color: #fff;
    box-shadow: 0 4px 15px rgba(47, 128, 237, 0.3);
}

/* AI & Tech - Red/Orange Gradient */
.badge-ai {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.9), rgba(255, 230, 109, 0.9));
    color: #1a1a2e;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

/* Islamic - Teal/Green Gradient */
.badge-islamic {
    background: linear-gradient(135deg, rgba(0, 201, 167, 0.9), rgba(0, 176, 155, 0.9));
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 201, 167, 0.3);
}

/* ========================================
   Card Body
   ======================================== */
.news-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.news-source {
    font-size: 0.75rem;
    font-weight: 600;
    color: #00ff88;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.news-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.4;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.news-card:hover .news-title {
    color: #00ff88;
}

.news-excerpt {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

/* ========================================
   Card Footer
   ======================================== */
.news-footer-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: auto;
}

.news-date {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.news-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: #00ff88;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
}

.news-link:hover {
    color: #00ffaa;
    gap: 8px;
}

/* ========================================
   Section Footer
   ======================================== */
.news-footer {
    text-align: center;
    padding: 30px 0 10px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 30px;
}

/* ========================================
   Loading State
   ======================================== */
.news-loading {
    text-align: center;
    padding: 80px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #00ff88;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Empty State
   ======================================== */
.news-empty {
    text-align: center;
    padding: 80px 20px;
    color: rgba(255, 255, 255, 0.5);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* ========================================
   Error State
   ======================================== */
.news-error {
    text-align: center;
    padding: 60px 20px;
    color: #ff6b6b;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.retry-btn {
    margin-top: 20px;
    padding: 12px 30px;
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #0a0a0f;
    border: none;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 255, 136, 0.3);
}

/* ========================================
   Card Entrance Animation
   ======================================== */
@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.news-card {
    animation: cardEnter 0.6s ease forwards;
}

.news-card:nth-child(1) { animation-delay: 0.1s; }
.news-card:nth-child(2) { animation-delay: 0.2s; }
.news-card:nth-child(3) { animation-delay: 0.3s; }
.news-card:nth-child(4) { animation-delay: 0.4s; }
.news-card:nth-child(5) { animation-delay: 0.5s; }
.news-card:nth-child(6) { animation-delay: 0.6s; }

/* ========================================
   Section Header Styling
   ======================================== */
#news-section .section-header h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    background: linear-gradient(135deg, #00ff88, #00cc6a, #4fc3f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

#news-section .section-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
}

/* ========================================
   Filters & Controls
   ======================================== */
.news-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
    flex-wrap: wrap;
}

.news-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.news-search {
    position: relative;
    flex-grow: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    color: #fff;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 255, 136, 0.5);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.1);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 1rem;
    pointer-events: none;
}

.filter-btn {
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(4px);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(0, 255, 136, 0.4);
    transform: translateY(-2px);
    color: #fff;
}

.filter-btn.active {
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #050d18;
    border-color: transparent;
    box-shadow: 0 10px 20px rgba(0, 255, 136, 0.2);
}

.filter-btn:active {
    transform: translateY(0);
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 768px) {
    .news-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .news-filters {
        justify-content: center;
    }

    .news-search {
        max-width: none;
    }

    #news-section {
        padding: 60px 4%;
    }

    .news-image {
        height: 160px;
    }

    .news-body {
        padding: 16px;
    }

    .news-title {
        font-size: 1rem;
    }

    .news-excerpt {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }

    .news-footer-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .news-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    #news-section {
        background: white;
    }

    .news-title,
    .news-excerpt,
    .news-date {
        color: #333;
    }
}