/**
 * News Feed Layout - Redesigned Featured + 4-Wide Grid
 */

/* News Grid Container */
.news-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* ==================== FEATURED POST 1 (Left-justified with 400px image) ==================== */
.featured-card.post-1 {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 2rem;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    height: auto;
    min-height: 400px;
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, filter 0.4s ease;
}

.featured-card.post-1:hover {
    transform: translateY(-6px) rotateX(1deg) scale(1.01);
    box-shadow: 0 20px 50px rgba(102, 126, 234, 0.4);
}

/* Pulsing glow on hover only */
.featured-card.post-1::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 12px;
    background: linear-gradient(45deg, #667eea, #764ba2, #667eea);
    background-size: 200% 200%;
    z-index: -1;
    filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Only pulse on hover */
.featured-card.post-1:hover::before {
    opacity: 0.6;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.4;
        filter: blur(8px);
    }
    50% {
        opacity: 0.7;
        filter: blur(15px);
    }
}

.featured-card.post-1 .card-link {
    display: flex;
    width: 100%;
    text-decoration: none;
    color: inherit;
    align-items: center;
}

.featured-card.post-1 .card-text-content {
    flex: 1;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
}

.featured-card.post-1 .card-image-container {
    flex: 0 0 400px;
    height: 400px;
    position: relative;
    overflow: hidden;
}

.featured-card.post-1 .card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.featured-card.post-1:hover .card-image-container img {
    transform: scale(1.1);
}

/* ==================== FEATURED POST 2 (Content beside 400px image) ==================== */
.featured-card.post-2 {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 2rem;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    height: auto;
    min-height: 400px;
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

.featured-card.post-2:hover {
    transform: translateY(-6px) rotateX(1deg) scale(1.01);
    box-shadow: 0 20px 50px rgba(102, 126, 234, 0.4);
}

/* Pulsing glow on hover only */
.featured-card.post-2::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 12px;
    background: linear-gradient(45deg, #764ba2, #667eea, #764ba2);
    background-size: 200% 200%;
    z-index: -1;
    filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.featured-card.post-2:hover::before {
    opacity: 0.6;
    animation: pulse-glow 2s ease-in-out infinite;
}

.featured-card.post-2 .card-link {
    display: flex;
    width: 100%;
    text-decoration: none;
    color: inherit;
    align-items: center;
    flex-direction: row-reverse; /* Image on left, content on right */
}

.featured-card.post-2 .card-text-content {
    flex: 1;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
}

.featured-card.post-2 .card-image-container {
    flex: 0 0 400px;
    height: 400px;
    position: relative;
    overflow: hidden;
}

.featured-card.post-2 .card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.featured-card.post-2:hover .card-image-container img {
    transform: scale(1.1);
}

/* Featured Card Shared Styles */
.featured-card .card-category {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--primary-color, #667eea);
    color: white;
    width: fit-content;
}

.featured-card .card-title {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin: 0;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.featured-card:hover .card-title {
    color: var(--primary-color, #667eea);
}

.featured-card .card-description {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin: 0;
}

.featured-card .card-read-more {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color, #667eea);
    margin-top: 0.5rem;
    transition: transform 0.3s ease;
    display: inline-block;
}

.featured-card:hover .card-read-more {
    transform: translateX(8px);
}

/* ==================== 4-WIDE GRID (Remaining posts) ==================== */
.grid-section {
    margin-top: 3rem;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

@media (min-width: 1400px) {
    .grid-cards {
        grid-template-columns: repeat(4, 1fr);
    }
}

.grid-card {
    position: relative;
    width: 100%;
    height: 350px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.grid-card:hover {
    transform: translateY(-8px) rotateX(2deg) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(102, 126, 234, 0.3);
}

.grid-card .grid-card-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.grid-card .grid-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.grid-card .grid-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease, filter 0.4s ease;
}

/* Image with blur on hover */
.grid-card .grid-image-container img {
    filter: blur(0px) brightness(1);
}

.grid-card:hover .grid-image-container img {
    transform: scale(1.1);
    filter: blur(4px) brightness(0.6);
}

/* Initial state: Title and category visible over blurred bottom */
.grid-card .grid-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.7) 40%,
        rgba(0, 0, 0, 0.95) 100%
    );
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.75rem;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.4s ease-in-out;
}

/* On hover: Slide to top and show full content */
.grid-card:hover .grid-overlay {
    top: 0;
    justify-content: flex-start;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.9) 50%,
        rgba(0, 0, 0, 0.95) 100%
    );
}

/* Anamorphic Glass Effect Layer */
.grid-card .glass-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.grid-card:hover .glass-layer {
    opacity: 1;
}

.grid-card .grid-category {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--primary-color, #667eea);
    color: white;
    width: fit-content;
}

.grid-card .grid-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin: 0;
    line-height: 1.3;
}

