/**
 * Global Dark Mode — Jory News Theme
 * ====================================
 * Single source of truth for ALL dark mode styles.
 * Triggered by: html[data-theme="dark"]
 * Loaded globally via enqueue.php
 *
 * @package jory-news-theme
 */

/* =============================================
   1) ROOT — Global Overrides
   ============================================= */
[data-theme="dark"] {
    color-scheme: dark;
    /* CSS Variables Override for dark mode (from custom-enhancements.css) */
    --jn-bg: #0f172a;
    --jn-bg-alt: #0c111d;
    --jn-surface: #1e293b;
    --jn-surface-hover: #334155;
    --jn-border: #334155;
    --jn-border-light: #1e293b;
    --jn-text: #f1f5f9;
    --jn-text-secondary: #cbd5e1;
    --jn-text-muted: #94a3b8;
    
    /* Shadows for dark mode */
    --jn-shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --jn-shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --jn-shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
    --jn-shadow-xl: 0 20px 50px rgba(0,0,0,0.6);
    --jn-shadow-glow: 0 0 20px rgba(232,68,58,0.15);
}

[data-theme="dark"] body {
    background-color: #0f172a;
    color: #cbd5e1;
}

/* =============================================
   2) TYPOGRAPHY — All Text
   ============================================= */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: #f1f5f9;
}

[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] li,
[data-theme="dark"] td,
[data-theme="dark"] th,
[data-theme="dark"] label,
[data-theme="dark"] figcaption {
    color: #cbd5e1;
}

[data-theme="dark"] a {
    color: #93c5fd;
}

[data-theme="dark"] a:hover {
    color: #bfdbfe;
}

/* =============================================
   3) GLOBAL CONTAINERS
   ============================================= */
[data-theme="dark"] .site-content,
[data-theme="dark"] .front-page-main,
[data-theme="dark"] .homepage-container,
[data-theme="dark"] #page {
    background: #0f172a;
}

/* =============================================
   4) TOP BAR
   ============================================= */
[data-theme="dark"] .top-bar {
    background: #0c111d;
    border-color: #1e293b;
}

[data-theme="dark"] .top-bar a,
[data-theme="dark"] .top-bar span {
    color: #94a3b8;
}

[data-theme="dark"] .top-bar a:hover {
    color: #e2e8f0;
}

/* =============================================
   5) BREAKING NEWS BAR
   ============================================= */
