/*
Theme Name: Tawasul News
Theme URI: https://tawasulnews.com
Description: قالب ووردبريس إخباري احترافي عربي مع دعم كامل للـ RTL والوضع الليلي وشريط الأخبار العاجلة
Version: 1.0.0
Author: Tawasul News
Author URI: https://tawasulnews.com
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tawasul-news
Tags: rtl-language, news, arabic, dark-mode, responsive, custom-menu, featured-images, two-columns, right-sidebar
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
*/

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Kufi+Arabic:wght@400;600;700;900&family=Cairo:wght@300;400;600;700&display=swap');

/* ===========================
   CSS Custom Properties
=========================== */
:root {
    --primary: #8B1A1A;
    --primary-dark: #6B1010;
    --primary-light: #A52020;
    --accent: #D4AF37;
    --bg-dark: #0D0D0D;
    --bg-card: #161616;
    --bg-section: #1A1A1A;
    --bg-light: #F5F5F0;
    --bg-card-light: #FFFFFF;
    --text-primary: #FFFFFF;
    --text-secondary: #B0B0B0;
    --text-dark: #1A1A1A;
    --text-muted-dark: #555555;
    --border-color: #2A2A2A;
    --border-light: #E0E0E0;
    --font-heading: 'Noto Kufi Arabic', sans-serif;
    --font-body: 'Cairo', sans-serif;
    --radius: 6px;
    --shadow: 0 4px 16px rgba(0,0,0,0.4);
    --transition: 0.2s ease;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    direction: rtl;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.7;
    transition: background 0.3s, color 0.3s;
}

/* Light mode */
body.light-mode {
    background: var(--bg-light);
    color: var(--text-dark);
    --bg-card: var(--bg-card-light);
    --bg-section: #EBEBEB;
    --text-primary: var(--text-dark);
    --text-secondary: var(--text-muted-dark);
    --border-color: var(--border-light);
}

a { color: inherit; text-decoration: none; transition: color var(--transition); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* ===========================
   Layout
=========================== */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ===========================
   Typography
=========================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    line-height: 1.4;
    font-weight: 700;
}

/* ===========================
   Section Title
=========================== */
.section-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    padding-right: 14px;
    border-right: 4px solid var(--primary);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.section-title .more-link {
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--primary-light);
    border: 1px solid var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    transition: all var(--transition);
}
.section-title .more-link:hover { background: var(--primary); color: #fff; }

/* ===========================
   Top Bar
=========================== */
.top-bar {
    background: #0A0A0A;
    border-bottom: 1px solid var(--border-color);
    padding: 8px 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
body.light-mode .top-bar { background: #1a1a1a; }
.top-bar a { color: var(--text-secondary); }
.top-bar a:hover { color: var(--primary-light); }
.top-bar .social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--bg-section);
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-left: 4px;
    transition: all var(--transition);
}
.top-bar .social-icons a:hover { background: var(--primary); color: #fff; }

/* ===========================
   Header
=========================== */
.site-header {
    background: var(--bg-dark);
    padding: 18px 0;
    border-bottom: 2px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 1000;
}
body.light-mode .site-header { background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.1); }

.site-logo {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}
.site-logo span { color: var(--primary-light); }
.site-logo .logo-icon { color: var(--primary); font-size: 1.6rem; }

.header-search {
    flex: 1;
    max-width: 360px;
    margin: 0 40px;
    position: relative;
}
.header-search input {
    width: 100%;
    padding: 10px 42px 10px 16px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    background: var(--bg-section);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition);
}
.header-search input:focus { border-color: var(--primary); }
.header-search input::placeholder { color: var(--text-secondary); }
.header-search button {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
}

.header-actions { display: flex; align-items: center; gap: 12px; }

#dark-mode-toggle {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-section);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition);
}
#dark-mode-toggle:hover { border-color: var(--primary); color: var(--primary); }

.lang-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: none;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition);
}
.lang-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ===========================
   Navigation
=========================== */
.main-nav {
    background: var(--primary);
    position: sticky;
    top: 76px;
    z-index: 999;
}
.main-nav ul { display: flex; list-style: none; }
.main-nav ul li a {
    display: block;
    padding: 14px 18px;
    color: rgba(255,255,255,0.85);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition);
    position: relative;
    white-space: nowrap;
}
.main-nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0; left: 0;
    height: 3px;
    background: #fff;
    transform: scaleX(0);
    transition: transform var(--transition);
}
.main-nav ul li a:hover,
.main-nav ul li.current-menu-item a { color: #fff; }
.main-nav ul li a:hover::after,
.main-nav ul li.current-menu-item a::after { transform: scaleX(1); }

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 10px 0;
}

