/*
Theme Name: TimesBull Core
Theme URI: https://www.timesbull.com
Author: TimesBull Media
Author URI: https://www.timesbull.com
Description: Enterprise-grade WordPress theme optimized for Google News, Discover, and Core Web Vitals
Version: 10.0.0
License: GPL v2 or later
Text Domain: timesbull-core
Requires at least: 6.5
Tested up to: 6.7
Requires PHP: 8.2
Tags: news, blog, magazine, fast, lightweight, seo, accessibility-ready
*/

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */
:root {
    --primary: #e74c3c;
    --primary-dark: #c0392b;
    --primary-light: #fee2e2;
    --text-dark: #1a1a1a;
    --text-medium: #333333;
    --text-light: #666666;
    --text-lighter: #999999;
    --bg-light: #f5f5f5;
    --bg-white: #ffffff;
    --border: #e0e0e0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --radius: 8px;
    --container: 1280px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-medium);
    background: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

/* ============================================
   CONTAINER
   ============================================ */
.tb-container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ============================================
   HEADER
   ============================================ */
.tb-header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.tb-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    gap: 20px;
}

.tb-logo {
    flex-shrink: 0;
}

.tb-logo img {
    max-height: 40px;
    width: auto;
}

.tb-site-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.tb-site-title a {
    color: var(--text-dark);
}

.tb-site-title a:hover {
    color: var(--primary);
}

/* Desktop Navigation */
.tb-nav-desktop {
    flex: 1;
}

.tb-nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.tb-nav-menu li {
    position: relative;
}

.tb-nav-menu a {
    font-weight: 500;
    font-size: 15px;
    padding: 8px 0;
    display: block;
}

.tb-nav-menu a:hover {
    color: var(--primary);
}

/* Dropdown Menu */
.tb-nav-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-white);
    min-width: 200px;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius);
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

.tb-nav-menu li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
}

.tb-nav-menu .sub-menu li {
    display: block;
}

.tb-nav-menu .sub-menu a {
    padding: 8px 15px;
    font-size: 14px;
}

/* Header Actions */
.tb-header-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.tb-search-toggle,
.tb-menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tb-search-toggle:hover,
.tb-menu-toggle:hover {
    background: var(--bg-light);
}

.tb-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
}

.tb-menu-toggle span {
    width: 20px;
    height: 2px;
    background: var(--text-dark);
    transition: 0.2s ease;
}

/* ============================================
   MOBILE MENU
   ============================================ */
.tb-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
}

.tb-mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

.tb-mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: var(--bg-white);
    z-index: 2001;
    transition: 0.3s ease;
    display: flex;
    flex-direction: column;
}

.tb-mobile-overlay.active .tb-mobile-menu {
    right: 0;
}

.tb-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.tb-menu-title {
    font-size: 18px;
    font-weight: 600;
}

.tb-mobile-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tb-mobile-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.tb-mobile-nav {
    list-style: none;
}

.tb-mobile-nav li {
    border-bottom: 1px solid var(--border);
}

.tb-mobile-nav a {
    display: block;
    padding: 12px 0;
    font-weight: 500;
}

.tb-mobile-nav .sub-menu {
    list-style: none;
    padding-left: 15px;
}

/* ============================================
   SEARCH OVERLAY
   ============================================ */
.tb-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tb-search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.tb-search-container {
    width: 90%;
    max-width: 600px;
    position: relative;
}

.tb-search-container form {
    display: flex;
    gap: 10px;
}

.tb-search-container input {
    flex: 1;
    height: 60px;
    padding: 0 20px;
    font-size: 18px;
    border: none;
    border-radius: 30px;
    outline: none;
}

.tb-search-container button {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.tb-search-container button:hover {
    transform: scale(1.05);
}

.tb-search-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
}

/* ============================================
   FEATURED STORY
   ============================================ */
