/**
 * News & Reviews Page Styles (Modernized)
 *
 * ============================================================================
 * FILE LOCATION: /includes/css/pages/news.css
 * UPDATED: January 12, 2026 - v3: Added Companies sidebar + bottom spacer
 * ============================================================================
 *
 * This follows the same fixed-background approach as about.css:
 * - Fixed header (stays at top)
 * - Fixed footer (stays at bottom)
 * - Scrollable content area between them
 * - Fixed background (doesn't scroll)
 * - Fixed overlay (doesn't scroll)
 * - Transparent cards with backdrop-filter
 * - 3-column layout: Companies sidebar + Articles + Stats sidebar
 * - Responsive: Hides companies sidebar on screens < 1200px
 */

/* =============================================================================
   STICKY HEADER (KEEPS HEADER IN PLACE AT ALL TIMES)
   ============================================================================= */

/* Make header sticky - stays at top of viewport */
.navbar,
header,
.site-header,
nav[role="navigation"] {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030; /* Bootstrap navbar z-index */
    width: 100%;
}

/* Add padding to body to prevent content from going under fixed header */
body {
    padding-top: 56px; /* Typical Bootstrap navbar height */
}

/* =============================================================================
   PAGE LAYOUT VARIABLES + BACKGROUND IMAGE SETTINGS
   ============================================================================= */

:root {
    --tb-header-h: 56px;  /* Keep in sync with your real header height */
    --tb-footer-h: 80px;  /* Keep in sync with your real footer height */

    /* News page color scheme */
    --news-text: #0f172a;
    --news-muted: #64748b;
    --news-border: #e2e8f0;
    --news-surface: rgba(255, 255, 255, 0.92);
    --news-surface-strong: rgba(255, 255, 255, 0.97);
    --news-shadow: 0 12px 30px rgba(15, 23, 42, 0.10);
    --news-radius: 18px;

    --news-blue-900: #0b1f4b;
    --news-blue-700: #1d4ed8;
    --news-blue-600: #2563eb;
    --news-amber-600: #d97706;

    /* Background image scaling and positioning */
    --tb-news-bg-position: center center;
    --tb-news-bg-size: cover;
    --tb-news-bg-opacity: 1;
    --tb-news-bg-blur: 2px;

    /* Overlay gradient strength */
    --tb-news-overlay-strength: 0.15;
    --tb-news-left-fade: 0.45;
}

/* =============================================================================
   FIXED FOOTER + SCROLLABLE CONTENT AREA (HEADER + FOOTER LOCKED)
   ============================================================================= */

/* Prevent the browser window itself from scrolling */
html, body {
    height: 100%;
}

body {
    overflow: hidden;
}

/* Pin footer to the bottom (supports multiple footer wrappers) */
footer,
.site-footer,
.footer {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1025; /* below navbar(1030), above page content */
    min-height: var(--tb-footer-h);
}

/* =============================================================================
   MAIN PAGE WRAPPER (MATCHES ABOUT.CSS STRUCTURE)
   ============================================================================= */