/* ===========================
   Breaking News Ticker
=========================== */
.breaking-ticker {
    background: #111;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: stretch;
    overflow: hidden;
    height: 40px;
}
body.light-mode .breaking-ticker { background: #f0f0f0; }

.breaking-label {
    background: var(--primary);
    color: #fff;
    padding: 0 20px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
}
.breaking-label::before {
    content: '';
    width: 8px; height: 8px;
    background: #ff4444;
    border-radius: 50%;
    animation: blink 1s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
.breaking-label::after {
    content: '';
    position: absolute;
    left: -10px;
    top: 0; bottom: 0;
    width: 20px;
    background: var(--primary);
    clip-path: polygon(0 0, 100% 0, 80% 100%, 0% 100%);
}

.ticker-wrapper {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
}
.ticker-track {
    display: flex;
    gap: 0;
    animation: tickerScroll 40s linear infinite;
    white-space: nowrap;
}
.ticker-wrapper:hover .ticker-track { animation-play-state: paused; }
.ticker-item {
    padding: 0 40px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    position: relative;
}
.ticker-item::before {
    content: '◆';
    color: var(--primary);
    margin-left: 8px;
    font-size: 0.6rem;
}
.ticker-item a { color: var(--text-secondary); }
.ticker-item a:hover { color: var(--primary-light); }
@keyframes tickerScroll {
    0%   { transform: translateX(-50%); }
    100% { transform: translateX(0%); }
}

/* ===========================
   Hero Block
=========================== */
.hero-block { padding: 30px 0; }
.hero-inner {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    direction: rtl;
}

.hero-main { position: relative; border-radius: var(--radius); overflow: hidden; }
.hero-main img {
    width: 100%;
    height: 480px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s;
}
.hero-main:hover img { transform: scale(1.03); }
.hero-main-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.92) 60%);
    padding: 60px 24px 24px;
}
.hero-main .category-badge { margin-bottom: 10px; }
.hero-main h2 {
    font-size: 1.7rem;
    font-family: var(--font-heading);
    color: #fff;
    line-height: 1.45;
    margin-bottom: 10px;
}
.hero-main .meta-info { color: rgba(255,255,255,0.7); font-size: 0.82rem; }

