:root {
    /* Light theme (default) */
    --primary-color: #0056b3;
    --secondary-color: #28a745;
    --text-color: #212529;
    /* Standard Bootstrap text */
    --text-color-secondary: #6c757d;
    /* Standard Bootstrap secondary text */
    --background-color: #fff;
    --card-bg-color: #fff;
    --header-bg-color: #fff;
    --footer-bg-color: #f8f9fa;
    --border-color: #dee2e6;
    /* Standard Bootstrap border */
    --shadow-color: rgba(0, 0, 0, 0.1);
    --input-bg: #fff;
    --input-text: #495057;
    --input-border-color: #ced4da;
    --link-color: #0056b3;
    --link-hover-color: #003d80;
    --button-text-color: #fff;
    --rgb-primary-color: 13, 110, 253;
    /* For Bootstrap focus shadow */
    --rgb-link-color: 62, 156, 255;
    /* For link button hover */
    --hero-bg-soft: radial-gradient(circle at 20% 30%, #a7fb6c22 0%, #eafaf1 60%, #fff 100%),
        radial-gradient(circle at 80% 60%, #b0e0fb22 0%, #fff 80%);
}

/* Dark theme */
:root.dark-theme {
    --primary-color: #74cda3;
    /* Bootstrap primary blue */
    --secondary-color: #198754;
    /* Bootstrap success green */
    --text-color: #dee2e6;
    /* Bootstrap dark theme text */
    --text-color-secondary: #adb5bd;
    /* Bootstrap dark theme secondary text */
    --background-color: #121212;
    --card-bg-color: #1a1a1a;
    /* Slightly lighter than deep background */
    --header-bg-color: #1a1a1a;
    --footer-bg-color: #1a1a1a;
    --border-color: #495057;
    /* Bootstrap dark theme border */
    --shadow-color: rgba(0, 0, 0, 0.65);
    --input-bg: #212529;
    --input-text: #dee2e6;
    --input-border-color: #495057;
    --link-color: #3f986e;
    /* Lighter blue for links on dark */
    --link-hover-color: #5ac694;
    --button-text-color: #fff;
    /* Keep button text light for primary buttons */
    --rgb-primary-color: 13, 110, 253;
    /* Same RGB for Bootstrap focus shadow, adjust if needed */
    --rgb-link-color: 62, 156, 255;
    /* Same RGB for link button hover */
    --header-bg-scrolled: rgba(18, 18, 18, 0.7);
    --hero-bg-soft: #000000;
}

/* Base styling & Transitions */
body {
    color: var(--text-color);
    background-color: var(--background-color);
    transition: background-color 0.25s ease-in-out, color 0.25s ease-in-out;
}

/* Apply transitions to a wide range of elements */
* {
    transition: background-color 0.25s ease-in-out, color 0.25s ease-in-out, border-color 0.25s ease-in-out, box-shadow 0.25s ease-in-out, fill 0.25s ease-in-out, stroke 0.25s ease-in-out, opacity 0.25s ease-in-out, filter 0.25s ease-in-out;
}

/* Dark theme overrides - HIGHLY AGGRESSIVE */
html.dark-theme body {
    color: var(--text-color) !important;
    background-color: var(--background-color) !important;
    /* Consolidate page-specific CSS variable overrides here for broad availability */
    --eco-primary-color: #28a745;
    --eco-primary-light: #5cb85c;
    --eco-primary-lighter: #90d990;
    --eco-bg-light: #222324;
    /* Dark background for sections often using this var */
    --eco-bg-lighter: #2a2b2c;
    /* Slightly lighter dark background */
}

/* Universal reset for backgrounds, borders, shadows. Text color handled more specifically. */
/* Note: border-color for ::before/::after is handled by the rule above. */
/* This targets actual elements now. */
html.dark-theme body * {
    background-color: transparent !important;
    box-shadow: none !important;
    /* We will let specific border rules or the ::before/::after catch-all manage border-color */
}

/* === NEW Broad Text Color Overrides (INSERTED) === */
html.dark-theme body p,
html.dark-theme body li,
html.dark-theme body dt,
html.dark-theme body dd,
html.dark-theme body label,
html.dark-theme body legend,
html.dark-theme body h1,
html.dark-theme body h2,
html.dark-theme body h3,
html.dark-theme body h4,
html.dark-theme body h5,
html.dark-theme body h6,
html.dark-theme body figcaption,
html.dark-theme body blockquote,
html.dark-theme body .text-content,
html.dark-theme body .description,
html.dark-theme body .caption,
html.dark-theme body .title,
html.dark-theme body .subtitle,
html.dark-theme body address,
html.dark-theme body article,
html.dark-theme body aside,
html.dark-theme body details,
html.dark-theme body summary,
html.dark-theme body footer:not(#emc-main-footer) span,
html.dark-theme body header:not(#emc-global-header) span,
/* More general divs and spans that are likely text containers */
html.dark-theme body span:not([class*="icon"]):not([class*="fa-"]):not([class*="fas"]):not([class*="far"]):not([class*="fal"]):not([class*="fab"]):not(.dot):not(.badge):not(.label):not(.tag):not([class*="slick"]):not([class*="carousel"]):not([aria-hidden="true"]):not([class*="progress"]):not([class*="chart"]),
html.dark-theme body div:not([class*="icon"]):not([class*="logo"]):not([class*="fa-"]):not([class*="fas"]):not([class*="far"]):not([class*="fal"]):not([class*="fab"]):not([class*="slick"]):not([class*="slider"]):not([role]):not([class*="modal"]):not([class*="tooltip"]):not([class*="progress"]):not([class*="chart"]):not([class*="video"]):not([class*="map"]):not([class*="carousel"]):not([class*="tab-pane"]):not([class*="card-img"]):not([class*="img-"]):not([style*="background-image"]):not([style*="background:"]):not([class*="container"]):not([class*="row"]):not([class*="col-"]) {
    color: var(--text-color) !important;
}

html.dark-theme body th,
html.dark-theme body td {
    color: var(--text-color) !important;
}

html.dark-theme body small,
html.dark-theme body .text-muted {
    color: var(--text-color-secondary) !important;
}

html.dark-theme body strong,
html.dark-theme body b {
    color: var(--text-color) !important;
}

html.dark-theme body hr {
    border-top-color: var(--border-color) !important;
    border-width: 1px !important;
    opacity: 0.25 !important;
}

/* === NEW GENERIC PAGE CONTENT OVERRIDES (INSERTED) === */
html.dark-theme body section[style*="background: #f8fafc"],
html.dark-theme body div[style*="background: #f8fafc"],
html.dark-theme body section[style*="background: #ffffff"],
html.dark-theme body div[style*="background: #ffffff"],
html.dark-theme body section[style*="background-color: #fff"],
html.dark-theme body div[style*="background-color: #fff"],
html.dark-theme body section[style*="background: #f5fcf6"],
html.dark-theme body div[style*="background: #f5fcf6"],
html.dark-theme body section[style*="background-color: #f8fff8"],
html.dark-theme body div[style*="background-color: #f8fff8"],
html.dark-theme body section[style*="background: linear-gradient(135deg, #e0ffe8 0%, #f5fcf6 100%)"],
html.dark-theme body div[style*="background: linear-gradient(135deg, #e0ffe8 0%, #f5fcf6 100%)"] {
    background-color: var(--background-color) !important;
    background-image: none !important;
}

html.dark-theme body div[style*="background: #f8fff8"],
html.dark-theme body div[style*="background: #f0f9f1"],
html.dark-theme body div.card[style*="background: #f8fff8"] {
    background-color: var(--card-bg-color) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 2px 5px var(--shadow-color) !important;
    background-image: none !important;
}

html.dark-theme body *[style*="color: #222"],
html.dark-theme body *[style*="color: #333"],
html.dark-theme body *[style*="color: #000"],
html.dark-theme body *[style*="color: #1a1a1a"],
html.dark-theme body *[style*="color: black"],
html.dark-theme body *[style*="color:initial"] {
    color: var(--text-color) !important;
}

html.dark-theme body *[style*="color: #555"],
html.dark-theme body *[style*="color: #666"],
html.dark-theme body *[style*="color: #777"],
html.dark-theme body *[style*="color: #7b8ca0"],
html.dark-theme body *[style*="color: #6c757d"] {
    color: var(--text-color-secondary) !important;
}

html.dark-theme body *[style*="color: #086924"],
html.dark-theme body *[style*="color: #28a745"],
html.dark-theme body *[style*="color: #198754"],
html.dark-theme body *[style*="color: #43b26c"] {
    color: var(--eco-primary-light) !important;
}

html.dark-theme body *[style*="background: linear-gradient"] {
    background-image: none !important;
    background-color: var(--card-bg-color) !important;
}

html.dark-theme body *[style*="background: radial-gradient"] {
    background-image: none !important;
    background-color: var(--card-bg-color) !important;
}

html.dark-theme body span[style*="-webkit-text-fill-color: transparent"][style*="background: linear-gradient"] {
    background: linear-gradient(90deg, var(--eco-primary-light) 0%, var(--eco-primary-lighter) 100%) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

/* === UNIVERSAL OVERRIDES (USE WITH CAUTION) === */
html.dark-theme body *,
html.dark-theme body *::before,
html.dark-theme body *::after {
    /* color: var(--text-color) !important; /* CAUTION: This is very broad, can break icons if not careful. Apply text color more specifically. */
    background-color: transparent !important;
    /* Force transparent background on almost all elements. Specific elements will override this. */
    border-color: var(--border-color) !important;
    /* Universal border color. Specific elements can override or set border: none. */
    box-shadow: none !important;
    /* Reset shadows globally, then re-apply specifically where needed. */
}

/* Text Elements: Increased Specificity. Crucial to make text readable. */
html.dark-theme body p,
html.dark-theme body span:not([class*="icon"]):not([class*="fa-"]):not([class*="fas"]):not([class*="far"]):not([class*="fal"]):not([class*="fab"]):not(.dot):not(.badge):not(.label):not(.tag),
html.dark-theme body div:not([class*="icon"]):not([class*="logo"]):not([class*="fa-"]):not([class*="fas"]):not([class*="far"]):not([class*="fal"]):not([class*="fab"]):not([class*="slick"]):not([class*="slider"]):not([role]):not([class*="modal"]):not([class*="tooltip"]):not([class*="progress"]):not([class*="chart"]):not([class*="video"]):not([class*="map"]),
html.dark-theme body li,
html.dark-theme body dt,
html.dark-theme body dd,
html.dark-theme body label,
html.dark-theme body legend,
html.dark-theme body h1,
html.dark-theme body h2,
html.dark-theme body h3,
html.dark-theme body h4,
html.dark-theme body h5,
html.dark-theme body h6,
html.dark-theme body figcaption,
html.dark-theme body blockquote,
html.dark-theme body .text-content,
html.dark-theme body .description,
html.dark-theme body .caption,
html.dark-theme body .title,
html.dark-theme body .subtitle {
    color: var(--text-color) !important;
}

html.dark-theme body th,
html.dark-theme body td {
    color: var(--text-color) !important;
}

html.dark-theme body small,
html.dark-theme body .text-muted {
    color: var(--text-color-secondary) !important;
}

html.dark-theme body strong,
html.dark-theme body b {
    color: var(--text-color) !important;
}

html.dark-theme body hr {
    border-top-color: var(--border-color) !important;
    border-width: 1px !important;
    /* Ensure it's visible */
    opacity: 0.25 !important;
    /* Make it subtle */
}


html.dark-theme body a:hover,
html.dark-theme body a:focus {
    color: var(--link-hover-color) !important;
    text-decoration-color: var(--link-hover-color) !important;
}

/* Header & Navigation */
html.dark-theme body #emc-global-header {
    background-color: var(--header-bg-color) !important;
    box-shadow: 0 1px 3px var(--shadow-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

html.dark-theme body #emc-global-header::before {
    background: none !important;
    display: none !important;
}

html.dark-theme body .emc-global-header-logo img {
    filter: brightness(1.5) contrast(0.9) saturate(0.8) !important;
}

html.dark-theme body .emc-global-header-nav-link,
html.dark-theme body .emc-global-header-nav a {
    color: var(--text-color) !important;
}

html.dark-theme body .emc-global-header-nav-link:hover,
html.dark-theme body .emc-global-header-nav-link.active,
html.dark-theme body .emc-global-header-nav a:hover,
html.dark-theme body .emc-global-header-nav a.active {
    color: var(--secondary-color) !important;
}

html.dark-theme body .emc-global-header-nav-link::after,
html.dark-theme body .emc-global-header-nav a::after {
    background-color: var(--secondary-color) !important;
}

html.dark-theme body .emc-global-header-lang-toggle,
html.dark-theme body .emc-global-header-search-btn,
html.dark-theme body .emc-global-header-mobile-menu-toggle {
    color: var(--text-color-secondary) !important;
    /* background-color transparent is handled by universal reset */
    /* border transparent is handled by universal reset */
}

html.dark-theme body .emc-global-header-lang-toggle i,
html.dark-theme body .emc-global-header-search-btn i,
html.dark-theme body .emc-global-header-mobile-menu-toggle i {
    color: var(--text-color-secondary) !important;
    /* Ensure icon color matches button text */
}

html.dark-theme body .emc-global-header-lang-toggle:hover,
html.dark-theme body .emc-global-header-search-btn:hover,
html.dark-theme body .emc-global-header-mobile-menu-toggle:hover {
    color: var(--text-color) !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
}

html.dark-theme body .emc-global-header-lang-toggle:hover i,
html.dark-theme body .emc-global-header-search-btn:hover i,
html.dark-theme body .emc-global-header-mobile-menu-toggle:hover i {
    color: var(--text-color) !important;
}

html.dark-theme body .emc-global-header-lang-menu {
    background-color: var(--card-bg-color) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 5px 15px var(--shadow-color) !important;
}

html.dark-theme body .emc-global-header-lang-option {
    color: var(--text-color) !important;
}

html.dark-theme body .emc-global-header-lang-option:hover,
html.dark-theme body .emc-global-header-lang-option.active {
    background-color: var(--input-bg) !important;
    color: var(--primary-color) !important;
}

html.dark-theme body .emc-global-header-search-container {
    background-color: var(--header-bg-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
    box-shadow: 0 3px 5px var(--shadow-color) !important;
}

html.dark-theme body .emc-global-header-search-input {
    background-color: var(--input-bg) !important;
    color: var(--input-text) !important;
    border: 1px solid var(--input-border-color) !important;
}

html.dark-theme body .emc-global-header-search-input::placeholder {
    color: var(--text-color-secondary) !important;
}

html.dark-theme body .emc-global-header-search-button {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 1px 3px var(--shadow-color) !important;
}

html.dark-theme body .emc-global-header-search-button i {
    color: #fff !important;
}

html.dark-theme body .emc-global-header-search-results {
    background-color: var(--card-bg-color) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 5px 15px var(--shadow-color) !important;
}

/* Generic Containers, Sections, Cards that NEED a background and shadow */
html.dark-theme body .card,
html.dark-theme body .news-item,
html.dark-theme body [class*="-item"]:not(li),
html.dark-theme body [class*="-card"],
html.dark-theme body [class*="-box"]:not([class*="info-box"]):not([class*="feature-box"]),
html.dark-theme body [class*="-block"]:not(blockquote),
html.dark-theme body [class*="-holder"]:not([class*="placeholder"]),
html.dark-theme body [class*="-panel"],
html.dark-theme body [class*="-widget"],
html.dark-theme body .comment-body,
html.dark-theme body .post,
html.dark-theme body .entry,
html.dark-theme body .article,
html.dark-theme body .profile-card,
html.dark-theme body .info-box,
/* Specifically give these a background */
html.dark-theme body .feature-box,
html.dark-theme body .testimonial,
html.dark-theme body .pricing-table {
    background-color: var(--card-bg-color) !important;
    box-shadow: 0 2px 5px var(--shadow-color) !important;
    border: 1px solid var(--border-color) !important;
}

/* Page Structure & Layout Elements that should use main background */
html.dark-theme body .main-container,
html.dark-theme body .page-content,
html.dark-theme body .content-area,
html.dark-theme body .main-content,
html.dark-theme body .primary-content,
html.dark-theme body .secondary-content,
html.dark-theme body .sidebar,
html.dark-theme body .wrapper,
html.dark-theme body .container,
html.dark-theme body .row,
html.dark-theme body [class*="col-"],
html.dark-theme body [class*="grid"]:not([class*="-card"]):not([class*="-item"]),
html.dark-theme body header:not(#emc-global-header),
html.dark-theme body footer:not(footer),
/* Site footer is handled below */
html.dark-theme body section:not([class*="-card"]):not([class*="-box"]):not([class*="-widget"]),
html.dark-theme body article:not([class*="-card"]):not([class*="-box"]),
html.dark-theme body aside:not([class*="-widget"]),
html.dark-theme body nav:not(#emc-global-main-nav) {
    background-color: var(--background-color) !important;
    /* Default to main bg */
    /* Text color should be inherited or set by more specific rules */
}

/* Specific large sections might still need card-like background */
html.dark-theme body .emc-ecosystem,
html.dark-theme body .made-by-emc,
html.dark-theme body .sustainable-dev,
html.dark-theme body .featured-news-section {
    background-color: var(--card-bg-color) !important;
    padding: 20px !important;
    border-radius: none !important;
    box-shadow: none !important;
    /* ← Xóa bóng */
    border: none !important;
    /* ← Xóa viền hoàn toàn */
    margin-bottom: 2rem !important;
}

html.dark-theme body .section-header h2,
html.dark-theme body .section-title,
html.dark-theme body .page-title {
    color: var(--text-color) !important;
    border-bottom-color: var(--border-color) !important;
}

html.dark-theme body .section-header h2::after {
    background-color: var(--secondary-color) !important;
}

html.dark-theme body button:hover,
html.dark-theme body .btn:hover,
html.dark-theme body input[type="button"]:hover,
html.dark-theme body input[type="submit"]:hover,
html.dark-theme body input[type="reset"]:hover,
html.dark-theme body a[class*="button"]:hover,
html.dark-theme body a[class*="btn"]:hover {
    filter: brightness(1.2) !important;
    box-shadow: 0 2px 6px var(--shadow-color) !important;
}

html.dark-theme body .btn-secondary,
html.dark-theme body a.btn-secondary {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    color: #fff !important;
}

html.dark-theme body .btn-text,
html.dark-theme body a.btn-text,
html.dark-theme body .btn-link,
html.dark-theme body a.btn-link {
    background-color: transparent !important;
    color: var(--link-color) !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

html.dark-theme body .btn-text:hover,
html.dark-theme body a.btn-text:hover,
html.dark-theme body .btn-link:hover,
html.dark-theme body a.btn-link:hover {
    color: var(--link-hover-color) !important;
    background-color: rgba(var(--rgb-link-color), 0.1) !important;
    text-decoration: underline !important;
}

/* Forms */
html.dark-theme body input[type="text"],
html.dark-theme body input[type="email"],
html.dark-theme body input[type="password"],
html.dark-theme body input[type="search"],
html.dark-theme body input[type="tel"],
html.dark-theme body input[type="url"],
html.dark-theme body input[type="number"],
html.dark-theme body input[type="date"],
html.dark-theme body input[type="datetime-local"],
html.dark-theme body input[type="month"],
html.dark-theme body input[type="week"],
html.dark-theme body input[type="time"],
html.dark-theme body select,
html.dark-theme body textarea {
    background-color: var(--input-bg) !important;
    color: var(--input-text) !important;
    border: 1px solid var(--input-border-color) !important;
    border-radius: 0.25rem;
    box-shadow: none !important;
}

html.dark-theme body input::placeholder,
html.dark-theme body textarea::placeholder {
    color: var(--text-color-secondary) !important;
    opacity: 1 !important;
}

html.dark-theme body select option {
    background-color: var(--card-bg-color) !important;
    color: var(--input-text) !important;
}

html.dark-theme body input:focus,
html.dark-theme body select:focus,
html.dark-theme body textarea:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--rgb-primary-color), 0.25) !important;
}

/* Tables */
html.dark-theme body table {
    width: 100%;
    border: 1px solid var(--border-color) !important;
    border-radius: 0.25rem;
    background-color: var(--card-bg-color) !important;
    border-collapse: separate !important;
    border-spacing: 0;
}

html.dark-theme body th,
html.dark-theme body td {
    border-bottom: 1px solid var(--border-color) !important;
    padding: 0.75rem !important;
    text-align: left;
}

html.dark-theme body tr:last-child td {
    border-bottom: none !important;
}

html.dark-theme body th {
    color: var(--text-color) !important;
    font-weight: 600 !important;
    border-bottom-width: 2px !important;
}

/* Pagination */
html.dark-theme body .pagination .page-link {
    background-color: var(--card-bg-color) !important;
    color: var(--link-color) !important;
    border: 1px solid var(--border-color) !important;
}

html.dark-theme body .pagination .page-link:hover {
    background-color: var(--input-bg) !important;
}

html.dark-theme body .pagination .page-item.active .page-link {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}

html.dark-theme body .pagination .page-item.disabled .page-link {
    color: var(--text-color-secondary) !important;
    background-color: var(--card-bg-color) !important;
    opacity: 0.65 !important;
}

/* Footer */
html.dark-theme body footer {
    background-color: var(--footer-bg-color) !important;
    border-top: 1px solid var(--border-color) !important;
    box-shadow: 0 -1px 3px var(--shadow-color) !important;
}

html.dark-theme body footer p,
html.dark-theme body footer li,
html.dark-theme body footer span,
html.dark-theme body footer div:not([class*="logo"]) {
    color: var(--text-color-secondary) !important;
    /* background-color transparent from universal reset */
}

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

html.dark-theme body footer a {
    color: var(--link-color) !important;
}

html.dark-theme body footer a:hover {
    color: var(--link-hover-color) !important;
}

html.dark-theme body .footer-newsletter input {
    background-color: var(--input-bg) !important;
    color: var(--input-text) !important;
    border-color: var(--input-border-color) !important;
}

html.dark-theme body .footer-newsletter button {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

/* Sliders */
html.dark-theme body .hero-slider .slider-content,
html.dark-theme body .slide-content {
    color: #fff !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7) !important;
}

html.dark-theme body .hero-slider .dot {
    background: rgba(255, 255, 255, 0.35) !important;
    border: 1px solid rgba(0, 0, 0, 0.3) !important;
}

html.dark-theme body .hero-slider .dot.active {
    background: #fff !important;
    border-color: #fff !important;
}

html.dark-theme body .hero-slider .arrow {
    background: rgba(0, 0, 0, 0.55) !important;
    color: #fff !important;
}

html.dark-theme body .hero-slider .arrow:hover {
    background: rgba(0, 0, 0, 0.75) !important;
}

/* Theme Toggle Button */
.theme-toggle {
    z-index: 1000001 !important;
    position: relative;
}

html.dark-theme .theme-toggle i {
    color: var(--text-color-secondary) !important;
}

html.dark-theme .theme-toggle:hover i {
    color: var(--text-color) !important;
}

/* SVG Icons */
html.dark-theme body svg:not([class*="logo"]) {
    /* Avoid theming SVG logos if they are specific */
    fill: currentColor !important;
}

html.dark-theme body svg:not([class*="logo"]) path[fill]:not([fill="none"]) {
    fill: #086924 !important;
}

html.dark-theme body svg:not([class*="logo"]) path[stroke]:not([stroke="none"]) {
    stroke: currentColor !important;
}

/* Ensure icon font libraries are not inadvertently overridden by broad span/div rules */
html.dark-theme body .fa,
html.dark-theme body .fas,
html.dark-theme body .far,
html.dark-theme body .fal,
html.dark-theme body .fab,
html.dark-theme body [class*="icon-"],
html.dark-theme body [class^="icon-"] {
    color: inherit !important;
    /* Let their specific CSS define color, or use currentColor from parent */
    background-color: transparent !important;
}

/* Background Images - Placeholder for manual review 
html.dark-theme body .some-element-with-light-bg-image {
    filter: invert(1) hue-rotate(180deg); 
    background-blend-mode: multiply; // Example
    background-color: rgba(0,0,0,0.5); // Example overlay
} */

/* Catch-all for text and transparent backgrounds where appropriate */
html.dark-theme body p,
html.dark-theme body span:not([class*="icon"]):not([class*="fa-"]):not([class*="badge"]),
html.dark-theme body div:not([class*="icon"]):not([class*="logo"]):not([class*="fa-"]):not([role="dialog"]):not([class*="modal"]),
html.dark-theme body li,
html.dark-theme body dt,
html.dark-theme body dd,
html.dark-theme body label,
html.dark-theme body legend,
html.dark-theme body h1,
html.dark-theme body h2,
html.dark-theme body h3,
html.dark-theme body h4,
html.dark-theme body h5,
html.dark-theme body h6,
html.dark-theme body figcaption,
html.dark-theme body .text-content,
/* Generic class for text blocks : :not([class*="slick"]):not([class*="tooltip"])*/
html.dark-theme body .description

/* Generic class for descriptions */
    {
    color: var(--text-color) !important;
    background-color: transparent !important;
}

html.dark-theme body .core-values-terrace-section .ecosystem-container .core-values-terrace .core-value-box .core-value-detail.my-dark-detail {
    background-color: rgb(35, 35, 35) !important;
    border: 1px solid white;
}

html.dark-theme body th,
html.dark-theme body td {
    color: var(--text-color) !important;
    /* Background handled by table specific rules */
}

html.dark-theme body small,
html.dark-theme body .text-muted,
html.dark-theme body .caption {
    color: var(--text-color-secondary) !important;
}

html.dark-theme body strong,
html.dark-theme body b {
    color: var(--text-color) !important;
}

html.dark-theme body hr {
    border-color: var(--border-color) !important;
}


html.dark-theme body a:hover,
html.dark-theme body a:focus {
    color: var(--link-hover-color) !important;
}

/* Header */
html.dark-theme body #emc-global-header {
    background-color: var(--header-bg-color) !important;
    box-shadow: 0 1px 2px var(--shadow-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

html.dark-theme body #emc-global-header::before {
    background: none !important;
    display: none !important;
    /* Hide if it causes issues */
}

html.dark-theme body .emc-global-header-logo img {
    filter: brightness(1.4) contrast(0.85) saturate(0.8) !important;
}

html.dark-theme body .emc-global-header-nav-link,
html.dark-theme body .emc-global-header-nav a {
    color: var(--text-color) !important;
}

html.dark-theme body .emc-global-header-nav-link:hover,
html.dark-theme body .emc-global-header-nav-link.active,
html.dark-theme body .emc-global-header-nav a:hover,
html.dark-theme body .emc-global-header-nav a.active {
    color: var(--secondary-color) !important;
}

html.dark-theme body .emc-global-header-nav-link::after,
html.dark-theme body .emc-global-header-nav a::after {
    background: var(--secondary-color) !important;
}

html.dark-theme body .emc-global-header-lang-toggle,
html.dark-theme body .emc-global-header-search-btn,
html.dark-theme body .emc-global-header-mobile-menu-toggle {
    background-color: transparent !important;
    color: var(--text-color-secondary) !important;
    border: 1px solid transparent !important;
}

html.dark-theme body .emc-global-header-lang-toggle i,
html.dark-theme body .emc-global-header-search-btn i,
html.dark-theme body .emc-global-header-mobile-menu-toggle i {
    color: var(--text-color-secondary) !important;
}

html.dark-theme body .emc-global-header-lang-toggle:hover,
html.dark-theme body .emc-global-header-search-btn:hover,
html.dark-theme body .emc-global-header-mobile-menu-toggle:hover {
    color: var(--text-color) !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark-theme body .emc-global-header-lang-toggle:hover i,
html.dark-theme body .emc-global-header-search-btn:hover i,
html.dark-theme body .emc-global-header-mobile-menu-toggle:hover i {
    color: var(--text-color) !important;
}

html.dark-theme body .emc-global-header-lang-menu {
    background-color: var(--card-bg-color) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 12px var(--shadow-color) !important;
}

html.dark-theme body .emc-global-header-lang-option {
    color: var(--text-color) !important;
}

html.dark-theme body .emc-global-header-lang-option:hover,
html.dark-theme body .emc-global-header-lang-option.active {
    background-color: var(--input-bg) !important;
    color: var(--primary-color) !important;
}

html.dark-theme body .emc-global-header-search-container {
    background-color: var(--header-bg-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

html.dark-theme body .emc-global-header-search-input {
    background-color: var(--input-bg) !important;
    color: var(--input-text) !important;
    border: 1px solid var(--border-color) !important;
}

html.dark-theme body .emc-global-header-search-input::placeholder {
    color: var(--text-color-secondary) !important;
}

html.dark-theme body .emc-global-header-search-button {
    background: var(--primary-color) !important;
}

html.dark-theme body .emc-global-header-search-button i {
    color: #fff !important;
}

html.dark-theme body .emc-global-header-search-result-item {
    background-color: transparent !important;
}

html.dark-theme body .emc-global-header-search-result-item:hover {
    background-color: var(--input-bg) !important;
}

html.dark-theme body .emc-global-header-search-results {
    background-color: var(--card-bg-color) !important;
    border: 1px solid var(--border-color) !important;
}

/* Generic Containers, Wrappers, Sections, Cards */
html.dark-theme body .card,
html.dark-theme body .news-item,
/* Keep specific common ones */
html.dark-theme body [class*="-item"],
html.dark-theme body [class*="-card"],
html.dark-theme body [class*="-box"],
html.dark-theme body [class*="-block"],
html.dark-theme body [class*="-holder"],
html.dark-theme body [class*="-panel"],
html.dark-theme body [class*="-widget"],
html.dark-theme body .comment-body,
html.dark-theme body .post,
/* Common blog post class */
html.dark-theme body .entry

/* Common blog entry class */
    {
    background-color: var(--card-bg-color) !important;
    box-shadow: 0 1px 3px var(--shadow-color) !important;
    border: 1px solid var(--border-color) !important;
}

/* General section/page backgrounds that should NOT be card-like */
html.dark-theme body .main-container,
html.dark-theme body .page-content,
html.dark-theme body [class*="-section"]:not([class*="-card"]):not([class*="-item"]):not([class*="-box"]),
html.dark-theme body [class*="-container"]:not([class*="-card"]):not([class*="-item"]):not([class*="-box"]),
html.dark-theme body [class*="-wrapper"]:not([class*="-card"]):not([class*="-item"]):not([class*="-box"]),
html.dark-theme body [class*="-hero"],
html.dark-theme body .emc-ecosystem,
html.dark-theme body .made-by-emc,
html.dark-theme body .sustainable-dev {
    background-color: var(--background-color) !important;
}

html.dark-theme body .section-header h2,
html.dark-theme body .section-title,
html.dark-theme body .page-title

/* Common page title class */
    {
    color: var(--text-color) !important;
}

html.dark-theme body .section-header h2::after {
    background-color: var(--secondary-color) !important;
}

html.dark-theme body button:hover,
html.dark-theme body .btn:hover,
html.dark-theme body input[type="button"]:hover,
html.dark-theme body input[type="submit"]:hover,
html.dark-theme body input[type="reset"]:hover,
html.dark-theme body a[class*="button"]:hover,
html.dark-theme body a[class*="btn-"]:hover {
    filter: brightness(1.15) !important;
    box-shadow: 0 2px 4px var(--shadow-color) !important;
}

html.dark-theme body .btn-secondary,
html.dark-theme body a.btn-secondary

/* Ensure specificity for <a> tags */
    {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
}

html.dark-theme body .btn-text,
html.dark-theme body a.btn-text {
    background-color: transparent !important;
    color: var(--link-color) !important;
    border: none !important;
    box-shadow: none !important;
}

html.dark-theme body .btn-text:hover,
html.dark-theme body a.btn-text:hover {
    color: var(--link-hover-color) !important;
    background-color: rgba(var(--rgb-link-color, 100, 181, 246), 0.1) !important;
}

/* Forms */
html.dark-theme body input[type="text"],
html.dark-theme body input[type="email"],
html.dark-theme body input[type="password"],
html.dark-theme body input[type="search"],
html.dark-theme body input[type="tel"],
html.dark-theme body input[type="url"],
html.dark-theme body input[type="number"],
html.dark-theme body input[type="date"],
html.dark-theme body input[type="datetime-local"],
html.dark-theme body input[type="month"],
html.dark-theme body input[type="week"],
html.dark-theme body input[type="time"],
html.dark-theme body select,
html.dark-theme body textarea {
    background-color: var(--input-bg) !important;
    color: var(--input-text) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px;
    box-shadow: none !important;
}

html.dark-theme body input::placeholder,
html.dark-theme body textarea::placeholder {
    color: var(--text-color-secondary) !important;
    opacity: 1 !important;
}

html.dark-theme body select option {
    /* Styling for options inside select */
    background-color: var(--input-bg) !important;
    /* Or --card-bg-color for dropdown */
    color: var(--input-text) !important;
}

html.dark-theme body input:focus,
html.dark-theme body select:focus,
html.dark-theme body textarea:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--rgb-primary-color), 0.25) !important;
}

/* Tables */
html.dark-theme body table {
    border-collapse: separate !important;
    /* separate can help with applying borders to cells */
    border-spacing: 0;
    width: 100%;
    border: 1px solid var(--border-color) !important;
    /* Border for the table itself */
    border-radius: 4px;
    background-color: var(--card-bg-color) !important;
    /* Give table a card background */
}

html.dark-theme body th,
html.dark-theme body td {
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 10px 12px !important;
    text-align: left;
    background-color: transparent !important;
    /* Ensure cells are transparent over table bg */
}

html.dark-theme body tr:last-child td {
    border-bottom: none !important;
}

html.dark-theme body th {
    /* background-color: var(--card-bg-color) !important; No, let it inherit from table */
    color: var(--text-color) !important;
    font-weight: 600 !important;
    border-bottom-width: 2px !important;
}

/* Pagination */
html.dark-theme body .pagination .page-link {
    background-color: var(--card-bg-color) !important;
    color: var(--link-color) !important;
    border: 1px solid var(--border-color) !important;
}

html.dark-theme body .pagination .page-link:hover {
    background-color: var(--input-bg) !important;
}

html.dark-theme body .pagination .page-item.active .page-link {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}

html.dark-theme body .pagination .page-item.disabled .page-link {
    color: var(--text-color-secondary) !important;
    background-color: var(--card-bg-color) !important;
    opacity: 0.6 !important;
}

/* Footer */
html.dark-theme body footer {
    background-color: var(--footer-bg-color) !important;
    border-top: 1px solid var(--border-color) !important;
}

html.dark-theme body footer * {
    color: var(--text-color-secondary) !important;
    background-color: transparent !important;
}

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

html.dark-theme body footer a {
    color: var(--link-color) !important;
}

html.dark-theme body footer a:hover {
    color: var(--link-hover-color) !important;
}

html.dark-theme body .footer-newsletter input {
    background-color: var(--input-bg) !important;
    color: var(--input-text) !important;
    border-color: var(--input-border-color) !important;
}

html.dark-theme body .footer-newsletter button {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

/* Slider specific adjustments */
html.dark-theme body .hero-slider .slider-content,
html.dark-theme body .slide-content

/* Common slider content class */
    {
    color: #fff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important;
}

html.dark-theme body .hero-slider .dot {
    background: rgba(255, 255, 255, 0.4) !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
}

html.dark-theme body .hero-slider .dot.active {
    background: #fff !important;
}

html.dark-theme body .hero-slider .arrow {
    background: rgba(0, 0, 0, 0.5) !important;
    color: #fff !important;
}

html.dark-theme body .hero-slider .arrow:hover {
    background: rgba(0, 0, 0, 0.7) !important;
}

/* Theme Toggle Button */
.theme-toggle {
    z-index: 1000001 !important;
    position: relative;
}

html.dark-theme body .theme-toggle i {
    color: var(--text-color-secondary) !important;
}

html.dark-theme body .theme-toggle:hover i {
    color: var(--text-color) !important;
}

/* Pseudo-elements - Be Cautious */
html.dark-theme body *::before,
html.dark-theme body *::after {
    border-color: var(--border-color) !important;
    /* Avoid setting universal color/background for pseudo-elements 
       as it can break icon fonts or specific decorative pseudos. 
       Target them specifically if needed. */
}

/* === Ecosystem Page Specific Overrides === */
/* ... existing ecosystem page specific overrides ... */
html.dark-theme body *::before,
html.dark-theme body *::after {
    border-color: var(--border-color) !important;
    /* Avoid setting universal color/background for pseudo-elements 
       as it can break icon fonts or specific decorative pseudos. 
       Target them specifically if needed. */
}

/* === Ecosystem Page Specific Overrides === */
/* ... existing ecosystem page specific overrides ... */
html.dark-theme body *::before,
html.dark-theme body *::after {
    border-color: var(--border-color) !important;
    /* Avoid setting universal color/background for pseudo-elements 
       as it can break icon fonts or specific decorative pseudos. 
       Target them specifically if needed. */
}

/* === Ecosystem Page Specific Overrides === */
/* ... existing ecosystem page specific overrides ... */
html.dark-theme body *::before,
html.dark-theme body *::after {
    border-color: var(--border-color) !important;
    /* Avoid setting universal color/background for pseudo-elements 
       as it can break icon fonts or specific decorative pseudos. 
       Target them specifically if needed. */
}

/* === AGGRESSIVE GENERAL OVERRIDES === */
/* Ensure body itself has the core background and text colors */
html.dark-theme body {
    /* This rule was already present, merging eco-variables here */
    color: var(--text-color) !important;
    background-color: var(--background-color) !important;
    /* Override common page-specific CSS variables that might be defined in multiple page <style> blocks */
    --eco-primary-color: #28a745;
    --eco-primary-light: #5cb85c;
    --eco-primary-lighter: #90d990;
    --eco-bg-light: #222324;
    --eco-bg-lighter: #2a2b2c;
}

/* Universal reset for backgrounds, borders, shadows for all elements in dark theme. Text color handled by more specific rules below. */
html.dark-theme body * {
    /* Applied to * only, ::before and ::after are handled by the rule above for border-color */
    background-color: transparent !important;
    /* border-color already handled by the ::before, ::after rule and specific component rules */
    box-shadow: none !important;
}


/* === Broad Text Color Overrides === */
/* General text elements. Exclude icons and specific components. */
html.dark-theme body p,
html.dark-theme body li,
html.dark-theme body dt,
html.dark-theme body dd,
html.dark-theme body label,
html.dark-theme body legend,
html.dark-theme body h1,
html.dark-theme body h2,
html.dark-theme body h3,
html.dark-theme body h4,
html.dark-theme body h5,
html.dark-theme body h6,
html.dark-theme body figcaption,
html.dark-theme body blockquote,
html.dark-theme body .text-content,
html.dark-theme body .description,
html.dark-theme body .caption,
html.dark-theme body .title,
html.dark-theme body .subtitle,
html.dark-theme body address,
html.dark-theme body article,
html.dark-theme body aside,
html.dark-theme body details,
html.dark-theme body summary,
html.dark-theme body footer:not(#emc-main-footer) span,
/* spans in general footers */
html.dark-theme body header:not(#emc-global-header) span

/* spans in general headers */
    {
    color: var(--text-color) !important;
}

/* Spans and Divs that are likely to contain text, with exclusions for structural/icon elements */
html.dark-theme body span:not([class*="icon"]):not([class*="fa-"]):not([class*="fas"]):not([class*="far"]):not([class*="fal"]):not([class*="fab"]):not(.dot):not(.badge):not(.label):not(.tag):not([class*="slick"]):not([class*="carousel"]):not([aria-hidden="true"]),
html.dark-theme body div:not([class*="icon"]):not([class*="logo"]):not([class*="fa-"]):not([class*="fas"]):not([class*="far"]):not([class*="fal"]):not([class*="fab"]):not([class*="slick"]):not([class*="slider"]):not([role]):not([class*="modal"]):not([class*="tooltip"]):not([class*="progress"]):not([class*="chart"]):not([class*="video"]):not([class*="map"]):not([class*="carousel"]):not([class*="tab-pane"]):not([class*="card-img"]):not([class*="img-"]):not([style*="background-image"]):not([style*="background:"])

/* Avoid divs that are for background images or have structure roles */
    {
    color: var(--text-color) !important;
}

html.dark-theme body th,
html.dark-theme body td {
    /* Table cells text color */
    color: var(--text-color) !important;
}

html.dark-theme body small,
html.dark-theme body .text-muted {
    /* Standard Bootstrap muted text */
    color: var(--text-color-secondary) !important;
}

html.dark-theme body strong,
html.dark-theme body b {
    color: var(--text-color) !important;
}

html.dark-theme body hr {
    border-color: var(--border-color) !important;
}


html.dark-theme body a:hover,
html.dark-theme body a:focus {
    color: var(--link-hover-color) !important;
}

/* Header */
html.dark-theme body #emc-global-header {
    background-color: var(--header-bg-color) !important;
    box-shadow: 0 1px 2px var(--shadow-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

html.dark-theme body #emc-global-header::before {
    background: none !important;
    display: none !important;
    /* Hide if it causes issues */
}

html.dark-theme body .emc-global-header-logo img {
    filter: brightness(1.4) contrast(0.85) saturate(0.8) !important;
}

html.dark-theme body .emc-global-header-nav-link,
html.dark-theme body .emc-global-header-nav a {
    color: var(--text-color) !important;
}

html.dark-theme body .emc-global-header-nav-link:hover,
html.dark-theme body .emc-global-header-nav-link.active,
html.dark-theme body .emc-global-header-nav a:hover,
html.dark-theme body .emc-global-header-nav a.active {
    color: var(--secondary-color) !important;
}

html.dark-theme body .emc-global-header-nav-link::after,
html.dark-theme body .emc-global-header-nav a::after {
    background: var(--secondary-color) !important;
}

html.dark-theme body .emc-global-header-lang-toggle,
html.dark-theme body .emc-global-header-search-btn,
html.dark-theme body .emc-global-header-mobile-menu-toggle {
    background-color: transparent !important;
    color: var(--text-color-secondary) !important;
    border: 1px solid transparent !important;
}

html.dark-theme body .emc-global-header-lang-toggle i,
html.dark-theme body .emc-global-header-search-btn i,
html.dark-theme body .emc-global-header-mobile-menu-toggle i {
    color: var(--text-color-secondary) !important;
}

html.dark-theme body .emc-global-header-lang-toggle:hover,
html.dark-theme body .emc-global-header-search-btn:hover,
html.dark-theme body .emc-global-header-mobile-menu-toggle:hover {
    color: var(--text-color) !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark-theme body .emc-global-header-lang-toggle:hover i,
html.dark-theme body .emc-global-header-search-btn:hover i,
html.dark-theme body .emc-global-header-mobile-menu-toggle:hover i {
    color: var(--text-color) !important;
}

html.dark-theme body .emc-global-header-lang-menu {
    background-color: var(--card-bg-color) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 12px var(--shadow-color) !important;
}

html.dark-theme body .emc-global-header-lang-option {
    color: var(--text-color) !important;
}

html.dark-theme body .emc-global-header-lang-option:hover,
html.dark-theme body .emc-global-header-lang-option.active {
    background-color: var(--input-bg) !important;
    color: var(--primary-color) !important;
}

html.dark-theme body .emc-global-header-search-container {
    background-color: var(--header-bg-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

html.dark-theme body .emc-global-header-search-input {
    background-color: var(--input-bg) !important;
    color: var(--input-text) !important;
    border: 1px solid var(--border-color) !important;
}

html.dark-theme body .emc-global-header-search-input::placeholder {
    color: var(--text-color-secondary) !important;
}

html.dark-theme body .emc-global-header-search-button {
    background: var(--primary-color) !important;
}

html.dark-theme body .emc-global-header-search-button i {
    color: #fff !important;
}

html.dark-theme body .emc-global-header-search-result-item {
    background-color: transparent !important;
}

html.dark-theme body .emc-global-header-search-result-item:hover {
    background-color: var(--input-bg) !important;
}

html.dark-theme body .emc-global-header-search-results {
    background-color: var(--card-bg-color) !important;
    border: 1px solid var(--border-color) !important;
}

/* Generic Containers, Wrappers, Sections, Cards */
html.dark-theme body .card,
html.dark-theme body .news-item,
/* Keep specific common ones */
html.dark-theme body [class*="-item"],
html.dark-theme body [class*="-card"],
html.dark-theme body [class*="-box"],
html.dark-theme body [class*="-block"],
html.dark-theme body [class*="-holder"],
html.dark-theme body [class*="-panel"],
html.dark-theme body [class*="-widget"],
html.dark-theme body .comment-body,
html.dark-theme body .post,
/* Common blog post class */
html.dark-theme body .entry

/* Common blog entry class */
    {
    background-color: var(--card-bg-color) !important;
    box-shadow: 0 1px 3px var(--shadow-color) !important;
    border: 1px solid var(--border-color) !important;
}

/* General section/page backgrounds that should NOT be card-like */
html.dark-theme body .main-container,
html.dark-theme body .page-content,
html.dark-theme body [class*="-section"]:not([class*="-card"]):not([class*="-item"]):not([class*="-box"]),
html.dark-theme body [class*="-container"]:not([class*="-card"]):not([class*="-item"]):not([class*="-box"]),
html.dark-theme body [class*="-wrapper"]:not([class*="-card"]):not([class*="-item"]):not([class*="-box"]),
html.dark-theme body [class*="-hero"],
html.dark-theme body .emc-ecosystem,
html.dark-theme body .made-by-emc,
html.dark-theme body .sustainable-dev {
    background-color: var(--background-color) !important;
}

html.dark-theme body .section-header h2,
html.dark-theme body .section-title,
html.dark-theme body .page-title

/* Common page title class */
    {
    color: var(--text-color) !important;
}

html.dark-theme body .section-header h2::after {
    background-color: var(--secondary-color) !important;
}


html.dark-theme body button:hover,
html.dark-theme body .btn:hover,
html.dark-theme body input[type="button"]:hover,
html.dark-theme body input[type="submit"]:hover,
html.dark-theme body input[type="reset"]:hover,
html.dark-theme body a[class*="button"]:hover,
html.dark-theme body a[class*="btn-"]:hover {
    filter: brightness(1.15) !important;
    box-shadow: 0 2px 4px var(--shadow-color) !important;
}

html.dark-theme body .btn-secondary,
html.dark-theme body a.btn-secondary

/* Ensure specificity for <a> tags */
    {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
}

html.dark-theme body .btn-text,
html.dark-theme body a.btn-text {
    background-color: transparent !important;
    color: var(--link-color) !important;
    border: none !important;
    box-shadow: none !important;
}

html.dark-theme body .btn-text:hover,
html.dark-theme body a.btn-text:hover {
    color: var(--link-hover-color) !important;
    background-color: rgba(var(--rgb-link-color, 100, 181, 246), 0.1) !important;
}

/* Forms */
html.dark-theme body input[type="text"],
html.dark-theme body input[type="email"],
html.dark-theme body input[type="password"],
html.dark-theme body input[type="search"],
html.dark-theme body input[type="tel"],
html.dark-theme body input[type="url"],
html.dark-theme body input[type="number"],
html.dark-theme body input[type="date"],
html.dark-theme body input[type="datetime-local"],
html.dark-theme body input[type="month"],
html.dark-theme body input[type="week"],
html.dark-theme body input[type="time"],
html.dark-theme body select,
html.dark-theme body textarea {
    background-color: var(--input-bg) !important;
    color: var(--input-text) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px;
    box-shadow: none !important;
}

html.dark-theme body input::placeholder,
html.dark-theme body textarea::placeholder {
    color: var(--text-color-secondary) !important;
    opacity: 1 !important;
}

html.dark-theme body select option {
    /* Styling for options inside select */
    background-color: var(--input-bg) !important;
    /* Or --card-bg-color for dropdown */
    color: var(--input-text) !important;
}

html.dark-theme body input:focus,
html.dark-theme body select:focus,
html.dark-theme body textarea:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--rgb-primary-color), 0.25) !important;
}

/* Tables */
html.dark-theme body table {
    border-collapse: separate !important;
    /* separate can help with applying borders to cells */
    border-spacing: 0;
    width: 100%;
    border: 1px solid var(--border-color) !important;
    /* Border for the table itself */
    border-radius: 4px;
    background-color: var(--card-bg-color) !important;
    /* Give table a card background */
}

html.dark-theme body th,
html.dark-theme body td {
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
    padding: 10px 12px !important;
    text-align: left;
    background-color: transparent !important;
    /* Ensure cells are transparent over table bg */
}

html.dark-theme body tr:last-child td {
    border-bottom: none !important;
}

html.dark-theme body th {
    /* background-color: var(--card-bg-color) !important; No, let it inherit from table */
    color: var(--text-color) !important;
    font-weight: 600 !important;
    border-bottom-width: 2px !important;
}

/* Pagination */
html.dark-theme body .pagination .page-link {
    background-color: var(--card-bg-color) !important;
    color: var(--link-color) !important;
    border: 1px solid var(--border-color) !important;
}

html.dark-theme body .pagination .page-link:hover {
    background-color: var(--input-bg) !important;
}

html.dark-theme body .pagination .page-item.active .page-link {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
}

html.dark-theme body .pagination .page-item.disabled .page-link {
    color: var(--text-color-secondary) !important;
    background-color: var(--card-bg-color) !important;
    opacity: 0.6 !important;
}

/* Footer */
html.dark-theme body footer {
    background-color: var(--footer-bg-color) !important;
    border-top: 1px solid var(--border-color) !important;
}

html.dark-theme body footer * {
    color: var(--text-color-secondary) !important;
    background-color: transparent !important;
}

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

html.dark-theme body footer a {
    color: var(--link-color) !important;
}

html.dark-theme body footer a:hover {
    color: var(--link-hover-color) !important;
}

html.dark-theme body .footer-newsletter input {
    background-color: var(--input-bg) !important;
    color: var(--input-text) !important;
    border-color: var(--input-border-color) !important;
}

html.dark-theme body .footer-newsletter button {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}

/* Slider specific adjustments */
html.dark-theme body .hero-slider .slider-content,
html.dark-theme body .slide-content

/* Common slider content class */
    {
    color: #fff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important;
}

html.dark-theme body .hero-slider .dot {
    background: rgba(255, 255, 255, 0.4) !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
}

html.dark-theme body .hero-slider .dot.active {
    background: #fff !important;
}

html.dark-theme body .hero-slider .arrow {
    background: rgba(0, 0, 0, 0.5) !important;
    color: #fff !important;
}

html.dark-theme body .hero-slider .arrow:hover {
    background: rgba(0, 0, 0, 0.7) !important;
}

/* Theme Toggle Button */
.theme-toggle {
    z-index: 1000001 !important;
    position: relative;
}

html.dark-theme body .theme-toggle i {
    color: var(--text-color-secondary) !important;
}

html.dark-theme body .theme-toggle:hover i {
    color: var(--text-color) !important;
}

/* Pseudo-elements - Be Cautious */
html.dark-theme body *::before,
html.dark-theme body *::after {
    border-color: var(--border-color) !important;
    /* Avoid setting universal color/background for pseudo-elements 
       as it can break icon fonts or specific decorative pseudos. 
       Target them specifically if needed. */
}

/* === Ecosystem Page Specific Overrides === */
/* ... existing ecosystem page specific overrides ... */
html.dark-theme body *::before,
html.dark-theme body *::after {
    border-color: var(--border-color) !important;
    /* Avoid setting universal color/background for pseudo-elements 
       as it can break icon fonts or specific decorative pseudos. 
       Target them specifically if needed. */
}

/* === Ecosystem Page Specific Overrides === */
/* ... existing ecosystem page specific overrides ... */
html.dark-theme body *::before,
html.dark-theme body *::after {
    border-color: var(--border-color) !important;
    /* Avoid setting universal color/background for pseudo-elements 
       as it can break icon fonts or specific decorative pseudos. 
       Target them specifically if needed. */
}

/* === Ecosystem Page Specific Overrides === */
/* ... existing ecosystem page specific overrides ... */
html.dark-theme body *::before,
html.dark-theme body *::after {
    border-color: var(--border-color) !important;
    /* Avoid setting universal color/background for pseudo-elements 
       as it can break icon fonts or specific decorative pseudos. 
       Target them specifically if needed. */
}

/* === NEW AGGRESSIVE GENERAL OVERRIDES (INSERTED) === */
html.dark-theme body {
    color: var(--text-color) !important;
    background-color: var(--background-color) !important;
    /* Consolidate page-specific CSS variable overrides here for broad availability */
    --eco-primary-color: #28a745;
    --eco-primary-light: #5cb85c;
    --eco-primary-lighter: #90d990;
    --eco-bg-light: #222324;
    /* Dark background for sections often using this var */
    --eco-bg-lighter: #2a2b2c;
    /* Slightly lighter dark background */
}

/* Universal reset for backgrounds, borders, shadows. Text color handled more specifically. */
/* Note: border-color for ::before/::after is handled by the rule above. */
/* This targets actual elements now. */
html.dark-theme body * {
    background-color: transparent !important;
    /* border-color already handled by the ::before, ::after rule and specific component rules */
    box-shadow: none !important;
}

/* === NEW Broad Text Color Overrides (INSERTED) === */
html.dark-theme body p,
html.dark-theme body li,
html.dark-theme body dt,
html.dark-theme body dd,
html.dark-theme body label,
html.dark-theme body legend,
html.dark-theme body h1,
html.dark-theme body h2,
html.dark-theme body h3,
html.dark-theme body h4,
html.dark-theme body h5,
html.dark-theme body h6,
html.dark-theme body figcaption,
html.dark-theme body blockquote,
html.dark-theme body .text-content,
html.dark-theme body .description,
html.dark-theme body .caption,
html.dark-theme body .title,
html.dark-theme body .subtitle,
html.dark-theme body address,
html.dark-theme body article,
html.dark-theme body aside,
html.dark-theme body details,
html.dark-theme body summary,
html.dark-theme body footer:not(#emc-main-footer) span,
html.dark-theme body header:not(#emc-global-header) span,
/* More general divs and spans that are likely text containers */
html.dark-theme body span:not([class*="icon"]):not([class*="fa-"]):not([class*="fas"]):not([class*="far"]):not([class*="fal"]):not([class*="fab"]):not(.dot):not(.badge):not(.label):not(.tag):not([class*="slick"]):not([class*="carousel"]):not([aria-hidden="true"]):not([class*="progress"]):not([class*="chart"]),
html.dark-theme body div:not([class*="icon"]):not([class*="logo"]):not([class*="fa-"]):not([class*="fas"]):not([class*="far"]):not([class*="fal"]):not([class*="fab"]):not([class*="slick"]):not([class*="slider"]):not([role]):not([class*="modal"]):not([class*="tooltip"]):not([class*="progress"]):not([class*="chart"]):not([class*="video"]):not([class*="map"]):not([class*="carousel"]):not([class*="tab-pane"]):not([class*="card-img"]):not([class*="img-"]):not([style*="background-image"]):not([style*="background:"]):not([class*="container"]):not([class*="row"]):not([class*="col-"]) {
    color: var(--text-color) !important;
}

html.dark-theme body th,
html.dark-theme body td {
    color: var(--text-color) !important;
}

html.dark-theme body small,
html.dark-theme body .text-muted {
    color: var(--text-color-secondary) !important;
}

html.dark-theme body strong,
html.dark-theme body b {
    color: var(--text-color) !important;
}

html.dark-theme body hr {
    border-top-color: var(--border-color) !important;
    border-width: 1px !important;
    opacity: 0.25 !important;
}

/* === NEW GENERIC PAGE CONTENT OVERRIDES (INSERTED) === */
html.dark-theme body section[style*="background: #f8fafc"],
html.dark-theme body div[style*="background: #f8fafc"],
html.dark-theme body section[style*="background: #ffffff"],
html.dark-theme body div[style*="background: #ffffff"],
html.dark-theme body section[style*="background-color: #fff"],
html.dark-theme body div[style*="background-color: #fff"],
html.dark-theme body section[style*="background: #f5fcf6"],
html.dark-theme body div[style*="background: #f5fcf6"],
html.dark-theme body section[style*="background-color: #f8fff8"],
html.dark-theme body div[style*="background-color: #f8fff8"],
html.dark-theme body section[style*="background: linear-gradient(135deg, #e0ffe8 0%, #f5fcf6 100%)"],
html.dark-theme body div[style*="background: linear-gradient(135deg, #e0ffe8 0%, #f5fcf6 100%)"] {
    background-color: var(--background-color) !important;
    background-image: none !important;
}

html.dark-theme body div[style*="background: #f8fff8"],
html.dark-theme body div[style*="background: #f0f9f1"],
html.dark-theme body div.card[style*="background: #f8fff8"] {
    background-color: var(--card-bg-color) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 2px 5px var(--shadow-color) !important;
    background-image: none !important;
}

html.dark-theme body *[style*="color: #222"],
html.dark-theme body *[style*="color: #333"],
html.dark-theme body *[style*="color: #000"],
html.dark-theme body *[style*="color: #1a1a1a"],
html.dark-theme body *[style*="color: black"],
html.dark-theme body *[style*="color:initial"] {
    color: var(--text-color) !important;
}

html.dark-theme body *[style*="color: #555"],
html.dark-theme body *[style*="color: #666"],
html.dark-theme body *[style*="color: #777"],
html.dark-theme body *[style*="color: #7b8ca0"],
html.dark-theme body *[style*="color: #6c757d"] {
    color: var(--text-color-secondary) !important;
}

html.dark-theme body *[style*="color: #086924"],
html.dark-theme body *[style*="color: #28a745"],
html.dark-theme body *[style*="color: #198754"],
html.dark-theme body *[style*="color: #43b26c"] {
    color: var(--eco-primary-light) !important;
}

html.dark-theme body *[style*="background: linear-gradient"] {
    background-image: none !important;
    background-color: var(--card-bg-color) !important;
}

html.dark-theme body *[style*="background: radial-gradient"] {
    background-image: none !important;
    background-color: var(--card-bg-color) !important;
}

html.dark-theme body span[style*="-webkit-text-fill-color: transparent"][style*="background: linear-gradient"] {
    background: linear-gradient(90deg, var(--eco-primary-light) 0%, var(--eco-primary-lighter) 100%) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

/* === Ecosystem Page Specific Overrides === */
/* ... existing ecosystem page specific overrides ... */
html.dark-theme body *::before,
html.dark-theme body *::after {
    border-color: var(--border-color) !important;
    /* Avoid setting universal color/background for pseudo-elements 
       as it can break icon fonts or specific decorative pseudos. 
       Target them specifically if needed. */
}

/* === Ecosystem Page Specific Overrides === */
/* ... existing ecosystem page specific overrides ... */
html.dark-theme body *::before,
html.dark-theme body *::after {
    border-color: var(--border-color) !important;
    /* Avoid setting universal color/background for pseudo-elements 
       as it can break icon fonts or specific decorative pseudos. 
       Target them specifically if needed. */
}

/* === Ecosystem Page Specific Overrides === */
/* ... existing ecosystem page specific overrides ... */
html.dark-theme body *::before,
html.dark-theme body *::after {
    border-color: var(--border-color) !important;
    /* Avoid setting universal color/background for pseudo-elements 
       as it can break icon fonts or specific decorative pseudos. 
       Target them specifically if needed. */
}

html.dark-theme body #emc-global-header.scrolled {
    background-color: var(--header-bg-scrolled) !important;
    box-shadow: 0 2px 10px var(--shadow-color) !important;
    border-bottom: 1px solid var(--border-color) !important;
}