.news-page {
    /* Background image path */
    --tb-news-bg-url: url("/assets/images/backgrounds/news_background.png");

    /* Background tuning */
    --tb-news-bg-blur: 2px;
    --tb-news-bg-opacity: 1;
    --tb-news-bg-size: cover;
    --tb-news-bg-position: center center;

    /* Editorial overlay tuning */
    --tb-news-overlay-strength: 0.15;
    --tb-news-left-fade: 0.45;

    position: fixed;
    top: var(--tb-header-h);
    left: 0;
    right: 0;
    bottom: var(--tb-footer-h);

    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    isolation: isolate;
    min-height: auto;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* Fixed background - stays in place while content scrolls, positioned below header */
.news-page::before {
    content: "";
    position: fixed;           /* FIXED - background doesn't scroll */
    top: var(--tb-header-h);   /* Start below header */
    left: 0;
    right: 0;
    bottom: var(--tb-footer-h); /* Stop above footer */
    z-index: -3;

    background-image: var(--tb-news-bg-url);
    background-repeat: no-repeat;
    background-size: var(--tb-news-bg-size);
    background-position: var(--tb-news-bg-position);

    filter: blur(var(--tb-news-bg-blur)) saturate(0.90) contrast(0.92) brightness(1.05);
    opacity: var(--tb-news-bg-opacity);

    pointer-events: none;
}

/* Fixed overlay - stays in place while content scrolls, positioned below header */
.news-page::after {
    content: "";
    position: fixed;           /* FIXED - overlay doesn't scroll */
    top: var(--tb-header-h);   /* Start below header (matches background) */
    left: 0;
    right: 0;
    bottom: var(--tb-footer-h); /* Stop above footer */
    z-index: -2;

    background:
        linear-gradient(90deg,
            rgba(240,240,245,var(--tb-news-left-fade)) 0%,
            rgba(240,240,245,0.25) 22%,
            rgba(240,240,245,0.10) 44%,
            rgba(240,240,245,0.00) 65%),
        linear-gradient(180deg,
            rgba(245,245,250,0.65) 0%,
            rgba(245,245,250,0.25) 40%,
            rgba(245,245,250,0.12) 70%,
            rgba(245,245,250,0.00) 100%),
        rgba(240,240,245,var(--tb-news-overlay-strength));

    pointer-events: none;
}

.news-page .news-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* =============================================================================
   HERO SECTION
   ============================================================================= */

.news-hero {
    margin-top: 1.25rem;
    margin-bottom: 2rem;
}

.news-hero__inner {
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--news-shadow);
    border: 1px solid rgba(226, 232, 240, 0.85);

    /* Image sits behind a tasteful gradient overlay */
    background:
        linear-gradient(135deg, rgba(11, 31, 75, 0.40), rgba(29, 78, 216, 0.70)),
        url('/assets/images/hero/news-hero.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.news-hero__content {
    padding: 2.25rem 2.25rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.news-hero__icon {
    width: 68px;
    height: 68px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 2rem;
}

.news-hero__title {
    margin: 0;
    font-size: 2.25rem;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.news-hero__subtitle {
    margin: 0.5rem 0 0;
    font-size: 1.05rem;
    opacity: 0.92;
    max-width: 62ch;
}

/* =============================================================================
   CONTROLS (TABS + SEARCH + SORT) - WITH TRANSPARENCY
   ============================================================================= */

.news-controls {
    background: var(--news-surface-strong);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: var(--news-radius);
    box-shadow: var(--news-shadow);
    padding: 1.25rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.news-controls__grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.25rem;
}

.news-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.news-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;

    padding: 0.6rem 0.95rem;
    border-radius: 14px;
    border: 1px solid var(--news-border);
    background: rgba(248, 250, 252, 0.9);
    color: var(--news-text);

    font-weight: 700;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.news-tab:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
}

.news-tab.is-active {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.35);
    color: var(--news-blue-900);
}

.news-tab__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    padding: 0 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    background: rgba(15, 23, 42, 0.08);
}

.news-tab.is-active .news-tab__count {
    background: rgba(37, 99, 235, 0.18);
}

.news-search {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.news-search__input {
    flex: 1;
    min-width: 240px;

    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--news-border);
    background: rgba(255, 255, 255, 0.95);

    font-size: 1rem;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.news-search__input:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
    background: rgba(255, 255, 255, 1);
}

