/* Modern News Grid Layout */
.news-grid-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.news-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    
    /* Fallback for browsers that don't support CSS Grid */
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -ms-flex-direction: row;
    flex-direction: row;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-pack: start;
    -ms-flex-pack: start;
    justify-content: flex-start;
}

/* Modern browsers that support CSS Grid */
@supports (display: grid) {
    .news-grid-container {
        display: grid;
        -webkit-box-orient: unset;
        -webkit-box-direction: unset;
        -ms-flex-direction: unset;
        flex-direction: unset;
        -ms-flex-wrap: unset;
        flex-wrap: unset;
        -webkit-box-pack: unset;
        -ms-flex-pack: unset;
        justify-content: unset;
    }
}

/* Modern News Card Design */
.news-card {
    background: #ffffff;
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    
    /* Flexbox fallback for grid */
    -webkit-box-flex: 1;
    -ms-flex: 1 1 350px;
    flex: 1 1 350px;
    margin: 12px;
    max-width: calc(50% - 24px);
}

/* Modern browsers that support CSS Grid */
@supports (display: grid) {
    .news-card {
        -webkit-box-flex: unset;
        -ms-flex: unset;
        flex: unset;
        margin: unset;
        max-width: unset;
    }
}

.news-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

.news-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #06b6d4);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.news-card:hover::before {
    transform: scaleX(1);
}

/* News Card Header */
.news-card-header {
    position: relative;
    padding: 24px 24px 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.news-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    color: #1e293b;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.025em;
}

.ad-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* News Content */
.news-content {
    padding: 20px 24px 24px;
}

.news-excerpt {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 20px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.news-footer {
    margin-top: auto;
}

/* Modern Button Design */
.read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.read-more-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.read-more-btn:hover::before {
    left: 100%;
}

.read-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
    text-decoration: none;
    color: white;
}

.read-more-btn i {
    transition: transform 0.3s ease;
}

.read-more-btn:hover i {
    transform: translateX(4px);
}

/* Featured Ad Styling */
.featured-ad {
    background: linear-gradient(135deg, #fef3c7 0%, #fbbf24 100%);
    border: 2px solid #f59e0b;
}

.featured-ad .news-card-header {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.featured-ad .news-title {
    color: #92400e;
}

.featured-ad .read-more-btn.featured {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.featured-ad .read-more-btn.featured:hover {
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.4);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .news-grid-container {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 20px;
    }
    
    .news-grid-wrapper {
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .news-grid-container {
        grid-template-columns: 1fr;
        gap: 16px;
        
        /* Flexbox fallback adjustments */
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
    }
    
    .news-card {
        max-width: 100%;
        -ms-flex: 1 1 auto;
        flex: 1 1 auto;
        margin: 8px 0;
    }
    
    @supports (display: grid) {
        .news-card {
            margin: unset;
        }
    }
    
    .news-grid-wrapper {
        padding: 12px;
        margin: 0 8px;
    }
    
    .news-card-header {
        padding: 20px 20px 12px;
    }
    
    .news-content {
        padding: 16px 20px 20px;
    }
    
    .news-title {
        font-size: 1.1rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
    
    .news-excerpt {
        font-size: 0.9rem;
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }
    
    .read-more-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .news-grid-wrapper {
        margin: 0 4px;
        padding: 8px;
        border-radius: 8px;
    }
    
    .news-card {
        border-radius: 12px;
    }
    
    .news-card-header {
        padding: 16px 16px 8px;
    }
    
    .news-content {
        padding: 12px 16px 16px;
    }
    
    .news-title {
        font-size: 1rem;
    }
    
    .read-more-btn {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }
}

/* Loading Animation */
.news-card {
    animation: fadeInUp 0.6s ease-out;
}

.news-card:nth-child(2) { animation-delay: 0.1s; }
.news-card:nth-child(3) { animation-delay: 0.2s; }
.news-card:nth-child(4) { animation-delay: 0.3s; }
.news-card:nth-child(5) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth scrolling for anchors */
html {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
.read-more-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.news-card:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .news-grid-wrapper {
        background: none;
        box-shadow: none;
    }
    
    .news-card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
    
    .read-more-btn {
        display: none;
    }
}
