/*
 * Site-wide dark theme overrides — Global Bootstrap & legacy component theming
 * Homa CMS · MJ Redesign 2026
 */

/* Use the unified palette from editorial.css / news-design-system.css */

html.dark-theme {
    background-color: var(--hx-bg, #030508);
    color-scheme: dark;
}

html.dark-theme body {
    background-color: var(--hx-bg, #030508);
    color: var(--hx-text, #f0f6fc);
}

/* Reading progress */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 2.5px;
    background: linear-gradient(90deg, var(--hx-accent, #00c2ff), #6366f1);
    z-index: 10001;
    transition: width 0.1s linear;
    box-shadow: 0 0 16px rgba(0, 194, 255, 0.35);
}

/* ─── ed-header overrides ─── */
html.dark-theme .site-header-magazine {
    background: rgba(3, 5, 8, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(20px);
}

html.dark-theme .site-header-utility {
    background: linear-gradient(90deg, #061228, #0a1830, #061228) !important;
}

html.dark-theme .site-header-masthead {
    border-color: rgba(255, 255, 255, 0.06) !important;
    background: rgba(8, 13, 24, 0.9);
}

html.dark-theme .site-header-masthead-title { color: var(--hx-text, #f0f6fc) !important; }
html.dark-theme .site-header-masthead-subtitle { color: var(--hx-text-muted, #8b929e) !important; }
html.dark-theme .site-header-masthead-tagline { color: var(--hx-accent, #00c2ff) !important; }

html.dark-theme .site-header-mobile-toggle button,
html.dark-theme .site-header-mobile-search-toggle { color: var(--hx-text-muted) !important; }

html.dark-theme .site-header-mobile-toggle button:hover,
html.dark-theme .site-header-mobile-search-toggle:hover { color: var(--hx-accent, #00c2ff) !important; }

html.dark-theme .site-header-nav-bar {
    background: rgba(8, 13, 24, 0.9) !important;
    border-top-color: var(--hx-accent, #00c2ff) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

html.dark-theme .site-header-nav-link,
html.dark-theme .site-header-nav-btn { color: var(--hx-text-muted, #8b929e) !important; }

html.dark-theme .site-header-nav-link:hover,
html.dark-theme .site-header-nav-btn:hover {
    color: var(--hx-accent, #00c2ff) !important;
    border-bottom-color: var(--hx-accent, #00c2ff) !important;
}

html.dark-theme .site-header-dropdown {
    background: rgba(12, 18, 32, 0.97) !important;
    border-color: rgba(255, 255, 255, 0.10) !important;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

html.dark-theme .site-header-dropdown-link { color: var(--hx-text-muted) !important; }
html.dark-theme .site-header-dropdown-link:hover {
    background: rgba(0, 194, 255, 0.08) !important;
    color: var(--hx-accent, #00c2ff) !important;
}

html.dark-theme .site-header-mobile-panel {
    background: rgba(8, 13, 24, 0.98) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(20px);
}

html.dark-theme .site-header-mobile-link { color: var(--hx-text-muted) !important; }
html.dark-theme .site-header-mobile-link:hover {
    background: rgba(0, 194, 255, 0.06) !important;
    border-right-color: var(--hx-accent, #00c2ff) !important;
    color: var(--hx-text) !important;
}

html.dark-theme .site-header-mobile-submenu a { color: var(--hx-text-dim) !important; }
html.dark-theme .site-header-mobile-submenu a:hover {
    background: rgba(0, 194, 255, 0.06) !important;
    color: var(--hx-accent) !important;
}

html.dark-theme #header-search-input,
html.dark-theme #mobile-header-search-input {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.10) !important;
    color: var(--hx-text) !important;
}

html.dark-theme #header-search-input::placeholder,
html.dark-theme #mobile-header-search-input::placeholder { color: var(--hx-text-dim) !important; }

html.dark-theme .site-header-mobile-search-bar {
    background: rgba(3, 5, 8, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}

/* ─── Global surface overrides ─── */
html.dark-theme .bg-white { background-color: var(--news-surface, #0c1220) !important; }
html.dark-theme .bg-gray-50,
html.dark-theme .bg-slate-50 { background-color: var(--news-bg-elevated, #080d18) !important; }
html.dark-theme .bg-gray-100 { background-color: var(--news-surface-hover, #111c30) !important; }
html.dark-theme .bg-gray-200,
html.dark-theme .from-gray-200,
html.dark-theme .to-gray-300 { background-color: var(--news-surface-hover) !important; }

html.dark-theme .border-gray-100,
html.dark-theme .border-gray-200,
html.dark-theme .border-gray-300,
html.dark-theme .border-indigo-100 { border-color: rgba(255, 255, 255, 0.07) !important; }

html.dark-theme .text-gray-900,
html.dark-theme .text-gray-800,
html.dark-theme .text-gray-700 { color: var(--hx-text, #f0f6fc) !important; }

html.dark-theme .text-gray-600,
html.dark-theme .text-gray-500 { color: var(--hx-text-muted, #8b929e) !important; }

html.dark-theme .text-gray-400 { color: var(--hx-text-dim, #3d4454) !important; }

html.dark-theme .hover\:text-indigo-600:hover,
html.dark-theme .hover\:text-indigo-700:hover,
html.dark-theme .hover\:text-indigo-800:hover { color: var(--hx-accent, #00c2ff) !important; }

html.dark-theme .text-indigo-600,
html.dark-theme .text-indigo-700,
html.dark-theme .text-indigo-500 { color: var(--hx-accent, #00c2ff) !important; }

html.dark-theme .bg-gradient-to-br.from-gray-50,
html.dark-theme .min-h-screen.bg-gradient-to-br {
    background: var(--hx-bg, #030508) !important;
    background-image: none !important;
}

/* Blog page hero gradient */
html.dark-theme .bg-gradient-to-r.from-indigo-600,
html.dark-theme div[class*="from-indigo-600"][class*="to-blue-600"]:not(button):not(a) {
    background: linear-gradient(135deg, #080d18 0%, #0c1220 50%, #061530 100%) !important;
}

html.dark-theme .text-blue-100 { color: var(--hx-text-muted) !important; }

/* ─── Inputs / Textareas ─── */
html.dark-theme input,
html.dark-theme textarea,
html.dark-theme select {
    background-color: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.10) !important;
    color: var(--hx-text) !important;
}

html.dark-theme input::placeholder,
html.dark-theme textarea::placeholder { color: var(--hx-text-dim) !important; }

html.dark-theme input:focus,
html.dark-theme textarea:focus,
html.dark-theme select:focus {
    border-color: var(--hx-accent) !important;
    box-shadow: 0 0 0 3px rgba(0, 194, 255, 0.12) !important;
}

/* ─── Article prose ─── */
html.dark-theme .prose,
html.dark-theme #blog-content { color: var(--hx-text-muted) !important; }

html.dark-theme .prose h1,
html.dark-theme .prose h2,
html.dark-theme .prose h3,
html.dark-theme .prose h4,
html.dark-theme .prose strong { color: var(--hx-text) !important; }

html.dark-theme .prose p { color: var(--hx-text-muted) !important; }
html.dark-theme .prose a { color: var(--hx-accent) !important; }

html.dark-theme .prose blockquote {
    background: rgba(0, 194, 255, 0.07) !important;
    border-right-color: var(--hx-accent) !important;
    color: var(--hx-text) !important;
}

html.dark-theme #blog-content table { border-color: rgba(255, 255, 255, 0.07) !important; }
html.dark-theme #blog-content th,
html.dark-theme #blog-content td {
    border-color: rgba(255, 255, 255, 0.07) !important;
    background: var(--news-surface) !important;
    color: var(--hx-text-muted) !important;
}

/* TOC sidebar */
html.dark-theme #toc-list a { color: var(--hx-text-muted) !important; }
html.dark-theme #toc-list a:hover,
html.dark-theme #toc-list a.active {
    color: var(--hx-accent) !important;
    background: rgba(0, 194, 255, 0.08) !important;
}

/* ─── Pagination & buttons ─── */
html.dark-theme .hover\:bg-indigo-50:hover {
    background: rgba(0, 194, 255, 0.08) !important;
    border-color: var(--hx-accent) !important;
    color: var(--hx-accent) !important;
}

html.dark-theme .bg-indigo-600,
html.dark-theme button.bg-indigo-600 {
    background: linear-gradient(135deg, #0096cc, #00c2ff) !important;
    color: var(--hx-bg) !important;
}

html.dark-theme .shadow-md,
html.dark-theme .shadow-lg,
html.dark-theme .shadow-xl {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

/* ─── Mobile bottom nav ─── */
html.dark-theme .mobile-nav {
    background: rgba(8, 13, 24, 0.97) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    box-shadow: 0 -4px 28px rgba(0, 0, 0, 0.5);
}

html.dark-theme .mobile-nav .nav-item { color: var(--hx-text-dim) !important; }
html.dark-theme .mobile-nav .nav-item.active,
html.dark-theme .mobile-nav .nav-item:hover { color: var(--hx-accent) !important; }

html.dark-theme .mobile-mega-menu {
    background: rgba(8, 13, 24, 0.98) !important;
    color: var(--hx-text) !important;
    backdrop-filter: blur(20px);
}

html.dark-theme .mobile-mega-menu-header {
    background: rgba(12, 18, 32, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}

html.dark-theme .mobile-mega-menu-backdrop { background: rgba(0, 0, 0, 0.75) !important; }

/* ─── Bootstrap modals ─── */
html.dark-theme .form-preview-modal-content {
    background: var(--news-surface, #0c1220) !important;
    color: var(--hx-text) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark-theme .form-preview-modal-header {
    background: rgba(8, 13, 24, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}

html.dark-theme .form-preview-field {
    background: rgba(8, 13, 24, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.07) !important;
}

/* SweetAlert2 */
html.dark-theme .swal2-popup {
    background: var(--news-surface, #0c1220) !important;
    color: var(--hx-text) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* ─── Bootstrap cards / tables / lists ─── */
html.dark-theme .card,
html.dark-theme .card-body,
html.dark-theme .list-group-item {
    background-color: var(--news-surface, #0c1220) !important;
    border-color: rgba(255, 255, 255, 0.07) !important;
    color: var(--hx-text) !important;
}

html.dark-theme .card-header,
html.dark-theme .card-footer {
    background-color: rgba(8, 13, 24, 0.7) !important;
    border-color: rgba(255, 255, 255, 0.07) !important;
    color: var(--hx-text) !important;
}

html.dark-theme .table {
    color: var(--hx-text-muted) !important;
    border-color: rgba(255, 255, 255, 0.07) !important;
}

html.dark-theme .table > :not(caption) > * > * {
    background-color: var(--news-surface) !important;
    border-color: rgba(255, 255, 255, 0.07) !important;
    color: var(--hx-text-muted) !important;
}

html.dark-theme .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(8, 13, 24, 0.5) !important;
}

html.dark-theme .breadcrumb-item,
html.dark-theme .breadcrumb-item a { color: var(--hx-text-muted) !important; }
html.dark-theme .breadcrumb-item.active { color: var(--hx-text) !important; }

html.dark-theme .modal-content {
    background: var(--news-surface) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: var(--hx-text) !important;
}

html.dark-theme .modal-header,
html.dark-theme .modal-footer { border-color: rgba(255, 255, 255, 0.07) !important; }

html.dark-theme .btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: var(--hx-text-muted) !important;
}

html.dark-theme .btn-outline-secondary:hover {
    background: rgba(0, 194, 255, 0.08) !important;
    border-color: var(--hx-accent) !important;
    color: var(--hx-accent) !important;
}

html.dark-theme .page-link {
    background: var(--news-surface) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: var(--hx-text-muted) !important;
}

html.dark-theme .page-item.active .page-link {
    background: var(--hx-accent) !important;
    border-color: var(--hx-accent) !important;
    color: var(--hx-bg) !important;
}

html.dark-theme .alert { border-color: rgba(255, 255, 255, 0.08) !important; }

html.dark-theme .text-dark { color: var(--hx-text) !important; }
html.dark-theme .text-muted { color: var(--hx-text-muted) !important; }
html.dark-theme .bg-light { background-color: rgba(8, 13, 24, 0.7) !important; }

html.dark-theme h1,
html.dark-theme h2,
html.dark-theme h3,
html.dark-theme h4,
html.dark-theme h5,
html.dark-theme h6 { color: var(--hx-text); }

html.dark-theme a:not(.btn):not(.site-header-nav-link):not(.news-card) { color: inherit; }

/* ─── Home page ─── */
html.dark-theme .news-home-page { background: var(--hx-bg); }
html.dark-theme .min-h-screen.bg-white,
html.dark-theme .home-section { background-color: transparent; }

html.dark-theme .news-section-header { border-top-color: var(--hx-accent) !important; }
html.dark-theme .news-section-title { color: var(--hx-accent) !important; }
html.dark-theme .news-title { color: var(--hx-text) !important; }
html.dark-theme .news-card:hover .news-title { color: var(--hx-accent) !important; }
html.dark-theme .news-excerpt,
html.dark-theme .news-meta { color: var(--hx-text-muted) !important; }

html.dark-theme .news-card-media,
html.dark-theme .news-card-thumb {
    background: var(--news-surface-hover) !important;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

html.dark-theme .bg-slate-50 {
    background: var(--news-surface) !important;
    color: var(--hx-text-muted) !important;
}

/* ─── Footer ─── */
html.dark-theme footer {
    background: var(--news-surface, #0c1220) !important;
    border-top-color: var(--hx-accent) !important;
}

html.dark-theme footer .bg-white,
html.dark-theme footer .bg-gray-50 { background: rgba(8, 13, 24, 0.8) !important; }

html.dark-theme footer .border-gray-100,
html.dark-theme footer .border-gray-200 { border-color: rgba(255, 255, 255, 0.07) !important; }

html.dark-theme footer .text-gray-900,
html.dark-theme footer .text-gray-800 { color: var(--hx-text) !important; }

html.dark-theme footer .text-gray-600,
html.dark-theme footer .text-gray-500 { color: var(--hx-text-muted) !important; }

html.dark-theme footer .text-gray-400 { color: var(--hx-text-dim) !important; }
html.dark-theme footer a:hover { color: var(--hx-accent) !important; }

html.dark-theme footer input[type="email"] {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.10) !important;
    color: var(--hx-text) !important;
}

html.dark-theme footer input[type="email"]::placeholder { color: var(--hx-text-dim) !important; }

html.dark-theme footer button[type="submit"] {
    background: var(--hx-accent) !important;
    color: var(--hx-bg) !important;
}

html.dark-theme footer button[type="submit"]:hover {
    background: #00a8e0 !important;
}

/* ─── Dark-800, Dark-900, Dark-950 Tailwind color overrides ─── */
.dark-accent { color: var(--hx-accent) !important; }
.bg-dark-950 { background-color: var(--hx-bg) !important; }
.bg-dark-900 { background-color: var(--news-bg-elevated) !important; }
.bg-dark-800 { background-color: var(--news-surface) !important; }
.text-dark-accent { color: var(--hx-accent) !important; }
.border-dark-accent { border-color: var(--hx-accent) !important; }
.hover\:border-dark-accent:hover { border-color: var(--hx-accent) !important; }
.hover\:text-dark-accent:hover { color: var(--hx-accent) !important; }
.hover\:bg-dark-accent:hover { background-color: var(--hx-accent) !important; }
.bg-dark-accent { background-color: var(--hx-accent) !important; }
.text-dark-950 { color: var(--hx-bg) !important; }
.shadow-glow-cyan { box-shadow: 0 0 16px rgba(0, 194, 255, 0.4) !important; }
