/*
Theme Name: Daily It Hub
Theme URI: https://dailyithub.com
Author: Daily It Hub
Description: Professional News & Magazine WordPress Theme with dark mode, breaking news ticker, category sections, and AdSense-ready layouts.
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: dailyithub
Tags: news, blog, magazine, dark-mode, responsive
*/

/* ===== CSS VARIABLES ===== */
:root {
    --primary: #e63946;
    --primary-dark: #c1121f;
    --text: #1a1a1a;
    --text-light: #555;
    --bg: #ffffff;
    --bg-alt: #f5f5f5;
    --card-bg: #ffffff;
    --border: #e0e0e0;
    --header-bg: #ffffff;
    --footer-bg: #1a1a1a;
    --footer-text: #d0d0d0;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --radius: 10px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

html.dark-mode {
    --text: #e8e8e8;
    --text-light: #b0b0b0;
    --bg: #121212;
    --bg-alt: #1e1e1e;
    --card-bg: #1e1e1e;
    --border: #333;
    --header-bg: #1a1a1a;
    --footer-bg: #0a0a0a;
    --shadow: 0 2px 10px rgba(0,0,0,0.4);
}

/* ===== RESET ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===== TOP BAR (Date/Time) ===== */
.top-bar {
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    padding: 6px 0;
}
.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#dark-mode-toggle {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 14px;
}
#dark-mode-toggle:hover { background: rgba(255,255,255,0.35); }

/* ===== BREAKING NEWS TICKER ===== */
.breaking-news {
    display: flex;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    height: 42px;
}
html.dark-mode .breaking-news { background: var(--bg-alt); }
.breaking-label {
    background: var(--primary);
    color: #fff;
    padding: 0 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    height: 100%;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { background: var(--primary); }
    50% { background: var(--primary-dark); }
}
.ticker {
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
    position: relative;
}
.ticker a {
    display: inline-block;
    padding: 0 40px;
    font-size: 14px;
    color: var(--text);
    animation: ticker-scroll 25s linear infinite;
}
.ticker a:hover { color: var(--primary); }
@keyframes ticker-scroll {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}
.ticker:hover a { animation-play-state: paused; }

/* ===== HEADER ===== */
.site-header {
    background: var(--header-bg);
    box-shadow: var(--shadow);
    z-index: 999;
}
.site-header.sticky {
    position: sticky;
    top: 0;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    gap: 20px;
}
.logo h1, .logo a {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
}
.logo img { max-height: 50px; width: auto; }

.main-nav ul {
    display: flex;
    gap: 8px;
}
.main-nav a {
    padding: 8px 14px;
    font-weight: 600;
    font-size: 15px;
    border-radius: 6px;
    transition: all 0.2s;
    color: var(--text);
}
.main-nav a:hover,
.main-nav .current-menu-item > a {
    background: var(--primary);
    color: #fff;
}

.header-search input[type="search"] {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-alt);
    color: var(--text);
    font-size: 14px;
    width: 200px;
}

/* Mobile menu */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 26px;
    color: var(--text);
}

/* ===== READING PROGRESS ===== */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: var(--primary);
    z-index: 9999;
    transition: width 0.1s;
}

/* ===== SECTIONS ===== */
section { padding: 30px 0; }
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid var(--primary);
    padding-left: 12px;
    margin-bottom: 20px;
}
.section-header h2 {
    font-size: 22px;
    font-weight: 800;
    text-transform: uppercase;
}
.section-header a {
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
}

/* ===== NEWS GRID ===== */
.news-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.featured-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ===== NEWS CARD ===== */
.news-card, .featured-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.25s, box-shadow 0.25s;
    position: relative;
}
.news-card:hover, .featured-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.15);
}
.news-card a, .featured-card a { display: block; }
.news-card img, .featured-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--bg-alt);
}
.featured-card img { height: 260px; }
.card-content { padding: 14px; }
.news-card h3, .featured-card h3 {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    margin: 8px 0;
    color: var(--text);
}
.featured-card h3 { font-size: 18px; }
.news-card:hover h3, .featured-card:hover h3 { color: var(--primary); }
.news-card p { font-size: 13px; color: var(--text-light); margin-bottom: 8px; }
.news-card small { font-size: 12px; color: var(--text-light); }