.grid-card .grid-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    margin: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(10px);
    transition: max-height 0.4s ease, opacity 0.4s ease 0.1s, transform 0.4s ease 0.1s;
}

.grid-card:hover .grid-description {
    max-height: 200px;
    opacity: 1;
    transform: translateY(0);
}

/* Date info (hidden initially, shown on hover) */
.grid-card .grid-date {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.4s ease 0.2s;
}

.grid-card:hover .grid-date {
    max-height: 50px;
    opacity: 1;
}

/* ==================== CATEGORY COLORS ==================== */
.category-local_news { background: #10b981; }
.category-government { background: #3b82f6; }
.category-education { background: #8b5cf6; }
.category-sports { background: #ef4444; }
.category-weather { background: #06b6d4; }
.category-business { background: #f59e0b; }
.category-breaking { background: #dc2626; }

/* ==================== HEADER LOGO STYLING ==================== */
.brand-banner-logo {
    max-height: 100px;
    width: auto;
    display: block;
    object-fit: contain;
}

/* Ensure main container uses full width */
.main-content {
    width: 100%;
}

/* Override container max-width for news layout */
.main-content .container {
    max-width: 1600px !important; /* Increase to accommodate both columns */
    width: 100%;
    padding: 0 20px;
    margin: 0 auto;
}

/* Force two-column layout on desktop and larger tablets */
@media (min-width: 769px) {
    .content-with-sidebar {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 350px !important;
        gap: 2.5rem !important;
    }
    
    .main-news-content {
        grid-column: 1 !important;
        grid-row: 1 !important;
    }
    
    .right-column {
        grid-column: 2 !important;
        grid-row: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        position: sticky !important;
        top: 20px !important;
        height: fit-content !important;
    }
}

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 1200px) {
    .featured-card.post-1 .card-image-container,
    .featured-card.post-2 .card-image-container {
        flex: 0 0 350px;
        height: 350px;
    }
    
    .grid-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 968px) {
    .featured-card.post-1,
    .featured-card.post-2 {
        flex-direction: column;
        min-height: auto;
        margin-bottom: 2rem; /* More spacing between featured cards */
    }
    
    .featured-card.post-2 .card-link {
        flex-direction: column;
    }
    
    .featured-card.post-1 .card-image-container,
    .featured-card.post-2 .card-image-container {
        flex: 0 0 auto;
        width: 100%;
        height: 450px; /* Increased from 300px for tablet */
    }
    
    .featured-card .card-text-content {
        padding: 2rem;
    }
    
    .featured-card .card-title {
        font-size: 1.75rem;
    }
    
    .grid-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .featured-card .card-image-container {
        height: 400px !important; /* Increased from 250px */
    }
    
    .featured-card .card-text-content {
        padding: 1.5rem;
    }
    
    .featured-card .card-title {
        font-size: 1.5rem;
    }
    
    .featured-card .card-description {
        font-size: 1rem;
    }
    
    .grid-cards {
        grid-template-columns: 1fr;
        gap: 2rem; /* Increased gap between cards */
    }
    
    .grid-card {
        height: 450px; /* Increased from 300px */
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); /* Deeper shadow for elevation */
        margin-bottom: 1rem; /* Extra spacing between cards */
    }
    
    /* Always show overlay on mobile */
    .grid-card .grid-overlay {
        opacity: 1;
        transform: translateY(0);
        background: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0.3) 30%,
            rgba(0, 0, 0, 0.8) 70%,
            rgba(0, 0, 0, 0.95) 100%
        );
        height: 50%; /* Overlay takes up bottom half */
    }
    
    .grid-card .grid-description {
        opacity: 1;
        transform: translateY(0);
        max-height: 100px; /* Allow more description text */
    }
    
    .grid-card .grid-title {
        font-size: 1.25rem; /* Larger titles on mobile */
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }
    
    .grid-card:hover .grid-image-container img {
        filter: none;
    }
    
    .brand-banner-logo {
        max-height: 60px;
    }
}

@media (max-width: 480px) {
    .featured-card .card-image-container {
        height: 350px !important; /* Increased from 200px */
    }
    
    .featured-card .card-text-content {
        padding: 1rem;
    }
    
    .featured-card .card-title {
        font-size: 1.25rem;
    }
    
    .featured-card .card-description {
        font-size: 0.9rem;
    }
    
    .grid-card {
        height: 400px; /* Increased from 250px */
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); /* Deeper shadow for elevation */
    }
    
    .grid-card .grid-image-container {
        height: 60%; /* Image takes up more of the card */
    }
    
    .grid-card .grid-overlay {
        padding: 1.25rem; /* More padding for better readability */
    }
    
    .brand-banner-logo {
        max-height: 50px;
    }
}

.content-with-sidebar {
    display: grid !important;
    grid-template-columns: 1fr 350px !important;
    gap: 2.5rem;
    margin-bottom: 3rem;
    align-items: start;
    width: 100%;
}

/* Fallback for browsers with grid issues */
@supports not (display: grid) {
    .content-with-sidebar {
        display: flex !important;
        flex-wrap: nowrap !important;
    }
    
    .main-news-content {
        flex: 1 1 auto !important;
        margin-right: 30px !important;
    }
    
    .right-column {
        flex: 0 0 350px !important;
    }
}

/* Right Column Specific Styling */
.right-column {
    width: 100%;
    min-width: 300px;
    max-width: 350px;
    flex-shrink: 0; /* Prevent column from shrinking */
    grid-column: 2; /* Explicitly place in second column */
}

.main-news-content {
    min-width: 0; /* Prevent overflow */
    width: 100%; /* Ensure it takes available space */
    grid-column: 1; /* Explicitly place in first column */
}

.main-content-area {
    /* Reserved for future main content */
    min-height: 200px;
}

.sidebar-column,
.right-column {
    display: flex;
    flex-direction: column;
    gap: 25px;
    position: sticky;
    top: 20px;
    align-self: start;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.sidebar-section,
.widget-section {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
}

.sidebar-header,
.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h3,
.widget-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.view-channel-link, .view-all-link {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    transition: color 0.3s ease;
    text-decoration: none;
}

.view-channel-link:hover, .view-all-link:hover {
    color: #60a5fa;
}

.youtube-widget.in-sidebar {
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.youtube-widget.in-sidebar .widget-header,
.youtube-widget.in-sidebar .widget-footer {
    display: none;
}

.youtube-widget.in-sidebar .videos-list {
    max-height: 350px;
    padding: 0;
}

.hollywood-widget.in-sidebar .movies-list {
    max-height: 350px;
    padding: 0;
}

/* Widget content spacing */
.widget-section .weather-widget-sidebar {
    padding: 20px;
    min-height: 150px;
}

.widget-section .hollywood-widget,
.widget-section .youtube-widget {
    background: transparent;
    border: none;
    box-shadow: none;
}

.youtube-widget.in-sidebar .video-item {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.youtube-widget.in-sidebar .video-item:last-child {
    border-bottom: none;
}

.youtube-widget.in-sidebar .video-thumbnail {
    width: 80px;
    height: 45px;
}

.youtube-widget.in-sidebar .video-title {
    font-size: 13px;
    -webkit-line-clamp: 2;
}

.youtube-widget.in-sidebar .video-description {
    font-size: 11px;
    -webkit-line-clamp: 1;
}

.ad-slot {
    min-height: 250px;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    border-radius: 8px;
    margin: 20px;
}

.community-news-widget {
    padding: 20px;
}

.community-item {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.community-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: all 0.3s ease;
}

.community-link:hover {
    transform: translateX(5px);
}

.community-link h4 {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 8px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.community-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.community-meta .score {
    color: #34d399;
    font-weight: 600;
}

.community-empty {
    text-align: center;
    padding: 30px 20px;
    color: rgba(255, 255, 255, 0.6);
}

.community-empty p {
    margin: 0 0 15px 0;
    font-size: 14px;
}

.submit-link {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.submit-link:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.weather-widget-sidebar {
    padding: 20px;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .video-and-ads {
        grid-template-columns: 1fr 320px;
        gap: 2rem;
    }
    
    .content-with-sidebar {
        grid-template-columns: 1fr 320px; /* Slightly smaller right column on medium screens */
    }
}

@media (max-width: 768px) {
    .content-with-sidebar {
        grid-template-columns: 1fr !important;
        gap: 2rem;
    }
    
    .sidebar-column,
    .right-column {
        order: 1; /* Show sidebar below main content on mobile */
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
        position: relative;
        top: auto;
        max-height: none;
        overflow-y: visible;
        grid-column: 1 !important;
    }
    
    .main-news-content {
        grid-column: 1 !important;
    }
}
    
    .youtube-widget.in-sidebar .video-item {
        padding: 12px 15px;
    }
    
    .youtube-widget.in-sidebar .video-thumbnail {
        width: 100px;
        height: 56px;
    }
}

.video-column {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.video-column-header {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.video-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.video-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.video-card img {
    border-radius: 8px;
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.video-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.video-card-meta {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.video-column-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1rem;
}

.ad-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ad-slot {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 250px;
}

.ad-slot .adsbygoogle {
    display: block;
    width: 100%;
    height: 100%;
}

.video-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem;
}

.video-modal.active {
    display: flex;
}

.video-modal-inner {
    background: rgba(10, 10, 15, 0.95);
    border-radius: 18px;
    width: min(980px, 100%);
    padding: 2rem;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-video-frame iframe {
    width: 100%;
    height: 480px;
    border: none;
    border-radius: 12px;
}

.modal-local-ad {
    margin-top: 1.5rem;
}

.modal-local-ad video {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-ad-countdown {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.modal-adsense {
    margin-top: 1.5rem;
}

@media (max-width: 992px) {
    .video-and-ads {
        grid-template-columns: 1fr;
    }
}