/*
Theme Name: NewsFlow
Author: Rutvik Patel
Text Domain: newsflow
Requires PHP: 7.4
Tested up to: 6.5
Description: A clean, fast WordPress news theme
Version: 1.0
*/
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    color: #222;
}

header {
    background: #0a3d62;
    color: #fff;
    padding: 15px;
}

header h1 {
    margin: 0;
    font-size: 24px;
}

main {
    max-width: 800px;
    margin: 20px auto;
    background: #fff;
    padding: 20px;
}

article {
    margin-bottom: 30px;
}

article img {
    max-width: 100%;
    height: auto;
    display: block;
    margin-bottom: 10px;
}

h1, h2 {
    line-height: 1.3;
}

h2 a {
    color: #000;
    text-decoration: none;
}

h2 a:hover {
    color: #0a3d62;
}

footer {
    background: #222;
    color: #fff;
    text-align: center;
    padding: 15px;
    font-size: 14px;
}

nav ul {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    gap: 15px;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
}

nav ul li a:hover {
    text-decoration: underline;
}

section {
    margin-bottom: 40px;
}

section h2 {
    border-bottom: 2px solid #0a3d62;
    padding-bottom: 5px;
    margin-bottom: 20px;
}

section article {
    margin-bottom: 20px;
}

section article h3,
section article h4 {
    margin: 10px 0;
}

section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

section h2 {
    grid-column: 1 / -1;
}

.content-area {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 18px;
}

.sidebar {
    background: #f7f7f7;
    padding: 15px;
}

.news-widget {
    margin-bottom: 25px;
}

.widget-title {
    font-size: 18px;
    border-bottom: 2px solid #0a3d62;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .content-area {
        grid-template-columns: 1fr;
    }

    .sidebar {
        margin-top: 30px;
    }
}

:root {
    --newsflow-primary: #0a3d62;
}

header,
section h2,
.widget-title {
    border-color: var(--newsflow-primary);
    background-color: var(--newsflow-primary);
}

.custom-logo {
    max-height: 60px;
    width: auto;
}

.custom-logo-link img {
    max-height: 60px;
    width: auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 999;
}

