/* Dark Theme Color Overrides */
html {
    background: #1a1a1a;
}

body {
    background: #1a1a1a;
    color: #e0e0e0;
}

main {
    background: #1a1a1a;
}

header {
    background: #2d2d2d !important;
    backdrop-filter: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

header h1 a {
    color: #e0e0e0;
}

.header-tagline {
    color: #b0b0b0;
}

/* 修复导航链接选择器，使用与default主题一致的类选择器 */
/* 使用最高的优先级确保覆盖default主题的样式 */
/* 基础样式 - 使用最具体的选择器 */
header .container .header-nav a,
header .container nav.header-nav a,
header .header-nav a,
header nav.header-nav a,
header nav a,
.header-nav a {
    color: #ffffff !important; /* 使用纯白色，确保在深色背景上清晰可见 */
    font-weight: 600 !important; /* 增加字体粗细，提高清晰度 */
    font-size: 0.9375rem !important; /* 确保字体大小 */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important; /* 添加文字阴影增强对比度 */
    transition: color 0.3s ease, background 0.3s ease !important;
    opacity: 1 !important; /* 确保完全不透明 */
    text-decoration: none !important;
    -webkit-text-fill-color: #ffffff !important; /* 防止某些浏览器覆盖 */
    -webkit-font-smoothing: antialiased !important; /* 优化字体渲染 */
    -moz-osx-font-smoothing: grayscale !important; /* 优化字体渲染 */
    letter-spacing: 0.01em !important; /* 轻微增加字间距，提高可读性 */
}

header .header-nav a:hover,
header nav.header-nav a:hover,
.header-nav a:hover,
header nav a:hover,
header .container .header-nav a:hover,
header .container nav a:hover {
    color: #ffffff !important; /* 悬停时保持纯白色 */
    background: rgba(74,158,255,0.2) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important; /* 悬停时增强阴影 */
    font-weight: 600 !important; /* 悬停时保持粗体 */
}

header .header-nav a:focus,
header nav.header-nav a:focus,
.header-nav a:focus,
header nav a:focus,
header .container .header-nav a:focus,
header .container nav a:focus,
header .header-nav a:focus-visible,
header nav.header-nav a:focus-visible,
.header-nav a:focus-visible,
header nav a:focus-visible,
header .container .header-nav a:focus-visible,
header .container nav a:focus-visible {
    color: #ffffff !important;
    outline: 2px solid #4a9eff !important;
    outline-offset: 2px;
    border-radius: 2px;
}

header .header-nav a::after,
header nav.header-nav a::after,
.header-nav a::after,
header nav a::after,
header .container .header-nav a::after,
header .container nav a::after {
    background: #4a9eff !important;
}

header .header-nav a:hover::after,
header nav.header-nav a:hover::after,
.header-nav a:hover::after,
header nav a:hover::after,
header .container .header-nav a:hover::after,
header .container nav a:hover::after {
    background: #4a9eff !important;
}

/* 当前页面/激活状态 - 确保选中状态清晰可见 */
header .header-nav a[aria-current="page"],
header nav.header-nav a[aria-current="page"],
.header-nav a[aria-current="page"],
header nav a[aria-current="page"],
header .container .header-nav a[aria-current="page"],
header .container nav a[aria-current="page"],
header .header-nav a.active,
header nav.header-nav a.active,
.header-nav a.active,
header nav a.active,
header .container .header-nav a.active,
header .container nav a.active {
    color: #ffffff !important;
    background: none !important;
    font-weight: 700 !important; /* 激活状态使用更粗的字体 */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important; /* 激活状态增强阴影 */
}

/* 激活状态下的下划线宽度 - 继承默认主题的规则 */
header .header-nav a[aria-current="page"]::after,
header nav.header-nav a[aria-current="page"]::after,
.header-nav a[aria-current="page"]::after,
header nav a[aria-current="page"]::after,
header .container .header-nav a[aria-current="page"]::after,
header .container nav a[aria-current="page"]::after,
header .header-nav a.active::after,
header nav.header-nav a.active::after,
.header-nav a.active::after,
header nav a.active::after,
header .container .header-nav a.active::after,
header .container nav a.active::after {
    width: 100% !important;
}

.mobile-menu-toggle {
    color: #e0e0e0;
}

.hero-section {
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
}

.hero-search-input {
    background: rgba(45,45,45,0.95);
    color: #e0e0e0;
    border-color: rgba(255,255,255,0.2);
}

.hero-search-input:focus {
    background: #2d2d2d;
    border-color: #4a9eff;
}

.hero-search-button {
    background: #4a9eff;
}

.hero-search-button:hover {
    background: #7bb3ff;
}

.featured-tools-section,
.latest-articles-section,
.categories-section,
.why-choose-section,
.all-tools-section {
    background: #1a1a1a; /* Dark background for content sections */
}

.section-title {
    color: #e0e0e0;
}

.featured-tool-card,
.article-card,
.category-card,
.enhanced-tool-card,
a.featured-tool-card,
a.enhanced-tool-card,
article.enhanced-tool-card,
article.tool-card.enhanced-tool-card,
article.tool-card {
    background: #2d2d2d !important;
    border-color: #3d3d3d !important;
}

.featured-tool-card:hover,
.article-card:hover,
.category-card:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.tool-card-header h3,
.article-card h3 a,
.category-card h3,
.featured-tool-card .tool-card-header h3,
a.featured-tool-card .tool-card-header h3,
article.tool-card h3,
article.tool-card a h3,
.tools-grid article.tool-card h3,
.tools-grid article.tool-card a h3 {
    color: #e0e0e0 !important;
}

.tool-card-description,
.article-card .article-excerpt,
.category-description,
.tool-card-desc,
.featured-tool-card .tool-card-description,
a.featured-tool-card .tool-card-description,
article.tool-card p,
article.tool-card a p,
.tools-grid article.tool-card p,
.tools-grid article.tool-card a p {
    color: #b0b0b0 !important;
}

/* 搜索结果中的工具卡片文字颜色 */
.tools-grid article.tool-card,
.tools-grid article.tool-card a {
    color: #e0e0e0 !important;
}

.tools-grid article.tool-card .tool-views,
.tools-grid article.tool-card a .tool-views {
    color: #9ca3af !important;
}

.section-link {
    color: #4a9eff;
}

.section-link:hover {
    color: #7bb3ff;
}

.category-link {
    color: #4a9eff;
}

.category-link:hover {
    color: #7bb3ff;
}

.category-title {
    color: #e0e0e0;
    border-bottom-color: #4a9eff;
}

.enhanced-tool-card,
a.enhanced-tool-card,
article.enhanced-tool-card,
article.tool-card.enhanced-tool-card {
    border-color: #3d3d3d !important;
    background: #2d2d2d !important;
    border-left: none !important;
    border-bottom: none !important;
}

.enhanced-tool-card:hover {
    border-color: #3d3d3d;
}

.featured-tool-card,
a.featured-tool-card {
    border-left: none !important;
    border-bottom: none !important;
    background: #2d2d2d !important;
    border-color: #3d3d3d !important;
}

/* 工具图标样式 - 图标颜色为白色，背景由getToolIconBackground函数控制 */
.tool-card-icon,
.featured-tool-icon {
    color: white !important;
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tool-card-icon svg,
.featured-tool-icon svg {
    width: 40px;
    height: 40px;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.tool-card-top h3,
.enhanced-tool-card .tool-card-top h3,
.featured-tool-card .tool-card-top h3,
a.enhanced-tool-card .tool-card-top h3,
a.featured-tool-card .tool-card-top h3,
article.enhanced-tool-card .tool-card-top h3 {
    color: #e0e0e0 !important;
}

.tool-card-desc,
.enhanced-tool-card .tool-card-desc,
.featured-tool-card .tool-card-desc,
a.enhanced-tool-card .tool-card-desc,
a.featured-tool-card .tool-card-desc,
article.enhanced-tool-card .tool-card-desc {
    color: #b0b0b0 !important;
}

/* 修复工具卡片内容区域的背景和文字颜色 - 覆盖默认主题的白色背景 */
.tool-card-content,
.enhanced-tool-card .tool-card-content,
.featured-tool-card .tool-card-content,
.featured-tool-content,
a.enhanced-tool-card .tool-card-content,
a.featured-tool-card .tool-card-content,
a.featured-tool-card .featured-tool-content,
article.enhanced-tool-card .tool-card-content,
article.tool-card.enhanced-tool-card .tool-card-content,
article.tool-card {
    background: #2d2d2d !important;
    background-color: #2d2d2d !important;
}

/* 确保工具卡片内所有文字都是浅色 - 覆盖默认主题的深色文字 */
.enhanced-tool-card h3,
.featured-tool-card h3,
a.enhanced-tool-card h3,
a.featured-tool-card h3,
article.enhanced-tool-card h3,
article.tool-card.enhanced-tool-card h3,
.enhanced-tool-card .tool-card-top h3,
.featured-tool-card .tool-card-top h3,
a.enhanced-tool-card .tool-card-top h3,
a.featured-tool-card .tool-card-top h3,
article.enhanced-tool-card .tool-card-top h3,
article.tool-card.enhanced-tool-card .tool-card-top h3 {
    color: #e0e0e0 !important;
}

.enhanced-tool-card p,
.featured-tool-card p,
a.enhanced-tool-card p,
a.featured-tool-card p,
article.enhanced-tool-card p,
article.tool-card.enhanced-tool-card p,
.enhanced-tool-card .tool-card-desc,
.featured-tool-card .tool-card-desc,
a.enhanced-tool-card .tool-card-desc,
a.featured-tool-card .tool-card-desc,
article.enhanced-tool-card .tool-card-desc,
article.tool-card.enhanced-tool-card .tool-card-desc,
.enhanced-tool-card .tool-card-top .tool-card-desc,
.featured-tool-card .tool-card-top .tool-card-desc,
a.enhanced-tool-card .tool-card-top .tool-card-desc,
a.featured-tool-card .tool-card-top .tool-card-desc,
article.enhanced-tool-card .tool-card-top .tool-card-desc {
    color: #b0b0b0 !important;
}

.tool-card-action {
    color: #4a9eff;
}

.enhanced-tool-card:hover .tool-card-action {
    color: #7bb3ff;
}

.tools-count-info {
    color: #b0b0b0;
}

.tools-count-info strong {
    color: #e0e0e0;
}

footer {
    background: #1a1a1a !important;
    border-top: 1px solid #3d3d3d !important;
    color: #d1d5db !important;
}

/* Footer文字和链接颜色 */
footer p,
footer span,
footer div {
    color: #d1d5db !important;
}

footer nav a,
footer a {
    color: #9ca3af !important;
}

footer nav a:hover,
footer a:hover {
    color: #ffffff !important;
}

footer .footer-column h3,
footer h3 {
    color: #e0e0e0 !important;
}

footer .footer-column ul li a {
    color: #9ca3af !important;
}

footer .footer-column ul li a:hover {
    color: #ffffff !important;
}

footer .footer-bottom {
    border-top: 1px solid #374151 !important;
}

footer .footer-bottom p {
    color: #9ca3af !important;
}

.contact-card {
    background: #2d2d2d;
    border-color: #3d3d3d;
}

.contact-card h1 {
    color: #e0e0e0;
}

.contact-intro {
    color: #b0b0b0;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form select,
.contact-form textarea {
    background: #1a1a1a;
    border-color: #3d3d3d;
    color: #e0e0e0;
}

.contact-form input[type="text"]:focus,
.contact-form input[type="email"]:focus,
.contact-form select:focus,
.contact-form textarea:focus {
    border-color: #4a9eff;
}

.contact-other h3 {
    color: #e0e0e0;
}

.contact-other p {
    color: #b0b0b0;
}

.contact-other a {
    color: #4a9eff;
}

.search-section,
.search-results {
    background: #2d2d2d;
}

.search-section h1 {
    color: #e0e0e0;
}

.results-count {
    color: #b0b0b0;
}

.results-section h2 {
    color: #e0e0e0;
    border-bottom-color: #4a9eff;
}

.article-item {
    border-bottom-color: #3d3d3d;
}

.article-item:hover {
    background-color: #2d2d2d;
}

.article-item h3 a {
    color: #e0e0e0;
}

.article-item h3 a:hover {
    color: #4a9eff;
}

.read-more {
    color: #4a9eff;
}

.read-more:hover {
    color: #7bb3ff;
}

.page-link {
    background: #2d2d2d;
    border-color: #3d3d3d;
    color: #e0e0e0;
}

.page-link:hover {
    background: #4a9eff;
    border-color: #4a9eff;
    color: white;
}

.page-current {
    background: #4a9eff;
    border-color: #4a9eff;
}

a:focus,
button:focus,
input:focus,
textarea:focus {
    outline-color: #4a9eff;
}

.skip-link {
    background: #4a9eff;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline-color: #4a9eff;
}

/* Category-specific colors (dark theme adjusted) */
.tool-category-encrypt,
.tool-category-dev {
    background: #064e3b;
    color: #6ee7b7;
}
.tool-category-text {
    background: #1e3a8a;
    color: #93c5fd;
}
.tool-category-image {
    background: #78350f;
    color: #fde68a;
}
.tool-category-time {
    background: #7c2d12;
    color: #fed7aa;
}
.tool-category-everyday,
.tool-category-convert {
    background: #831843;
    color: #f9a8d4;
}
.tool-category-encode,
.tool-category-format {
    background: #312e81;
    color: #c7d2fe;
}
.tool-category-network,
.tool-category-design {
    background: #581c87;
    color: #e9d5ff;
}
.tool-category-test,
.tool-category-generate,
.tool-category-other {
    background: #374151;
    color: #d1d5db;
}

/* Articles page styles */
.articles-header {
    background: #2d2d2d;
}
.articles-header h1 {
    color: #e0e0e0;
}
.articles-list {
    background: #2d2d2d;
}
.article-item {
    border-bottom-color: #3d3d3d;
}
.article-item:hover {
    background-color: #1a1a1a;
}
.article-item h3 a {
    color: #e0e0e0;
}
.article-item h3 a:hover {
    color: #4a9eff;
}
.article-meta {
    color: #b0b0b0;
}
.read-more {
    color: #4a9eff;
}
.read-more:hover {
    color: #7bb3ff;
}

/* 404 page styles */
.error-404 h1 {
    color: #4a9eff;
}
.error-404 h2 {
    color: #e0e0e0;
}
.error-404 p {
    color: #b0b0b0;
}
.error-404 .btn {
    background: #4a9eff;
}
.error-404 .btn:hover {
    background: #7bb3ff;
}
.error-404 .btn-secondary {
    background: #5a6268;
}
.error-404 .btn-secondary:hover {
    background: #6c757d;
}
.no-results {
    color: #b0b0b0;
}

/* Article content styles */
.article-container {
    background: #2d2d2d;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.article-container h1 {
    color: #e0e0e0;
}

/* 文章内容页面样式 - 深色主题 */
.article-content {
    background: #2d2d2d !important;
    border: 1px solid #3d3d3d !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
}

.article-content h1 {
    color: #e0e0e0 !important;
}

.article-meta {
    color: #b0b0b0;
}

.article-content .article-meta {
    color: #b0b0b0 !important;
}

.article-body {
    color: #e0e0e0;
}

.article-content .article-body {
    color: #e0e0e0 !important;
}

.article-content .article-body h2,
.article-content .article-body h3,
.article-content .article-body h4,
.article-content .article-body h5,
.article-content .article-body h6 {
    color: #e0e0e0 !important;
}

.article-body h2, 
.article-body h3 {
    color: #e0e0e0;
}

.article-body a,
.article-content .article-body a {
    color: #4a9eff !important;
}

.article-body a:hover,
.article-content .article-body a:hover {
    color: #7bb3ff !important;
}

.article-content .article-body p,
.article-content .article-body li,
.article-content .article-body td,
.article-content .article-body th {
    color: #e0e0e0 !important;
}

.article-content .article-body strong,
.article-content .article-body b {
    color: #ffffff !important;
}

/* 文章内容列表样式 - 深色主题 */
.article-content .article-body ul,
.article-content .article-body ol {
    color: #e0e0e0 !important;
}

.article-content .article-body ul li,
.article-content .article-body ol li {
    color: #e0e0e0 !important;
}

.article-content .article-body ul li::marker,
.article-content .article-body ol li::marker {
    color: #9ca3af !important;
}

.article-content .article-body code {
    background: #1a1a1a !important;
    color: #6ee7b7 !important;
    border: 1px solid #3d3d3d !important;
}

.article-content .article-body pre {
    background: #1a1a1a !important;
    color: #e0e0e0 !important;
    border: 1px solid #3d3d3d !important;
}

.article-content .article-body pre code {
    background: transparent !important;
    color: inherit !important;
    border: none !important;
}

.article-content .article-body blockquote {
    border-left-color: #4a9eff !important;
    color: #b0b0b0 !important;
}

.article-content .article-body table th,
.article-content .article-body table td {
    border-color: #3d3d3d !important;
    color: #e0e0e0 !important;
}

.article-content .article-body table th {
    background: #1a1a1a !important;
    color: #ffffff !important;
}

/* Static Pages (About Us, Terms, Privacy Policy) styles for dark theme */
/* 修复静态页面的显示问题：将白色背景改为深色，文字改为浅色 */
/* 使用属性选择器匹配包含max-width: 800px的div（静态页面容器） */
main#main-content .container > div[style*="max-width: 800px"],
main .container > div[style*="max-width: 800px"] {
    background: #2d2d2d !important;
    color: #e0e0e0 !important;
    border: 1px solid #3d3d3d !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
}

/* 覆盖静态页面内基本元素的文字颜色（不包括链接，链接单独处理） */
main#main-content .container > div[style*="max-width: 800px"] p,
main#main-content .container > div[style*="max-width: 800px"] div,
main#main-content .container > div[style*="max-width: 800px"] span,
main#main-content .container > div[style*="max-width: 800px"] li,
main#main-content .container > div[style*="max-width: 800px"] td,
main#main-content .container > div[style*="max-width: 800px"] th,
main .container > div[style*="max-width: 800px"] p,
main .container > div[style*="max-width: 800px"] div,
main .container > div[style*="max-width: 800px"] span,
main .container > div[style*="max-width: 800px"] li,
main .container > div[style*="max-width: 800px"] td,
main .container > div[style*="max-width: 800px"] th {
    color: #e0e0e0 !important;
}

/* 标题颜色 */
main#main-content .container > div[style*="max-width: 800px"] h1,
main#main-content .container > div[style*="max-width: 800px"] h2,
main#main-content .container > div[style*="max-width: 800px"] h3,
main#main-content .container > div[style*="max-width: 800px"] h4,
main#main-content .container > div[style*="max-width: 800px"] h5,
main#main-content .container > div[style*="max-width: 800px"] h6,
main .container > div[style*="max-width: 800px"] h1,
main .container > div[style*="max-width: 800px"] h2,
main .container > div[style*="max-width: 800px"] h3,
main .container > div[style*="max-width: 800px"] h4,
main .container > div[style*="max-width: 800px"] h5,
main .container > div[style*="max-width: 800px"] h6 {
    color: #e0e0e0 !important;
}

/* 链接颜色 */
main#main-content .container > div[style*="max-width: 800px"] a,
main .container > div[style*="max-width: 800px"] a {
    color: #4a9eff !important;
}

main#main-content .container > div[style*="max-width: 800px"] a:hover,
main .container > div[style*="max-width: 800px"] a:hover {
    color: #7bb3ff !important;
}

/* 粗体文字 */
main#main-content .container > div[style*="max-width: 800px"] strong,
main#main-content .container > div[style*="max-width: 800px"] b,
main .container > div[style*="max-width: 800px"] strong,
main .container > div[style*="max-width: 800px"] b {
    color: #ffffff !important;
    font-weight: 600;
}

/* 静态页面列表样式 - 深色主题 */
main#main-content .container > div[style*="max-width: 800px"] ul,
main#main-content .container > div[style*="max-width: 800px"] ol,
main .container > div[style*="max-width: 800px"] ul,
main .container > div[style*="max-width: 800px"] ol {
    color: #e0e0e0 !important;
}

main#main-content .container > div[style*="max-width: 800px"] ul li,
main#main-content .container > div[style*="max-width: 800px"] ol li,
main .container > div[style*="max-width: 800px"] ul li,
main .container > div[style*="max-width: 800px"] ol li {
    color: #e0e0e0 !important;
}

/* 静态页面表格样式 - 深色主题 */
main#main-content .container > div[style*="max-width: 800px"] table th,
main#main-content .container > div[style*="max-width: 800px"] table td,
main .container > div[style*="max-width: 800px"] table th,
main .container > div[style*="max-width: 800px"] table td {
    border-color: #3d3d3d !important;
    color: #e0e0e0 !important;
}

main#main-content .container > div[style*="max-width: 800px"] table th,
main .container > div[style*="max-width: 800px"] table th {
    background: #1a1a1a !important;
    color: #ffffff !important;
}

/* 静态页面代码块样式 - 深色主题 */
main#main-content .container > div[style*="max-width: 800px"] code,
main .container > div[style*="max-width: 800px"] code {
    background: #1a1a1a !important;
    color: #6ee7b7 !important;
    border: 1px solid #3d3d3d !important;
}

main#main-content .container > div[style*="max-width: 800px"] pre,
main .container > div[style*="max-width: 800px"] pre {
    background: #1a1a1a !important;
    color: #e0e0e0 !important;
    border: 1px solid #3d3d3d !important;
}

main#main-content .container > div[style*="max-width: 800px"] blockquote,
main .container > div[style*="max-width: 800px"] blockquote {
    border-left-color: #4a9eff !important;
    color: #b0b0b0 !important;
}

/* 广告容器样式 */
.ads-container {
    margin: 2rem auto;
    padding: 1rem;
    text-align: center;
    max-width: 1200px;
}

.ads-header {
    background: #2d2d2d;
    border-bottom: 1px solid #3d3d3d;
    padding: 1rem 0;
}

.ads-content-top {
    padding: 2rem 0;
    background: #1a1a1a;
}

.ads-content-bottom {
    padding: 2rem 0;
    background: #1a1a1a;
}

.ads-footer {
    background: #2d2d2d;
    border-top: 1px solid #3d3d3d;
    padding: 1.5rem 0;
}

.ads-container iframe,
.ads-container img {
    max-width: 100%;
    height: auto;
}

.ads-container .ad-code {
    display: inline-block;
}