/* ===== CATEGORY BADGE ===== */
.category-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff !important;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
}
.category-badge a { color: #fff !important; }

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 30px 0;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 6px;
    background: var(--bg-alt);
    color: var(--text);
    font-weight: 600;
    border: 1px solid var(--border);
}
.pagination .current, .pagination a:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ===== SINGLE POST ===== */
.single-post {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px 16px;
}
.single-post h1 {
    font-size: 34px;
    line-height: 1.25;
    margin-bottom: 14px;
    font-weight: 800;
}
.single-meta {
    display: flex;
    gap: 14px;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.single-featured-img {
    border-radius: var(--radius);
    margin-bottom: 24px;
    width: 100%;
}
.entry-content { font-size: 17px; line-height: 1.8; }
.entry-content p { margin-bottom: 18px; }
.entry-content h2 { font-size: 26px; margin: 24px 0 12px; }
.entry-content h3 { font-size: 21px; margin: 20px 0 10px; }
.entry-content img { border-radius: 8px; margin: 16px 0; }
.entry-content a { color: var(--primary); text-decoration: underline; }
.entry-content ul, .entry-content ol { margin: 0 0 18px 24px; }
.entry-content ul { list-style: disc; }
.entry-content ol { list-style: decimal; }
.entry-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 10px 20px;
    margin: 20px 0;
    background: var(--bg-alt);
    font-style: italic;
}

/* ===== SOCIAL SHARE ===== */
.social-share {
    display: flex;
    gap: 10px;
    margin: 30px 0;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    align-items: center;
}
.social-share span { font-weight: 700; margin-right: 6px; }
.social-share button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}
.share-fb { background: #1877f2; }
.share-tw { background: #1da1f2; }
.share-wa { background: #25d366; }
.share-ld { background: #0a66c2; }

/* ===== FOOTER ===== */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    margin-top: 50px;
    padding: 40px 0 0;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    padding-bottom: 30px;
}
.footer-col h4 {
    color: #fff;
    font-size: 17px;
    margin-bottom: 14px;
    border-left: 3px solid var(--primary);
    padding-left: 10px;
}
.footer-col ul li { margin-bottom: 8px; }
.footer-col a { color: var(--footer-text); font-size: 14px; }
.footer-col a:hover { color: var(--primary); }
.footer-col p { font-size: 14px; line-height: 1.7; margin-bottom: 10px; }
.footer-col img { max-height: 55px; margin-bottom: 12px; }
.social-links { display: flex; gap: 12px; margin-top: 10px; }
.social-links a {
    background: rgba(255,255,255,0.1);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
}
.social-links a:hover { background: var(--primary); color: #fff; }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 16px;
    text-align: center;
    font-size: 13px;
}

/* ===== NEWSLETTER POPUP ===== */
#newsletter-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: 0 6px 26px rgba(0,0,0,0.25);
    max-width: 320px;
    z-index: 9998;
    border-top: 4px solid var(--primary);
}
#newsletter-popup.hidden { display: none; }
#newsletter-popup h3 { font-size: 16px; margin-bottom: 10px; }
#newsletter-popup input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 8px;
    background: var(--bg);
    color: var(--text);
}
#newsletter-popup button {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 700;
}
#newsletter-close {
    position: absolute;
    top: 6px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-light);
}

/* ===== ADSENSE ===== */
.adsense-slot {
    margin: 20px 0;
    padding: 10px;
    background: var(--bg-alt);
    text-align: center;
    min-height: 90px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 12px;
}

/* ===== SEARCH RESULTS ===== */
.search-header { margin-bottom: 20px; }
.search-header h1 { font-size: 26px; margin-bottom: 6px; }

/* ===== 404 ===== */
.error-404 {
    text-align: center;
    padding: 80px 20px;
}
.error-404 h1 { font-size: 80px; color: var(--primary); }
.error-404 p { font-size: 18px; margin: 14px 0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
    .news-grid { grid-template-columns: repeat(3, 1fr); }
    .featured-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    .menu-toggle { display: block; }
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--header-bg);
        box-shadow: var(--shadow);
        padding: 10px;
        z-index: 999;
    }
    .main-nav.open { display: block; }
    .main-nav ul { flex-direction: column; }
    .header-inner { flex-wrap: wrap; position: relative; }
    .header-search { order: 3; width: 100%; }
    .header-search input { width: 100%; }
    .news-grid, .featured-grid { grid-template-columns: repeat(2, 1fr); }
    .single-post h1 { font-size: 26px; }
    .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .news-grid, .featured-grid { grid-template-columns: 1fr; }
    .logo h1, .logo a { font-size: 20px; }
    #newsletter-popup { left: 12px; right: 12px; max-width: none; }
}