.tb-featured-story {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin: 40px 0;
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.tb-featured-image {
    aspect-ratio: 16/9;
    overflow: hidden;
}

.tb-featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tb-featured-content {
    padding: 40px 40px 40px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tb-featured-label {
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.tb-featured-title {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 15px;
}

.tb-featured-title a:hover {
    color: var(--primary);
}

.tb-featured-excerpt {
    color: var(--text-light);
    margin-bottom: 20px;
}

/* ============================================
   SECTION TITLES
   ============================================ */
.tb-section-title {
    font-size: 24px;
    font-weight: 700;
    margin: 40px 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

/* ============================================
   POSTS GRID
   ============================================ */
.tb-posts-grid,
.tb-stories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.tb-post-card,
.tb-story-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tb-post-card:hover,
.tb-story-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.tb-card-img,
.tb-story-image {
    aspect-ratio: 16/9;
    overflow: hidden;
}

.tb-card-img img,
.tb-story-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.tb-post-card:hover .tb-card-img img,
.tb-story-card:hover .tb-story-image img {
    transform: scale(1.05);
}

.tb-card-content,
.tb-story-content {
    padding: 20px;
}

.tb-card-title,
.tb-story-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 10px;
}

.tb-card-title a:hover,
.tb-story-title a:hover {
    color: var(--primary);
}

.tb-card-meta,
.tb-story-meta {
    font-size: 13px;
    color: var(--text-lighter);
    margin-bottom: 10px;
}

.tb-card-excerpt {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.tb-read-more {
    color: var(--primary);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.tb-read-more:hover {
    gap: 10px;
}

/* ============================================
   CATEGORY SECTIONS
   ============================================ */
.tb-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0 20px;
}

.tb-section-header .tb-section-title {
    margin: 0;
    padding: 0;
    border: none;
}

.tb-view-all {
    color: var(--primary);
    font-weight: 500;
}

.tb-view-all:hover {
    text-decoration: underline;
}

.tb-category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.tb-category-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.tb-card-image {
    aspect-ratio: 16/9;
    overflow: hidden;
}

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

/* ============================================
   SINGLE POST
   ============================================ */
.tb-single-post {
    background: var(--bg-white);
    padding: 40px 0;
}

.tb-breadcrumbs {
    font-size: 13px;
    color: var(--text-lighter);
    margin-bottom: 20px;
}

.tb-breadcrumbs a {
    color: var(--primary);
}

.tb-breadcrumbs .separator {
    margin: 0 8px;
}

.tb-post-header {
    margin-bottom: 30px;
}

.tb-post-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.tb-category-badge {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.tb-post-title {
    font-size: 42px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
    color: var(--text-dark);
}

.tb-post-meta {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.tb-meta-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tb-meta-author img {
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

.tb-meta-date,
.tb-meta-reading-time {
    color: var(--text-light);
    font-size: 14px;
}

.tb-post-featured {
    margin: 30px 0;
    border-radius: var(--radius);
    overflow: hidden;
}

.tb-post-featured img {
    width: 100%;
    height: auto;
}

.tb-post-content {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-dark);
}

.tb-post-content p {
    margin-bottom: 1.5em;
}

.tb-post-content h2 {
    font-size: 28px;
    margin: 1.5em 0 0.5em;
}

.tb-post-content h3 {
    font-size: 24px;
    margin: 1.5em 0 0.5em;
}

.tb-post-content h4 {
    font-size: 20px;
    margin: 1.5em 0 0.5em;
}

.tb-post-content img {
    max-width: 100%;
    height: auto;
    margin: 30px 0;
    border-radius: var(--radius);
}

.tb-post-content ul,
.tb-post-content ol {
    margin: 0 0 1.5em 2em;
}

.tb-post-content li {
    margin-bottom: 0.5em;
}

.tb-post-content blockquote {
    margin: 1.5em 0;
    padding: 1em 2em;
    background: var(--bg-light);
    border-left: 4px solid var(--primary);
    font-style: italic;
}

.tb-post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
}

.tb-post-content th,
.tb-post-content td {
    border: 1px solid var(--border);
    padding: 10px;
}

.tb-post-content th {
    background: var(--bg-light);
}

/* ============================================
   SHARE BUTTONS
   ============================================ */
.tb-share-buttons {
    margin: 40px 0;
    padding: 30px;
    background: var(--bg-light);
    border-radius: var(--radius);
    text-align: center;
}

.tb-share-buttons h3 {
    margin-bottom: 20px;
}

.tb-share-links {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.tb-share-links a {
    padding: 10px 20px;
    border-radius: 30px;
    color: white;
    font-weight: 500;
    transition: transform 0.2s ease;
}

.tb-share-links a:hover {
    transform: translateY(-2px);
}

.tb-share-facebook { background: #1877f2; }
.tb-share-twitter { background: #1da1f2; }
.tb-share-linkedin { background: #0077b5; }
.tb-share-whatsapp { background: #25d366; }

/* ============================================
   RELATED POSTS
   ============================================ */
.tb-related-posts {
    margin-top: 40px;
}

.tb-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.tb-related-card {
    background: var(--bg-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.tb-related-image {
    aspect-ratio: 16/9;
    overflow: hidden;
    display: block;
}

.tb-related-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tb-related-title {
    padding: 15px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.tb-related-title a:hover {
    color: var(--primary);
}

/* ============================================
   PAGINATION
   ============================================ */
.tb-pagination {
    margin: 40px 0;
    text-align: center;
}

.tb-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 2px;
    background: var(--bg-white);
    border-radius: 4px;
    color: var(--text-medium);
}

.tb-pagination .page-numbers.current {
    background: var(--primary);
    color: white;
}

.tb-pagination .page-numbers:hover:not(.current) {
    background: var(--primary-light);
}

/* ============================================
   ARCHIVE PAGES
   ============================================ */
.tb-archive-header,
.tb-category-header,
.tb-tag-header,
.tb-author-header,
.tb-search-header {
    background: var(--bg-white);
    padding: 40px;
    margin: 30px 0;
    border-radius: var(--radius);
    text-align: center;
}

.tb-archive-title,
.tb-category-title,
.tb-tag-title,
.tb-search-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 10px;
}

.tb-archive-desc,
.tb-category-description,
.tb-tag-description {
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

.tb-search-count {
    color: var(--primary);
    font-weight: 500;
    margin-top: 10px;
}

/* ============================================
   AUTHOR PAGE
   ============================================ */
.tb-author-avatar img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin-bottom: 20px;
}

.tb-author-name {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
}

.tb-author-bio {
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto 15px;
}

.tb-author-stats {
    color: var(--primary);
    font-weight: 500;
}

/* ============================================
   SEARCH PAGE
   ============================================ */
.tb-search-form {
    max-width: 500px;
    margin: 20px auto 0;
}

.tb-search-form form {
    display: flex;
    gap: 10px;
}

.tb-search-form input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 30px;
    outline: none;
}

.tb-search-form button {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
}

.tb-search-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

.tb-search-card {
    display: flex;
    gap: 20px;
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    padding: 20px;
}

.tb-search-card-img {
    flex-shrink: 0;
    width: 150px;
    height: 100px;
    overflow: hidden;
    border-radius: var(--radius);
}

.tb-search-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tb-search-card-content {
    flex: 1;
}

.tb-search-card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
}

.tb-search-card-meta {
    font-size: 12px;
    color: var(--text-lighter);
    margin-bottom: 10px;
}

.tb-search-card-excerpt {
    font-size: 14px;
    color: var(--text-light);
}

/* ============================================
   404 PAGE
   ============================================ */
.tb-error-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
}

.tb-error-icon {
    font-size: 120px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 20px;
}

.tb-error-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 15px;
}

.tb-error-message {
    color: var(--text-light);
    margin-bottom: 30px;
}

.tb-error-search {
    max-width: 400px;
    margin: 0 auto 30px;
}

.tb-error-search form {
    display: flex;
    gap: 10px;
}

.tb-error-search input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 30px;
}

.tb-error-search button {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
}

.tb-error-links {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.tb-error-btn {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border-radius: 30px;
}

/* ============================================
   FOOTER
   ============================================ */
.tb-footer {
    background: #1a1a1a;
    color: #999;
    padding: 40px 0;
    margin-top: 60px;
}

.tb-footer-nav {
    margin-bottom: 20px;
}

.tb-footer-menu {
    display: flex;
    justify-content: center;
    gap: 30px;
    list-style: none;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
}

.tb-footer-menu a {
    color: #ccc;
}

.tb-footer-menu a:hover {
    color: var(--primary);
}

.tb-footer-copyright {
    text-align: center;
    font-size: 13px;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal;
}

.screen-reader-text:focus {
    background-color: var(--primary);
    clip: auto !important;
    clip-path: none;
    color: white;
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 992px) {
    .tb-nav-desktop {
        display: none;
    }
    
    .tb-menu-toggle {
        display: flex;
    }
    
    .tb-featured-story {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .tb-featured-content {
        padding: 30px;
    }
    
    .tb-posts-grid,
    .tb-stories-grid,
    .tb-category-grid,
    .tb-related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .tb-post-title {
        font-size: 32px;
    }
}

@media (max-width: 768px) {
    .tb-container {
        padding: 0 15px;
    }
    
    .tb-posts-grid,
    .tb-stories-grid,
    .tb-category-grid,
    .tb-related-grid {
        grid-template-columns: 1fr;
    }
    
    .tb-post-title {
        font-size: 28px;
    }
    
    .tb-post-content {
        font-size: 16px;
    }
    
    .tb-search-card {
        flex-direction: column;
    }
    
    .tb-search-card-img {
        width: 100%;
        height: 180px;
    }
    
    .tb-archive-title,
    .tb-category-title,
    .tb-tag-title,
    .tb-search-title {
        font-size: 28px;
    }
}

@media (max-width: 576px) {
    .tb-featured-title {
        font-size: 24px;
    }
    
    .tb-section-title {
        font-size: 20px;
    }
    
    .tb-post-meta {
        gap: 10px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .tb-header,
    .tb-footer,
    .tb-share-buttons,
    .tb-related-posts,
    .tb-pagination,
    .tb-search-form {
        display: none;
    }
    
    .tb-single-post {
        padding: 0;
    }
    
    .tb-post-content {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    a {
        text-decoration: underline;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}