[data-theme="dark"] .breaking-bar-premium {
    background: linear-gradient(135deg, #991b1b 0%, #7f1d1d 50%, #450a0a 100%);
}

/* =============================================
   6) CARDS — All Post Cards, Sections
   ============================================= */
[data-theme="dark"] .post-card,
[data-theme="dark"] .card,
[data-theme="dark"] .news-card,
[data-theme="dark"] .article-card,
[data-theme="dark"] .trending-card,
[data-theme="dark"] .category-card,
[data-theme="dark"] .editors-pick-card,
[data-theme="dark"] .latest-card,
[data-theme="dark"] .single-entry,
[data-theme="dark"] .widget,
[data-theme="dark"] .sidebar-widget {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .post-card:hover,
[data-theme="dark"] .card:hover,
[data-theme="dark"] .news-card:hover,
[data-theme="dark"] .article-card:hover {
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

/* Card titles */
[data-theme="dark"] .post-card .card-title,
[data-theme="dark"] .post-card .card-title a,
[data-theme="dark"] .card-title,
[data-theme="dark"] .card-title a,
[data-theme="dark"] .news-card-title,
[data-theme="dark"] .news-card-title a,
[data-theme="dark"] .entry-title a,
[data-theme="dark"] .post-title a,
[data-theme="dark"] .article-title a {
    color: #f1f5f9;
}

[data-theme="dark"] .post-card .card-title a:hover,
[data-theme="dark"] .card-title a:hover,
[data-theme="dark"] .news-card-title a:hover,
[data-theme="dark"] .entry-title a:hover {
    color: #93c5fd;
}

/* Card meta text */
[data-theme="dark"] .card-meta,
[data-theme="dark"] .post-meta,
[data-theme="dark"] .entry-meta,
[data-theme="dark"] .post-date,
[data-theme="dark"] .card-date,
[data-theme="dark"] .meta-author,
[data-theme="dark"] .card-excerpt {
    color: #94a3b8;
}

/* =============================================
   6.5) BULLETPROOF SINGLE POST 
   ============================================= */
[data-theme="dark"] .single-post .premium-article,
[data-theme="dark"] .single-post .single-article,
[data-theme="dark"] .single-post article.post,
[data-theme="dark"] .single-page article.page {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .single-post .entry-content,
[data-theme="dark"] .single-post .entry-content p,
[data-theme="dark"] .single-post .entry-content div,
[data-theme="dark"] .single-post .entry-content span {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .single-post .entry-title,
[data-theme="dark"] .single-post .entry-content h1,
[data-theme="dark"] .single-post .entry-content h2,
[data-theme="dark"] .single-post .entry-content h3 {
    color: #f1f5f9 !important;
}

/* Card category badges */
[data-theme="dark"] .card-category,
[data-theme="dark"] .category-badge,
[data-theme="dark"] .cat-label {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

/* =============================================
   7) HOMEPAGE SECTIONS
   ============================================= */
[data-theme="dark"] .section-title,
[data-theme="dark"] .section-heading,
[data-theme="dark"] .block-title {
    color: #f1f5f9;
}

[data-theme="dark"] .section-title span {
    color: #fff;
}

[data-theme="dark"] .section-title::after {
    background: #334155;
}

/* Hero Section */
[data-theme="dark"] .hero-section,
[data-theme="dark"] .hero-wrapper,
[data-theme="dark"] .hero-grid {
    background: #0f172a;
}

/* Latest / Category Blocks */
[data-theme="dark"] .latest-section,
[data-theme="dark"] .category-blocks-section,
[data-theme="dark"] .trending-section,
[data-theme="dark"] .editors-picks-section,
[data-theme="dark"] .video-section,
[data-theme="dark"] .newsletter-section {
    background: #0f172a;
}

/* =============================================
   8) SIDEBAR
   ============================================= */
[data-theme="dark"] .sidebar,
[data-theme="dark"] .widget-area,
[data-theme="dark"] #secondary {
    background: transparent;
}

[data-theme="dark"] .widget {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .widget-title,
[data-theme="dark"] .widget h3,
[data-theme="dark"] .widget h4 {
    color: #f1f5f9;
    border-color: #334155;
}

[data-theme="dark"] .widget ul li a {
    color: #94a3b8;
}

[data-theme="dark"] .widget ul li a:hover {
    color: #e2e8f0;
}

/* =============================================
   9) FORMS & INPUTS
   ============================================= */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #64748b;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    border-color: var(--jooeri-primary, #3b82f6);
    outline-color: var(--jooeri-primary, #3b82f6);
}

/* =============================================
   10) COMMENTS
   ============================================= */
[data-theme="dark"] .comments-area,
[data-theme="dark"] .comment-list,
[data-theme="dark"] .comment-respond {
    background: transparent;
    color: #cbd5e1;
}

[data-theme="dark"] .comment-body {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .comment-author .fn,
[data-theme="dark"] .comment-author .fn a {
    color: #f1f5f9;
}

[data-theme="dark"] .comment-content p {
    color: #cbd5e1;
}

[data-theme="dark"] .comment-metadata a {
    color: #64748b;
}

[data-theme="dark"] .comment-reply-link {
    color: var(--jooeri-secondary, #e74c3c);
}

/* =============================================
   11) PAGINATION
   ============================================= */
[data-theme="dark"] .pagination,
[data-theme="dark"] .nav-links {
    color: #cbd5e1;
}

[data-theme="dark"] .page-numbers {
    background: #1e293b;
    color: #94a3b8;
    border-color: #334155;
}

[data-theme="dark"] .page-numbers:hover,
[data-theme="dark"] .page-numbers.current {
    background: var(--jooeri-primary, #3b82f6);
    color: #fff;
    border-color: var(--jooeri-primary, #3b82f6);
}

/* =============================================
   12) BREADCRUMBS
   ============================================= */
[data-theme="dark"] .breadcrumb,
[data-theme="dark"] .breadcrumbs,
[data-theme="dark"] .breadcrumb-trail {
    background: #1e293b;
    color: #94a3b8;
}

[data-theme="dark"] .breadcrumb a,
[data-theme="dark"] .breadcrumbs a {
    color: #94a3b8;
}

[data-theme="dark"] .breadcrumb a:hover,
[data-theme="dark"] .breadcrumbs a:hover {
    color: #e2e8f0;
}

/* =============================================
   13) FOOTER — Deepened (already dark, minor tweaks)
   ============================================= */
[data-theme="dark"] .footer-pro {
    background: #050b18;
    border-top: 1px solid #1e293b;
}

[data-theme="dark"] .footer-bottom-pro {
    background: rgba(0,0,0,0.5);
}

/* =============================================
   14) BACK TO TOP BUTTON
   ============================================= */
[data-theme="dark"] .btt-premium {
    background: rgba(var(--jooeri-btt-rgb, 59, 130, 246), 0.2);
    border-color: rgba(var(--jooeri-btt-rgb, 59, 130, 246), 0.35);
}

/* =============================================
   15) TABLES
   ============================================= */
[data-theme="dark"] table {
    border-color: #334155;
}

[data-theme="dark"] th {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #334155;
}

[data-theme="dark"] td {
    background: #0f172a;
    border-color: #1e293b;
}

[data-theme="dark"] tr:nth-child(even) td {
    background: #1e293b;
}

/* =============================================
   16) CODE & PRE
   ============================================= */
[data-theme="dark"] code {
    background: #1e293b;
    color: #fbbf24;
}

[data-theme="dark"] pre {
    background: #0c111d;
    color: #e2e8f0;
    border-color: #334155;
}

/* =============================================
   17) IMAGES & FIGURE
   ============================================= */
[data-theme="dark"] figure {
    background: transparent;
}

[data-theme="dark"] figcaption {
    color: #64748b;
}

/* =============================================
   18) BLOCKQUOTES (global)
   ============================================= */
[data-theme="dark"] blockquote {
    background: #1e293b;
    border-color: var(--jooeri-secondary, #e74c3c);
    color: #cbd5e1;
}

/* =============================================
   19) HR / DIVIDERS
   ============================================= */
[data-theme="dark"] hr {
    border-color: #334155;
}

/* =============================================
   20) SCROLL BAR
   ============================================= */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #0f172a;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* =============================================
   21) MISC — Borders, Shadows, Selection
   ============================================= */
[data-theme="dark"] ::selection {
    background: var(--jooeri-primary, #3b82f6);
    color: #fff;
}

/* Generic white backgrounds → dark */
[data-theme="dark"] .bg-white,
[data-theme="dark"] .background-white {
    background: #1e293b !important;
}

/* Generic light borders → dark */
[data-theme="dark"] .border-gray,
[data-theme="dark"] .border-light {
    border-color: #334155 !important;
}

/* =============================================
   22) WP BLOCK ELEMENTS (Gutenberg)
   ============================================= */
[data-theme="dark"] .wp-block-group,
[data-theme="dark"] .wp-block-column {
    background: transparent;
}

[data-theme="dark"] .wp-block-table table {
    border-color: #334155;
}

[data-theme="dark"] .wp-block-quote {
    background: #1e293b;
    border-color: var(--jooeri-secondary, #e74c3c);
    color: #cbd5e1;
}

[data-theme="dark"] .wp-block-code {
    background: #0c111d;
    color: #e2e8f0;
}

[data-theme="dark"] .wp-block-separator {
    border-color: #334155;
}

/* =============================================
   23) HOMEPAGE PREMIUM CARDS (home.css compat)
   ============================================= */
[data-theme="dark"] .hero-main-card,
[data-theme="dark"] .hero-side-card,
[data-theme="dark"] .hero-small-card {
    border-color: #334155;
}

[data-theme="dark"] .hero-main-card .card-content,
[data-theme="dark"] .hero-side-card .card-content,
[data-theme="dark"] .hero-small-card .card-content {
    background: linear-gradient(to top, #0f172a 0%, rgba(15, 23, 42, 0.8) 60%, transparent 100%);
}

[data-theme="dark"] .latest-posts-grid .post-card,
[data-theme="dark"] .category-block .post-card,
[data-theme="dark"] .trending-list .post-card {
    background: #1e293b;
    border-color: #334155;
}

/* =============================================
   24) ARCHIVE / CATEGORY PAGES
   ============================================= */
[data-theme="dark"] .archive-header,
[data-theme="dark"] .page-header {
    background: #1e293b;
    color: #f1f5f9;
}

[data-theme="dark"] .archive-title,
[data-theme="dark"] .page-title {
    color: #f1f5f9;
}

[data-theme="dark"] .archive-description,
[data-theme="dark"] .taxonomy-description {
    color: #94a3b8;
}

/* =============================================
   25) SEARCH PAGE
   ============================================= */
[data-theme="dark"] .search-form .search-field {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

/* =============================================
   26) 404 PAGE
   ============================================= */
[data-theme="dark"] .error-404 {
    background: #0f172a;
    color: #cbd5e1;
}

/* =============================================
   27) SMOOTH TRANSITION FOR ALL ELEMENTS
   ============================================= */
body,
body *,
body *::before,
body *::after {
    transition-property: background-color, border-color, color, box-shadow;
    transition-duration: 0.3s;
    transition-timing-function: ease;
}

/* Exception: Don't transition things that have their own animations */
.reading-progress-bar,
.breaking-ticker-track,
.btt-progress-bar,
.breaking-pulse,
[class*="animate"],
[class*="ticker"],
[class*="slide"] {
    transition-property: none !important;
}