.site-header {
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

main {
    padding-top: 10px;
}

.post-meta-top {
    margin-bottom: 20px;
}

.post-category a {
    display: inline-block;
    background: var(--newsflow-primary);
    color: #fff;
    padding: 4px 10px;
    font-size: 13px;
    text-decoration: none;
    margin-bottom: 10px;
}

.post-meta {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

.post-meta span {
    margin-right: 6px;
}

.author-box {
    display: flex;
    gap: 15px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.author-avatar img {
    border-radius: 50%;
}

.author-name {
    margin: 0 0 5px;
    font-size: 18px;
}

.author-bio {
    margin: 0;
    font-size: 14px;
    color: #555;
}

img {
    max-width: 100%;
    height: auto;
}

.news-article {
    line-height: 1.7;
    font-size: 16px;
}

article img {
    margin-bottom: 15px;
}

.breaking-news {
    display: flex;
    align-items: center;
    background: #c0392b;
    color: #fff;
    padding: 8px 15px;
    font-size: 14px;
}

.breaking-label {
    font-weight: bold;
    margin-right: 15px;
}

.breaking-ticker {
    overflow: hidden;
    flex: 1;
}

.breaking-ticker ul {
    display: flex;
    gap: 40px;
    list-style: none;
    margin: 0;
    padding: 0;
    animation: ticker 20s linear infinite;
}

.breaking-ticker a {
    color: #fff;
    text-decoration: none;
}

@keyframes ticker {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* Dark Mode Styles */
.dark-mode {
    background: #121212;
    color: #e0e0e0;
}

.dark-mode header,
.dark-mode footer {
    background: #1e1e1e;
}

.dark-mode main {
    background: #181818;
}

.dark-mode a {
    color: #4da3ff;
}

.dark-mode .sidebar {
    background: #1f1f1f;
}

.dark-mode .news-widget,
.dark-mode .author-box {
    background: #1a1a1a;
}

.dark-mode .post-meta {
    color: #aaa;
}

.dark-toggle {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    margin-left: auto;
    color: #fff;
}

.dark-toggle:hover {
    opacity: 0.8;
}

.dark-mode .dark-toggle {
    color: #ffd700;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 10px;
}

nav {
    margin-left: auto;
    margin-right: 20px;
}

.dark-toggle {
    flex-shrink: 0;
}

/* ===== HEADER LAYOUT ===== */
.main-header {
    background: #0a3d62;
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
}

.site-title {
    color: #fff;
    margin: 0;
    font-size: 22px;
}

/* Navigation */
.main-nav {
    margin-left: auto;
}

.main-nav ul {
    display: flex;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-nav a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

/* Mobile Header */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
    }

    .site-branding {
        width: 100%;
        justify-content: space-between;
    }

    .main-nav {
        width: 100%;
        margin: 10px 0 0;
    }

    .main-nav ul {
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
    }

    .dark-toggle {
        position: absolute;
        right: 15px;
        top: 12px;
    }
}

/* Hide site title on mobile */
@media (max-width: 768px) {
    .site-title {
        display: none;
    }
}

.latest-news-item img {
    width: 100%;
    height: auto;
    margin-bottom: 8px;
    border-radius: 4px;
}

/* Fix section heading text color */
section > h2 {
    color: #ffffff;
}

/* Fix breaking news link color */
.breaking-news a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
}

.breaking-news a:hover {
    text-decoration: underline;
}

/* Related Posts (original) */
/* Related Posts – Desktop Polish */
.related-posts {
    margin-top: 50px;
}

.related-posts h3 {
    margin-bottom: 20px;
    font-size: 22px;
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 28px;
    align-items: start;
}


.related-posts-grid article {
    display: flex;
    flex-direction: column;
}

.related-posts-grid img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    margin-bottom: 12px;
}

.related-posts-grid h4 {
    font-size: 16px;
    line-height: 1.4;
    margin: 0;
}


@media (max-width: 768px) {
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
}
/* Hide site title when logo is present (desktop + mobile) */
.wp-custom-logo .site-title {
    display: none;
}
/* FIX: Related Posts section should NOT be a grid itself */
.related-posts {
    display: block;
}
/* ===== SEARCH OVERLAY ===== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 61, 98, 0.96);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.search-overlay.active {
    display: flex;
}

.search-overlay-content {
    width: 100%;
    max-width: 600px;
    padding: 20px;
}

.search-overlay-content input[type="search"] {
    width: 100%;
    padding: 18px;
    font-size: 20px;
    border: none;
    outline: none;
    border-radius: 6px;
}

.search-close {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 26px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
}
/* Mobile search & dark toggle polish */
@media (max-width: 768px) {

    .search-toggle,
    .dark-toggle {
        font-size: 18px;
        margin-left: 10px;
    }

    .search-toggle {
        position: absolute;
        right: 50px;
        top: 12px;
    }

    .dark-toggle {
        position: absolute;
        right: 15px;
        top: 12px;
    }
}
/* ===== Reading Progress Bar (Header-attached) ===== */
#readingProgress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 4px;
    width: 0%;
    background: #ffcc00;
    z-index: 5;
}

/* Dark mode */
.dark-mode #readingProgress {
    background: #4da3ff;
}

/* ===== FIX: Breaking News ticker mobile stacking ===== */
.breaking-ticker ul {
    flex-wrap: nowrap;
}

.breaking-ticker li {
    white-space: nowrap;
}

.breaking-ticker a {
    white-space: nowrap;
    display: inline-block;
}

/* Extra safety for small screens */
@media (max-width: 768px) {
    .breaking-ticker {
        overflow: hidden;
    }
}

