/*
Theme Name: KeelaiNews
Theme URI: https://example.com/keelainews
Author: Deepmind Assistant
Author URI: https://deepmind.google/
Description: A professional Tamil news portal theme converted from HTML.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: keelainews
Tags: news, tamil, magazine, responsive
*/

/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root {
    /* Colors */
    --primary-color: #0056b3;
    /* Professional News Blue */
    --primary-dark: #003d82;
    --secondary-color: #222222;
    --accent-color: #d62828;
    /* Keeping some red as accent from the logo details */
    --light-gray: #f4f4f4;
    --border-color: #ddd;
    --text-color: #333;
    --text-light: #666;
    --white: #ffffff;
    --black: #000000;

    /* Fonts */
    --font-main: 'Hind Madurai', 'Noto Sans Tamil', sans-serif;

    /* Spacing */
    --container-width: 1200px;
    --header-height: auto;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--white);
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-color);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Container */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 16px;
}

/* Typography Utilities */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    line-height: 1.3;
}

.section-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title span {
    background: var(--primary-color);
    color: var(--white);
    padding: 4px 12px;
    font-size: 1rem;
    font-weight: normal;
    border-radius: 4px;
}

/* =========================================
   2. HEADER
   ========================================= */
/* Top Bar */
.top-bar {
    background-color: var(--secondary-color);
    color: var(--white);
    font-size: 0.9rem;
    padding: 8px 0;
}

.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-left,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.social-icons a {
    color: var(--white);
    font-size: 1rem;
}

/* Main Header */
.main-header {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    background: white;
}

.main-header .container {
    display: flex;
    flex-wrap: nowrap;
    /* Force single row on desktop */
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 1;
    /* Allow logos to shrink if needed */
}

.logo-main {
    display: flex;
    flex-direction: column;
    /* Stack logo and tagline */
    align-items: center;
    /* Align center */
    gap: 5px;
}

.logo-main img {
    max-height: 70px;
    /* Slightly larger main logo */
    width: auto;
}

.header-widget-area {
    /* Fill remaining space */
    flex-grow: 1;
    max-width: 100%;
    margin-left: 30px;
    /* Space between logo and ad */

    height: auto;
    min-height: 90px;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    /* Align to right */
    color: var(--text-light);
    font-size: 0.8rem;
}

.header-widget-area a {
    width: 100%;
    /* Ensure link wraps full width */
    display: block;
}

.header-widget-area img {
    width: 100%;
    /* Force full width of the container */
    height: auto;
    /* Maintain aspect ratio */
    max-height: 250px;
    /* Cap height to prevent layout break */
    object-fit: cover;
    /* Crop if needed to fit banner shape */
    display: block;
    border-radius: 4px;
    /* Optional polish */
}

/* Remove 1200px requirement for Ad, handle mobile wrapping instead */
@media (max-width: 900px) {
    .header-widget-area {
        width: 100%;
        margin-left: 0;
        margin-top: 15px;
        justify-content: center;
    }

    .header-widget-area img {
        width: 100%;
        max-height: none;
    }
}

@media (max-width: 900px) {
    .main-header .container {
        flex-direction: column;
        align-items: center;
        flex-wrap: wrap;
        /* allow wrapping on mobile */
    }

    .brand-wrapper {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        margin-bottom: 15px;
        justify-content: center;
    }

    .logo-main img,
    .logo-secondary img {
        max-height: 50px;
        margin: 0 auto;
    }
}

