/* 
 * news_feed_widget.css - News Feed Widget Component Styles
 * Reusable news feed widget with multiple layout configurations
 */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    --news-card-border-radius: 8px;
    --news-card-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --news-card-hover-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    --news-primary-color: #126E51;
    --news-primary-hover: #0d5640;
    --news-text-primary: #2c3e50;
    --news-text-secondary: #6c757d;
    --news-border-color: rgba(0, 0, 0, 0.1);
    --news-bg-light: #f8f9fa;
    --news-bg-placeholder: #e9ecef;
    --news-placeholder-color: #adb5bd;
    
    /* Layout constraints */
    --min-featured-w: 320px;
    --min-standard-w: 220px;
    --gap: 20px;
}

/* ===== WIDGET WRAPPER ===== */
.news-feed-widget {
    width: 100%;
    color: var(--text-color);
    container-type: inline-size;
    container-name: news-widget;
}

/* ===== GRID LAYOUTS ===== */
.news-feed-widget-grid--full {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    width: 100%;
    max-width: 100%;
}

/* Primary cluster - Top section with featured and standard tiles */
.news-grid-top {
    display: grid;
    gap: var(--gap);
    width: 100%;
    
    /* Use same 3-column system as bottom: featured takes 2 columns, rightcol takes 1 */
    grid-template-columns: repeat(3, minmax(var(--min-standard-w), 1fr));
    grid-template-areas: 
        "featured featured rightcol";
}

/* Container queries for responsive layouts */

/* Breakpoint 1: When container can't fit featured + standard side by side */
@container news-widget (max-width: 780px) {
    .news-grid-top {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "featured"
            "rightcol";
    }
    
    .news-grid-top-right {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(var(--min-standard-w), 1fr));
        gap: var(--gap);
    }
}

/* Breakpoint 2: Single column for top-right when too narrow for 2 standards */
@container news-widget (max-width: 560px) {
    .news-grid-top-right {
        grid-template-columns: 1fr !important;
    }
}

.news-grid-top > .news-tile--featured {
    grid-area: featured;
}

.news-grid-top-right {
    grid-area: rightcol;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    width: 100%;
}

/* Secondary cluster - Standard tiles grid */
.news-grid-standard-row {
    display: grid;
    gap: var(--gap);
    grid-template-columns: repeat(auto-fit, minmax(var(--min-standard-w), 1fr));
}

.news-grid-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--min-standard-w), 1fr));
    gap: var(--gap);
}

/* Home page layout */
.news-grid-home {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* Sidebar layout */
.news-grid-sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ===== NEWS TILES ===== */
.news-item {
    background-color: #fff;
    border: 1px solid var(--news-border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.news-card-base {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: var(--text-color);
}

/* Image styles */
.news-card-image {
    position: relative;
    overflow: hidden;
    background-color: var(--news-bg-placeholder);
}

.news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--news-placeholder-color);
}

.image-placeholder i {
    font-size: 3rem;
}

/* Content styles */
.news-card-content {
    padding: 0.5rem;
    flex-grow: 1;
}

.news-card-text {
    margin: 0;
    color: var(--news-text-secondary);
    line-height: 1.5;
    font-size: var(--font-size-sm); /* 12px */
}

/* Footer styles */
.news-card-footer {
    padding: 0.5rem;
    border-top: 1px solid var(--news-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-xs);
    background-color: var(--news-bg-light);
}

.news-timestamp i {
    margin-right: 0.3rem;
}

/* Category tag */
.news-category-tag {
    padding: 0;
    border-radius: 0;
    color: #000;
    background-color: transparent;
}

/* Category tag colors for different categories */
.news-category-tag--match-report {
    background-color: #28a745;
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
}

.news-category-tag--news {
    background-color: #007bff;
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
}

.news-category-tag--transfer {
    background-color: #fd7e14;
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
}

.news-category-tag--general {
    background-color: #6c757d;
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
}

/* ===== TILE VARIATIONS ===== */

/* Featured Tile */
.news-tile--featured {
    min-width: var(--min-featured-w);
}

.news-tile--featured .news-card-image {
    aspect-ratio: 16 / 9;
    width: 100%;
    max-width: 100%;
}

.news-tile--featured .news-card-title {
    margin-bottom: 0.5rem;
    font-size: var(--font-size-lg, 1.25rem);
}

.news-card-title {
    font-size: var(--font-size-md);
    margin-bottom: 0;
    color: var(--text-color);
}

/* Standard Tile */
.news-tile--standard {
    min-width: var(--min-standard-w);
}

.news-tile--standard .news-card-image {
    aspect-ratio: 16 / 10;
    margin-bottom: 0;
}


/* Compact Tile - Just title and footer */
.news-tile--compact {
    min-width: 260px;
}

.news-tile--compact .news-card-base {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Sidebar Tile */
.news-tile--sidebar {
    display: flex;
}

.news-tile--sidebar .news-card-base {
    flex-direction: row;
    align-items: center;
}

.news-tile--sidebar .news-card-image {
    width: 100px;
    height: 100%;
    flex-shrink: 0;
}

.news-tile--sidebar .news-card-text {
    display: none;
}

.news-tile--sidebar .news-card-footer {
    display: none;
}

/* ===== BANNER AD ===== */
.news-grid-item--banner-ad {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 2px dashed #ffb74d;
    padding: 2rem;
    text-align: center;
    color: #f57c00;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.banner-ad-horizontal i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* ===== LOAD MORE ===== */
.news-feed-widget-load-more {
    text-align: center;
    margin: 1.5rem !important;
}

.btn-view-more {
    background-color: var(--news-primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-view-more:hover {
    /* No hover effects - keeping consistent appearance */
    background-color: var(--news-primary-color);
    color: white;
    border: none;
}

#news-feed-widget-loading {
    padding: 2rem 0;
    text-align: center;
}

/* Green spinner styling to match matches widget */
#news-feed-widget-loading .spinner-border {
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top: 3px solid var(--news-primary-color);
    border-radius: 50%;
    animation: loadingSpinner 1s linear infinite;
}

@keyframes loadingSpinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== RESPONSIVE DESIGN ===== */

/* Mobile fallback for browsers without container query support */
@media (max-width: 425px) {
    :root {
        --min-featured-w: 280px;
        --min-standard-w: 220px;
        --gap: 15px;
    }
    
    .news-grid-top {
        grid-template-columns: 1fr !important;
        grid-template-areas: 
            "featured"
            "rightcol" !important;
    }

    .news-grid-top-right {
        display: flex !important;
        flex-direction: column;
    }

    .news-grid-standard-row {
        grid-template-columns: 1fr !important;
    }
    
    .news-grid-home {
        grid-template-columns: 1fr !important;
    }

    .news-grid-compact {
        grid-template-columns: 1fr !important;
    }
    
    .news-tile--compact {
        min-width: 100% !important;
    }
}