/* Pause breaking news ticker on hover (desktop only) */
@media (hover: hover) {
    .breaking-ticker:hover ul {
        animation-play-state: paused;
    }
}
/* Trending News Widget */
.trending-news ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.trending-news li {
    margin-bottom: 10px;
}

.trending-news a {
    text-decoration: none;
    font-weight: 500;
    color: inherit;
}

.trending-news a:hover {
    text-decoration: underline;
}
/* Trending Posts with image */
.trending-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.trending-item {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.trending-thumb img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 4px;
}

.trending-title {
    font-weight: 600;
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
}

.trending-excerpt {
    font-size: 13px;
    color: #777;
    margin: 0;
}

/* Dark mode */
.dark-mode .trending-excerpt {
    color: #aaa;
}
/* Desktop refinement for Trending News */
@media (min-width: 769px) {

    .trending-item {
        align-items: center;
        margin-bottom: 12px;
    }

    .trending-thumb img {
        width: 60px;
        height: 60px;
    }

    .trending-title {
        font-size: 14px;
        line-height: 1.3;
    }

    .trending-excerpt {
        font-size: 12px;
        line-height: 1.4;
    }

}
/* Fix large gap between content and sidebar */
.content-area main {
    max-width: 100%;
    margin: 0;
}
/* Properly center content + sidebar layout */
.content-area {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}
/* ===== HERO TOP NEWS (Image on top, title below) ===== */
.top-news article {
    display: block;
}

.top-news img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 15px;
}

.top-news h3 {
    margin: 0;
}

.top-news h3 a {
    display: block;
    font-size: 32px;
    line-height: 1.25;
    color: #0a3d62;
    text-decoration: none;
}

.top-news h3 a:hover {
    text-decoration: underline;
}

/* Mobile fine-tuning */
@media (max-width: 768px) {
    .top-news h3 a {
        font-size: 24px;
    }
}

/* ===== LATEST NEWS GRID ===== */
.latest-news article {
    transition: transform 0.2s ease;
}

.latest-news article:hover {
    transform: translateY(-3px);
}

.latest-news h4 a {
    font-size: 17px;
    font-weight: 600;
}
section {
    margin-bottom: 30px;
}

section h2 {
    margin-bottom: 15px;
}
/* ===== HERO TOP NEWS ===== */
.top-news article {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 30px;
    align-items: center;
}

.top-news img {
    width: 100%;
    border-radius: 6px;
}

.top-news h3 a {
    font-size: 28px;
    line-height: 1.3;
    font-weight: 700;
    color: #0a3d62;
}

@media (max-width: 768px) {
    .top-news article {
        grid-template-columns: 1fr;
    }

    .top-news h3 a {
        font-size: 22px;
    }
}
/* ===== TOP NEWS HERO FIX ===== */
.top-news article {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    align-items: center;
}