/* Main Navigation */
.main-nav {
    background-color: var(--primary-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.main-nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* WordPress Menu Support */
.main-nav ul {
    display: flex;
    margin: 0;
    padding: 0;
}

.main-nav li {
    list-style: none;
    position: relative;
}

.main-nav a {
    display: block;
    padding: 16px var(--spacing-md);
    color: var(--white);
    font-weight: 500;
    font-size: 1.05rem;
}

.main-nav a:hover,
.main-nav .current-menu-item>a {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Dropdown Support */
.main-nav ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--primary-color);
    min-width: 200px;
    flex-direction: column;
    z-index: 1001;
}

.main-nav ul li:hover>ul {
    display: flex;
}

.main-nav ul ul li a {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-toggle {
    color: var(--white);
    cursor: pointer;
    font-size: 1.2rem;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 991px) {
    .main-nav .container {
        padding: 10px var(--spacing-md);
    }

    .menu-toggle {
        display: block;
    }

    .main-nav>div>ul {
        /* Target top level menu */
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--primary-color);
        flex-direction: column;
    }

    .main-nav>div>ul.active {
        display: flex;
        animation: slideDown 0.3s ease;
    }

    .main-nav li a {
        padding: 12px var(--spacing-md);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   3. BREAKING NEWS TICKER
   ========================================= */
.breaking-news {
    background-color: var(--secondary-color);
    color: var(--white);
    display: flex;
    align-items: center;
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
}

.bn-label {
    background-color: var(--accent-color);
    padding: 10px 20px;
    font-weight: 700;
    white-space: nowrap;
    z-index: 10;
}

.bn-content {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
    white-space: nowrap;
}

.bn-content marquee,
.bn-content-scroll {
    /* Fallback if JS ticker is complex, but we'll try to use CSS animation or simple JS */
    display: inline-block;
    padding-left: 100%;
    animation: ticker 30s linear infinite;
}

@keyframes ticker {
    0% {
        transform: translate3d(0, 0, 0);
    }

    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

.bn-item {
    display: inline-block;
    padding: 10px var(--spacing-lg);
}

.bn-item::after {
    content: "•";
    margin-left: var(--spacing-lg);
    color: var(--accent-color);
}

@media (max-width: 768px) {
    .breaking-news {
        flex-direction: column;
        align-items: stretch;
    }

    .bn-label {
        width: 100%;
        text-align: center;
        padding: 5px 10px;
    }

    .bn-content {
        width: 100%;
        padding-top: 5px;
        padding-bottom: 5px;
        background: rgba(0, 0, 0, 0.2);
        /* Slight contrast for content area */
    }
}

/* =========================================
   4. LAYOUT COMPONENTS
   ========================================= */
.main-wrapper {
    padding-bottom: var(--spacing-xl);
}

.grid-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
}

@media (min-width: 992px) {
    .grid-wrapper {
        grid-template-columns: 2fr 1fr;
        /* Main, Sidebar */
    }
}

/* Post Card Styles */
.post-card {
    position: relative;
    margin-bottom: var(--spacing-md);
}

.post-card img {
    width: 100%;
    border-radius: 4px;
    margin-bottom: var(--spacing-sm);
    object-fit: cover;
}

.post-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 4px;
    display: flex;
    gap: 10px;
}

.post-cat {
    color: var(--primary-color);
    font-weight: 600;
}

.post-title {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-sm);
}

.post-title a:hover {
    color: var(--primary-color);
}

.post-excerpt {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* Hero Section */
.hero-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

@media (min-width: 768px) {
    .hero-grid {
        grid-template-columns: 1.5fr 1fr;
    }
}

.hero-main .post-card img {
    height: 400px;
}

.hero-main .post-title {
    font-size: 2rem;
    line-height: 1.2;
}

.hero-side .post-card {
    display: flex;
    gap: 15px;
    /* Increased gap */
    align-items: flex-start;
    margin-bottom: 20px;
    /* Space between side posts */
}

.hero-side .post-card img {
    width: 110px;
    height: 85px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 4px;
}

.hero-side .post-card>div {
    flex: 1;
    /* Force text to take remaining width */
    min-width: 0;
    /* Prevent flex overflow */
}

.hero-side .post-title {
    font-size: 1.05rem;
    line-height: 1.4;
    margin-bottom: 5px;
    font-weight: 600;

    /* Limit to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Latest News Grid */
.news-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

/* Category Sections */
.category-block {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

/* Sidebar Widgets */
.sidebar-widget {
    background: var(--light-gray);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    border-radius: 4px;
}

.widget-title {
    font-size: 1.2rem;
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
    margin-bottom: var(--spacing-md);
}

/* WordPress Widget Adjustments */
.sidebar-widget ul {
    list-style: none;
    padding: 0;
}

.sidebar-widget li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-widget li a:hover {
    color: var(--primary-color);
}

/* Trending Specific (if used via custom HTML widget) */
.trending-list li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    counter-increment: trending-counter;
    display: flex;
    gap: 10px;
}

.trending-list li::before {
    content: counter(trending-counter);
    background: var(--primary-color);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Footer */
footer {
    background-color: var(--secondary-color);
    color: #ccc;
    padding: 60px 0 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: 40px;
}

.footer-widget h3 {
    color: var(--white);
    margin-bottom: 20px;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    display: inline-block;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-bottom {
    border-top: 1px solid #444;
    padding-top: 20px;
    text-align: center;
    font-size: 0.9rem;
}

/* Single Page Specific */
.single-post-header {
    margin-bottom: var(--spacing-lg);
}

.single-post-title {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

.post-details {
    display: flex;
    gap: 20px;
    color: var(--text-light);
    margin-bottom: var(--spacing-md);
    align-items: center;
    flex-wrap: wrap;
}

.featured-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    margin-bottom: var(--spacing-lg);
}

.post-content {
    font-size: 1.15rem;
    line-height: 1.8;
    color: #222;
}

.post-content p {
    margin-bottom: 20px;
}

.share-buttons {
    margin: var(--spacing-lg) 0;
}

.share-btn {
    display: inline-block;
    padding: 8px 16px;
    color: white;
    border-radius: 4px;
    margin-right: 10px;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.bg-fb {
    background-color: #3b5998;
}

.bg-tw {
    background-color: #1da1f2;
}

.bg-wa {
    background-color: #25d366;
}

/* Video Section */
.video-section {
    background: #000;
    padding: 40px 0;
    margin-bottom: 40px;
}

.video-section .section-title {
    color: white;
    border-color: #333;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.video-card {
    position: relative;
    cursor: pointer;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.8);
    transition: color 0.3s;
}

.video-card:hover .play-icon {
    color: var(--primary-color);
}

.video-title {
    color: white;
    margin-top: 10px;
    font-size: 1.1rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.pagination .page-numbers {
    padding: 8px 16px;
    border: 1px solid #ddd;
    color: var(--primary-color);
}

.pagination .current {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}