.hero-sidebar { display: flex; flex-direction: column; gap: 12px; }
.hero-side-item {
    display: flex;
    gap: 12px;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    flex: 1;
    transition: border-color var(--transition), transform var(--transition);
}
.hero-side-item:hover { border-color: var(--primary); transform: translateX(-3px); }
.hero-side-item img {
    width: 110px;
    height: 80px;
    object-fit: cover;
    flex-shrink: 0;
}
.hero-side-item .content {
    padding: 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.hero-side-item h4 {
    font-size: 0.87rem;
    font-family: var(--font-heading);
    line-height: 1.5;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.hero-side-item .meta-info { font-size: 0.75rem; color: var(--text-secondary); }

/* ===========================
   News Card
=========================== */
.news-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    border-color: var(--primary);
}
.news-card .card-image { overflow: hidden; position: relative; }
.news-card .card-image img {
    width: 100%;
    height: 190px;
    object-fit: cover;
    transition: transform 0.4s;
}
.news-card:hover .card-image img { transform: scale(1.05); }
.news-card .card-body { padding: 14px; }
.news-card h3 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    line-height: 1.55;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.news-card .card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.news-card .views { display: flex; align-items: center; gap: 4px; }

/* ===========================
   Category Badge
=========================== */
.category-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.73rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.cat-politics  { background: #1A56A8; }
.cat-economy   { background: #B8860B; }
.cat-sports    { background: #1A8030; }
.cat-tech      { background: #6B21A8; }
.cat-health    { background: #B8561A; }
.cat-world     { background: #1A7B8B; }
.cat-local     { background: #8B1A1A; }
.cat-general   { background: #555; }

/* ===========================
   Most Read
=========================== */
.most-read-list { display: flex; flex-direction: column; gap: 14px; }
.most-read-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}
.most-read-item:last-child { border-bottom: none; padding-bottom: 0; }
.most-read-number {
    font-size: 2rem;
    font-family: var(--font-heading);
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    min-width: 36px;
    text-align: center;
    opacity: 0.85;
}
.most-read-item img {
    width: 80px; height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.most-read-item .content { flex: 1; }
.most-read-item h4 {
    font-size: 0.87rem;
    font-family: var(--font-heading);
    line-height: 1.5;
    margin-bottom: 6px;
}
.most-read-item .meta { font-size: 0.73rem; color: var(--text-secondary); }

/* ===========================
   Category Section Block
=========================== */
.category-section-block { padding: 30px 0; border-top: 1px solid var(--border-color); }
.cat-section-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.cat-main { position: relative; border-radius: var(--radius); overflow: hidden; }
.cat-main img { width: 100%; height: 340px; object-fit: cover; }
.cat-main-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    padding: 50px 20px 20px;
}
.cat-main-overlay h3 { font-family: var(--font-heading); font-size: 1.2rem; color: #fff; }
.cat-main-overlay .meta { font-size: 0.78rem; color: rgba(255,255,255,0.7); margin-top: 8px; }

.cat-side-list { display: flex; flex-direction: column; gap: 12px; }
.cat-side-item {
    display: flex;
    gap: 10px;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    padding: 10px;
    transition: border-color var(--transition);
}
.cat-side-item:hover { border-color: var(--primary); }
.cat-side-item img { width: 90px; height: 65px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.cat-side-item h4 {
    font-size: 0.85rem;
    font-family: var(--font-heading);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cat-side-item .meta { font-size: 0.73rem; color: var(--text-secondary); margin-top: 6px; }

.more-btn {
    display: block;
    text-align: center;
    padding: 10px 24px;
    border: 1px solid var(--primary);
    border-radius: 24px;
    color: var(--primary-light);
    font-family: var(--font-body);
    font-size: 0.85rem;
    margin-top: 18px;
    transition: all var(--transition);
    width: fit-content;
}
.more-btn:hover { background: var(--primary); color: #fff; }

/* ===========================
   Sidebar
=========================== */
.content-sidebar-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 40px;
    padding: 30px 0;
    align-items: start;
}
.widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}
.widget-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    padding-right: 12px;
    border-right: 3px solid var(--primary);
    margin-bottom: 16px;
}

/* ===========================
   Single Post
=========================== */
.single-post {
    width: 100%;
    min-width: 0;
    padding: 30px 0;
}
.single-post .post-header { margin-bottom: 24px; }
.single-post h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    line-height: 1.4;
    margin-bottom: 16px;
}
.post-meta-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    flex-wrap: wrap;
    font-size: 0.83rem;
    color: var(--text-secondary);
}
.post-meta-bar .author { display: flex; align-items: center; gap: 8px; }
.post-meta-bar .author img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }

.post-featured-image { margin-bottom: 28px; border-radius: var(--radius); overflow: hidden; }
.post-featured-image img { width: 100%; max-height: 500px; object-fit: cover; }

.post-content {
    font-size: 1rem;
    line-height: 2;
    color: var(--text-secondary);
}
body.light-mode .post-content { color: #333; }
.post-content h2 { color: var(--text-primary); font-size: 1.3rem; margin: 28px 0 14px; }
.post-content h3 { color: var(--text-primary); font-size: 1.1rem; margin: 24px 0 12px; }
.post-content p { margin-bottom: 18px; }
.post-content blockquote {
    border-right: 4px solid var(--primary);
    padding: 14px 20px;
    margin: 24px 0;
    background: var(--bg-section);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--text-primary);
    font-size: 1.05rem;
}
.post-content img { border-radius: var(--radius); margin: 20px auto; }
.post-content a { color: var(--primary-light); text-decoration: underline; }

.share-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 28px 0;
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 24px;
    font-size: 0.82rem;
    color: #fff;
    cursor: pointer;
    transition: opacity var(--transition);
}
.share-btn:hover { opacity: 0.85; }
.share-facebook { background: #1877F2; }
.share-twitter  { background: #1DA1F2; }
.share-whatsapp { background: #25D366; }
.share-copy     { background: var(--bg-section); color: var(--text-secondary); border: 1px solid var(--border-color); }

.related-posts { padding: 30px 0; border-top: 1px solid var(--border-color); }

/* ===========================
   Archive / Category Page
=========================== */
.archive-header {
    padding: 30px 0;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 30px;
}
.archive-header h1 { font-family: var(--font-heading); font-size: 1.8rem; }
.archive-header .desc { color: var(--text-secondary); margin-top: 8px; }

/* ===========================
   Search Page
=========================== */
.search-header { padding: 30px 0; }
.search-form-large {
    display: flex;
    gap: 0;
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    max-width: 600px;
}
.search-form-large input {
    flex: 1;
    padding: 14px 20px;
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
}
.search-form-large button {
    padding: 14px 24px;
    background: var(--primary);
    border: none;
    color: #fff;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: background var(--transition);
}
.search-form-large button:hover { background: var(--primary-dark); }
.search-count { color: var(--text-secondary); margin-top: 8px; font-size: 0.85rem; }

/* ===========================
   Newsletter Strip
=========================== */
.newsletter-strip {
    background: var(--primary);
    padding: 50px 0;
    text-align: center;
    margin: 30px 0 0;
}
.newsletter-strip h3 { font-family: var(--font-heading); font-size: 1.6rem; color: #fff; margin-bottom: 8px; }
.newsletter-strip p { color: rgba(255,255,255,0.8); margin-bottom: 24px; }
.newsletter-form {
    display: flex;
    max-width: 480px;
    margin: 0 auto;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.newsletter-form input {
    flex: 1;
    padding: 14px 22px;
    border: none;
    font-family: var(--font-body);
    font-size: 0.9rem;
    background: #fff;
    color: #222;
    outline: none;
}
.newsletter-form input::placeholder { color: #999; }
.newsletter-form button {
    padding: 14px 26px;
    background: #222;
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background var(--transition);
}
.newsletter-form button:hover { background: #000; }

/* ===========================
   Footer
=========================== */
.site-footer {
    background: #0A0A0A;
    border-top: 2px solid var(--primary);
    padding: 50px 0 0;
    margin-top: 0;
}
.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
    gap: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
}
.footer-col h4 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}
.footer-col p { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.8; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a { color: var(--text-secondary); font-size: 0.85rem; transition: color var(--transition); }
.footer-col ul li a:hover { color: var(--primary-light); }
.footer-col ul li a::before { content: '← '; font-size: 0.7rem; }
.footer-social { display: flex; gap: 10px; margin-top: 16px; }
.footer-social a {
    width: 36px; height: 36px;
    background: var(--bg-section);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all var(--transition);
    border: 1px solid var(--border-color);
}
.footer-social a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.footer-bottom {
    padding: 20px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* ===========================
   Back to Top
=========================== */
#back-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 44px; height: 44px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(139,26,26,0.5);
    transition: all var(--transition);
    z-index: 9999;
}
#back-to-top:hover { background: var(--primary-dark); transform: translateY(-2px); }
#back-to-top.visible { display: flex; }

/* ===========================
   Pagination
=========================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 30px 0;
    flex-wrap: wrap;
}
.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all var(--transition);
}
.page-numbers:hover,
.page-numbers.current { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===========================
   404 Page
=========================== */
.error-404 { text-align: center; padding: 80px 20px; }
.error-404 .error-code { font-size: 8rem; font-family: var(--font-heading); color: var(--primary); line-height: 1; }
.error-404 h2 { font-size: 1.8rem; margin-bottom: 16px; }
.error-404 p { color: var(--text-secondary); margin-bottom: 30px; }

/* ===========================
   Author Box
=========================== */
.author-box {
    display: flex;
    gap: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    margin: 30px 0;
}
.author-box img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.author-box h4 { font-family: var(--font-heading); margin-bottom: 8px; font-size: 1.1rem; }
.author-box p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.7; }

/* ===========================
   Meta Info Utility
=========================== */
.meta-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.meta-info .sep { opacity: 0.4; }

/* ===========================
   Ad Zones
=========================== */
.ad-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-section);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 20px 0;
}
.ad-zone-top { min-height: 90px; }
.ad-zone-mid { min-height: 250px; }

/* ===========================
   Table of Contents
=========================== */
.toc-box {
    background: var(--bg-section);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    margin: 28px 0;
}
.toc-box h5 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.toc-box ol { counter-reset: toc; }
.toc-box ol li {
    counter-increment: toc;
    margin-bottom: 8px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}
.toc-box ol li::before {
    content: counter(toc) ". ";
    color: var(--primary-light);
    font-weight: 700;
}
.toc-box ol li a { color: var(--text-secondary); }
.toc-box ol li a:hover { color: var(--primary-light); }

/* ===========================
   Reading Progress Bar
=========================== */
#reading-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    background: var(--primary);
    width: 0%;
    z-index: 10000;
    transition: width 0.1s;
}

/* ===========================
   Responsive
=========================== */
@media (max-width: 1024px) {
    .hero-inner { grid-template-columns: 1fr; }
    .hero-sidebar { flex-direction: row; flex-wrap: wrap; }
    .hero-side-item { flex: 1 1 calc(50% - 6px); min-width: 200px; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .cat-section-inner { grid-template-columns: 1fr; }
    .cat-main img { height: 260px; }
}

@media (max-width: 768px) {
    .site-logo { font-size: 1.5rem; }
    .header-search { display: none; }
    .main-nav ul { flex-direction: column; display: none; }
    .main-nav.open ul { display: flex; }
    .nav-toggle { display: block; }
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .content-sidebar-wrap { grid-template-columns: 1fr; }
    .hero-main img { height: 260px; }
    .hero-main h2 { font-size: 1.2rem; }
    .footer-grid { grid-template-columns: 1fr; }
    .hero-sidebar { flex-direction: column; }
    .newsletter-form { flex-direction: column; border-radius: var(--radius); }
    .newsletter-form button { border-radius: 0 0 var(--radius) var(--radius); }
}

@media (max-width: 480px) {
    .container { padding: 0 14px; }
    .main-nav ul li a { padding: 12px 16px; }
    .single-post h1 { font-size: 1.4rem; }
    .error-404 .error-code { font-size: 5rem; }
}