/* Bigger image */
.top-news img {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Strong headline */
.top-news h3 {
    margin: 0;
}

.top-news h3 a {
    font-size: 36px;
    line-height: 1.25;
    font-weight: 800;
    color: #0a3d62;
    display: block;
}

/* Remove small-image restriction */
.top-news article img {
    max-width: none;
}

/* Mobile stays perfect */
@media (max-width: 768px) {
    .top-news article {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .top-news h3 a {
        font-size: 24px;
    }
}
/* Force full-width Top News image */
.top-news img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
}
/* ===== TOP NEWS FIX ===== */
.top-news-article {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.top-news-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

/* Desktop layout */
@media (min-width: 768px) {
    .top-news-article {
        grid-template-columns: 2fr 1fr;
        align-items: center;
    }

    .top-news-content h3 {
        font-size: 28px;
        line-height: 1.3;
    }
}
/* ===== FIX TOP NEWS IMAGE SIZE ===== */
.top-news-section {
    display: block !important;
}

.top-news-section article {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.top-news-section img {
    width: 100% !important;
    height: auto;
    display: block;
}

/* Desktop layout */
@media (min-width: 768px) {
    .top-news-section article {
        grid-template-columns: 2fr 1fr;
        align-items: center;
    }

    .top-news-section h3 {
        font-size: 28px;
        line-height: 1.3;
    }
}
/* ===== FIX TOP NEWS GRID OVERRIDE ===== */
section.top-news {
    display: block !important;
}

section.top-news article {
    display: block;
}

section.top-news img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 16px;
}

section.top-news h3 a {
    display: block;
    font-size: 32px;
    line-height: 1.25;
    color: #0a3d62;
    text-decoration: none;
}

@media (max-width: 768px) {
    section.top-news h3 a {
        font-size: 24px;
    }
}
/* ===== TEXT TO SPEECH BUTTON ===== */
.post-tts-wrap {
    margin: 15px 0;
}

.tts-button {
    background: #0a3d62;
    color: #ffffff;
    border: none;
    padding: 8px 14px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
}

.tts-button:hover {
    opacity: 0.9;
}
/* ===== TTS SENTENCE HIGHLIGHT ===== */
.tts-highlight {
    background: #ffe680;
    border-radius: 3px;
    padding: 2px 3px;
}
/* ===== Breadcrumbs ===== */
.newsflow-breadcrumbs {
    font-size: 14px;
    margin-bottom: 10px;
    color: #666;
}

.newsflow-breadcrumbs a {
    color: #0a3d62;
    text-decoration: none;
}

.newsflow-breadcrumbs .sep {
    margin: 0 6px;
    color: #999;
}

.newsflow-breadcrumbs .current {
    color: #333;
    font-weight: 500;
}
/* ===== Ads ===== */
.newsflow-ad {
    margin: 25px 0;
    text-align: center;
}

.newsflow-ad-content {
    margin: 30px 0;
}

.newsflow-ad-sidebar {
    margin-bottom: 30px;
}

/* ===============================
   FOOTER
================================ */
.site-footer {
    background: #0a3d62;
    color: #ffffff;
    padding: 40px 20px 20px;
    margin-top: 50px;
}

.footer-inner {
    max-width: 1200px;
    margin: auto;
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

.footer-widget h4 {
    margin-bottom: 10px;
    font-size: 16px;
    color: #ffffff;
}

.footer-widget {
    font-size: 14px;
}

.footer-nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 15px;
}

.footer-nav a {
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
}

.footer-nav a:hover {
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    font-size: 13px;
    opacity: 0.8;
}

@media (max-width: 768px) {
    .footer-widgets {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-nav ul {
        flex-direction: column;
        gap: 10px;
    }
}
/* ===============================
   Mobile Sticky Footer Ad (FINAL)
================================ */

.newsflow-mobile-ad {
    display: none;
}

@media (max-width: 768px) {
    .newsflow-mobile-ad {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: #ffffff;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.25);
        padding: 12px 40px 12px 12px;
        z-index: 99999;
        display: flex;
        justify-content: center;
        align-items: center;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }

    .newsflow-mobile-ad.show {
        transform: translateY(0);
    }

    .newsflow-ad-close {
        position: absolute;
        right: 10px;
        top: 6px;
        font-size: 22px;
        background: none;
        border: none;
        cursor: pointer;
        color: #000;
    }
}
/* ===== FORCE CLOSE BUTTON VISIBILITY ===== */
.newsflow-ad-close {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 100000 !important;
    color: #000 !important;
    font-weight: bold;
}

.newsflow-mobile-ad {
    position: fixed;
}

.newsflow-mobile-ad-inner {
    width: 100%;
    text-align: center;
}

/* Accessibility: Skip link */
.screen-reader-text {
    position: absolute;
    left: -9999px;
    top: auto;
}

.screen-reader-text:focus {
    left: 10px;
    top: 10px;
    background: #000;
    color: #fff;
    padding: 8px 12px;
    z-index: 100000;
    text-decoration: none;
}