.news-search__btn {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: none;
    background: var(--news-blue-600);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.news-search__btn:hover {
    transform: translateY(-1px);
    filter: brightness(0.95);
}

.news-sort {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.news-sort__label {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--news-muted);
}

.news-sort__buttons {
    display: inline-flex;
    padding: 0.25rem;
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid var(--news-border);
    border-radius: 14px;
}

.news-sort__btn {
    padding: 0.55rem 0.9rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.92rem;
    color: var(--news-muted);
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.news-sort__btn.is-active {
    background: rgba(255, 255, 255, 0.95);
    color: var(--news-blue-900);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.10);
}

/* =============================================================================
   LAYOUT GRID (3-COLUMN: COMPANIES SIDEBAR + ARTICLES + STATS SIDEBAR)
   ============================================================================= */

.news-grid {
    display: grid;
    grid-template-columns: 280px 1fr 340px;
    gap: 2rem;
    margin-bottom: 3rem; /* Extra breathing room at bottom */
}

/* =============================================================================
   ARTICLE CARDS - WITH TRANSPARENCY
   ============================================================================= */

.news-articles {
    display: grid;
    gap: 1.25rem;
}

.news-article {
    background: var(--news-surface);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: var(--news-radius);
    box-shadow: var(--news-shadow);
    overflow: hidden;

    display: grid;
    grid-template-columns: 240px 1fr;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.news-article:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

.news-article__media {
    position: relative;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.04);
}

.news-article__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.news-article:hover .news-article__media img {
    transform: scale(1.04);
}

.news-article__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-weight: 900;
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.news-article__body {
    padding: 1.35rem 1.4rem;
    display: flex;
    flex-direction: column;
}

.news-article__title {
    margin: 0 0 0.65rem;
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.news-article__title a {
    color: var(--news-text);
    text-decoration: none;
}

.news-article__title a:hover {
    color: var(--news-blue-700);
}

.news-article__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-bottom: 0.9rem;
    color: var(--news-muted);
    font-size: 0.9rem;
    font-weight: 650;
}

.news-article__meta i {
    margin-right: 0.35rem;
}

.news-article__excerpt {
    margin: 0 0 1rem;
    color: var(--news-muted);
    line-height: 1.65;
    font-size: 0.98rem;
}

.news-article__footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.news-article__readmore {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    font-weight: 900;
    color: var(--news-blue-700);
    transition: gap 0.15s ease, color 0.15s ease;
}

.news-article__readmore:hover {
    gap: 0.75rem;
    color: var(--news-blue-900);
}

/* =============================================================================
   SIDEBAR - WITH TRANSPARENCY
   ============================================================================= */

.news-sidebar {
    display: grid;
    gap: 1.25rem;
    align-content: start;
}

.news-card {
    background: var(--news-surface);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: var(--news-radius);
    box-shadow: var(--news-shadow);
    padding: 1.25rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.news-card__title {
    margin: 0 0 0.9rem;
    font-size: 1.05rem;
    font-weight: 950;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.news-card__title i {
    color: var(--news-blue-700);
}

/* Invisible spacer to prevent cut-off at bottom */
.news-card__spacer {
    height: 2rem;
    visibility: hidden;
}

/* =============================================================================
   COMPANIES SIDEBAR (LEFT) - WITH TRANSPARENCY
   ============================================================================= */

.news-companies {
    display: grid;
    gap: 1.25rem;
    align-content: start;
}

.companies-widget {
    background: var(--news-surface);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: var(--news-radius);
    box-shadow: var(--news-shadow);
    padding: 1.25rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.companies-widget__title {
    margin: 0 0 0.9rem;
    font-size: 1.05rem;
    font-weight: 950;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--news-text);
}

.companies-widget__title i {
    color: var(--news-blue-700);
}

.companies-list {
    display: grid;
    gap: 0.4rem;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom scrollbar for companies list */
.companies-list::-webkit-scrollbar {
    width: 6px;
}

.companies-list::-webkit-scrollbar-track {
    background: rgba(226, 232, 240, 0.3);
    border-radius: 3px;
}

.companies-list::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.4);
    border-radius: 3px;
}

.companies-list::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 99, 235, 0.6);
}

.companies-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.7rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--news-text);
    font-weight: 700;
    font-size: 0.9rem;
    transition: background 0.15s ease, transform 0.15s ease;
}

.companies-item:hover {
    background: rgba(37, 99, 235, 0.08);
    transform: translateX(2px);
}

.companies-item.is-active {
    background: rgba(37, 99, 235, 0.12);
    color: var(--news-blue-900);
}

.companies-item__name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.companies-item__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 0 0.4rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 900;
    background: rgba(15, 23, 42, 0.08);
    margin-left: 0.5rem;
}

.companies-item.is-active .companies-item__count {
    background: rgba(37, 99, 235, 0.18);
}

/* Category headers in companies list */
.companies-category {
    padding: 0.65rem 0.7rem 0.35rem;
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--news-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

.companies-category:first-child {
    margin-top: 0;
}

/* =============================================================================
   EMPTY STATE - WITH TRANSPARENCY
   ============================================================================= */

.news-empty {
    background: var(--news-surface);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: var(--news-radius);
    box-shadow: var(--news-shadow);
    text-align: center;
    padding: 4rem 2rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.news-empty__icon {
    font-size: 3.2rem;
    color: rgba(148, 163, 184, 0.9);
    margin-bottom: 1rem;
}

.news-empty__title {
    margin: 0 0 0.5rem;
    font-weight: 950;
    letter-spacing: -0.01em;
}

.news-empty__text {
    margin: 0;
    color: var(--news-muted);
}

/* =============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================= */

@media (max-width: 1200px) {
    .news-grid {
        /* Stack: Articles + Right Sidebar (hide companies on medium screens) */
        grid-template-columns: 1fr 340px;
    }
    
    .news-companies {
        display: none;
    }
}

@media (max-width: 1024px) {
    .news-grid {
        /* Full width single column */
        grid-template-columns: 1fr;
    }
    .news-controls__grid {
        grid-template-columns: 1fr;
    }
    .news-sort {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

@media (max-width: 991.98px) {
    body {
        padding-top: 56px;
    }
    .news-page {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
}

@media (max-width: 768px) {
    .news-hero__content {
        flex-direction: column;
        align-items: flex-start;
    }

    .news-hero__title {
        font-size: 1.9rem;
    }

    .news-article {
        grid-template-columns: 1fr;
    }
    .news-article__media {
        height: 200px;
    }

    .news-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.25rem;
    }
}

@media (max-width: 575.98px) {
    .news-controls {
        border-radius: 0.65rem;
    }
    .news-hero__title {
        font-size: 1.65rem;
    }
}