/**
 * Dark Mode Support for BlindCalc
 * 为所有页面提供深色模式适配 - 高对比度版本
 */

@media (prefers-color-scheme: dark) {
    /* 全局强制 - 最高优先级 */
    body,
    html {
        background: #0a0a0a !important;
        color: #ffffff !important;
    }

    /* 全局容器 */
    .rdai-blindcalc-container {
        background: #0a0a0a !important;
        color: #ffffff !important;
    }

    /* 所有section区块 - 使用更深的背景色 */
    .rdai-blindcalc-container > div,
    .rdai-blindcalc-container section,
    .job-header,
    .job-info-section,
    .blinds-summary-section,
    .downloads-section,
    .cost-analysis-section,
    .quotation-section,
    .demo-job-header,
    .demo-job-info-section,
    .demo-blinds-summary-section,
    .demo-downloads-section,
    .demo-cost-analysis-section,
    .demo-quotation-section,
    .jobs-table-wrapper,
    .rdai-jobs-header {
        background: #1a1a1a !important;
        color: #ffffff !important;
        border-color: #555 !important;
    }

    /* 表格 */
    table,
    .job-info-table,
    .summary-table,
    .jobs-table,
    .demo-job-info-table,
    .demo-summary-table,
    .demo-cost-table {
        background: #1a1a1a !important;
        color: #ffffff !important;
        border-color: #555 !important;
    }

    /* 表格标题行 */
    th,
    .job-info-table th,
    .summary-table th,
    .jobs-table th,
    .demo-job-info-table th,
    .demo-summary-table th,
    .demo-cost-table th {
        background: #2a2a2a !important;
        color: #ffffff !important;
        border-color: #666 !important;
    }

    /* 表格数据行 */
    td,
    .job-info-table td,
    .summary-table td,
    .jobs-table td,
    .demo-job-info-table td,
    .demo-summary-table td,
    .demo-cost-table td {
        background: #1a1a1a !important;
        color: #f0f0f0 !important;
        border-color: #555 !important;
    }

    /* 标题 - 使用纯白色 */
    h1, h2, h3, h4, h5, h6,
    .section-title,
    .job-header h2,
    .demo-section-title,
    .demo-job-header h2,
    .rdai-jobs-header h2 {
        color: #ffffff !important;
    }

    /* 普通文本 - 使用更亮的颜色 */
    p, span, label, li, div {
        color: #f0f0f0 !important;
    }

    /* 小字和描述性文本 */
    small, .description, .meta {
        color: #d0d0d0 !important;
    }

    /* 链接 */
    a {
        color: #5ca4db !important;
    }

    a:hover {
        color: #7db9e8 !important;
    }

    /* 输入框 */
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select {
        background: #2a2a2a !important;
        color: #e0e0e0 !important;
        border-color: #555 !important;
    }

    input::placeholder,
    textarea::placeholder {
        color: #888 !important;
    }

    /* 按钮 - 确保高对比度 */
    .button,
    .btn,
    .btn-primary,
    .btn-process-job,
    .btn-reprocess,
    .demo-btn-primary,
    button[type="submit"],
    input[type="submit"],
    a.button,
    a.btn {
        background: #0073aa !important;
        color: #ffffff !important;
        border-color: #0073aa !important;
    }

    .button:hover,
    .btn:hover,
    .btn-primary:hover,
    a.button:hover,
    a.btn:hover {
        background: #005a87 !important;
        border-color: #005a87 !important;
        color: #ffffff !important;
    }

    .btn-secondary,
    .demo-btn-secondary {
        background: #3a3a3a !important;
        color: #ffffff !important;
        border-color: #555 !important;
    }

    .btn-secondary:hover {
        background: #4a4a4a !important;
        border-color: #666 !important;
    }

    /* 卡片 - 使用更深背景和更亮文字 */
    .card,
    .feature-card,
    .demo-feature-card,
    .download-link-item,
    .demo-download-link-item {
        background: #1a1a1a !important;
        border-color: #555 !important;
        color: #ffffff !important;
    }

    .card:hover,
    .feature-card:hover,
    .demo-feature-card:hover,
    .download-link-item:hover,
    .demo-download-link-item:hover {
        background: #252525 !important;
        border-color: #0073aa !important;
    }

    /* 卡片内的标题和文字 */
    .card h3, .card h4, .card h5,
    .feature-card h3, .feature-card h4,
    .download-link-item h3, .download-link-item h4,
    .demo-feature-card h3, .demo-feature-card h4,
    .demo-download-link-item h3, .demo-download-link-item h4 {
        color: #ffffff !important;
    }

    .card p, .card span,
    .feature-card p, .feature-card span,
    .download-link-item p, .download-link-item span,
    .demo-feature-card p, .demo-feature-card span,
    .demo-download-link-item p, .demo-download-link-item span {
        color: #e0e0e0 !important;
    }

    /* 通知/提示框 - 高对比度 */
    .notice,
    .rdai-blindcalc-notice,
    .quota-notice {
        background: #2a2a00 !important;
        color: #ffff00 !important;
        border-color: #666600 !important;
    }

    .notice.error {
        background: #2a0000 !important;
        color: #ff9999 !important;
        border-color: #660000 !important;
    }

    .notice.success {
        background: #002a00 !important;
        color: #99ff99 !important;
        border-color: #006600 !important;
    }

    .notice.info {
        background: #00192a !important;
        color: #99ccff !important;
        border-color: #004266 !important;
    }

    /* 表单组 */
    .form-group,
    .field-group {
        background: transparent !important;
    }

    /* 禁用状态 */
    input:disabled,
    select:disabled,
    textarea:disabled,
    button:disabled {
        background: #1a1a1a !important;
        color: #666 !important;
        opacity: 0.6;
    }

    /* 加载overlay */
    #loading-overlay,
    #rdai-loading-overlay {
        background: rgba(0, 0, 0, 0.9) !important;
    }

    /* 特殊功能列表 */
    .demo-quotation-features,
    .features-list {
        background: #2a2a2a !important;
        border-color: #444 !important;
        color: #e0e0e0 !important;
    }

    /* 分隔线 */
    hr {
        border-color: #444 !important;
    }

    /* WordPress默认类 */
    .wp-list-table {
        background: #2a2a2a !important;
        color: #e0e0e0 !important;
    }

    .wp-list-table.striped > tbody > :nth-child(odd),
    .wp-list-table.striped > tbody > tr:nth-child(odd) {
        background: #2a2a2a !important;
    }

    .wp-list-table.striped > tbody > :nth-child(even),
    .wp-list-table.striped > tbody > tr:nth-child(even) {
        background: #333 !important;
    }

    /* 确保图标可见 */
    i, .fa, .fas, .far {
        color: inherit !important;
    }

    /* === 强制深色模式 - 最高优先级 === */

    /* 下载区块 */
    .downloads-section,
    .download-links-grid,
    .download-link-item,
    .demo-downloads-section {
        background-color: #1a1a1a !important;
        color: #ffffff !important;
    }

    .downloads-section *,
    .download-links-grid *,
    .download-link-item *,
    .demo-downloads-section * {
        color: #ffffff !important;
    }

    .download-link-item {
        border: 2px solid #555 !important;
    }

    /* 所有section强制深色 */
    .job-info-section,
    .blinds-summary-section,
    .cost-analysis-section,
    .quotation-section,
    .demo-job-info-section,
    .demo-blinds-summary-section,
    .demo-cost-analysis-section,
    .demo-quotation-section {
        background-color: #1a1a1a !important;
        color: #ffffff !important;
    }

    .job-info-section *,
    .blinds-summary-section *,
    .cost-analysis-section *,
    .quotation-section *,
    .demo-job-info-section *,
    .demo-blinds-summary-section *,
    .demo-cost-analysis-section *,
    .demo-quotation-section * {
        color: #ffffff !important;
    }

    /* 所有按钮强制白字蓝底 */
    button,
    .button,
    .btn,
    a.button,
    a.btn,
    input[type="submit"],
    input[type="button"],
    .btn-primary,
    .btn-small,
    .download-link {
        background: #0073aa !important;
        color: #ffffff !important;
        border-color: #0073aa !important;
        text-decoration: none !important;
    }

    button:hover,
    .button:hover,
    .btn:hover,
    a.button:hover,
    a.btn:hover {
        background: #005a87 !important;
        color: #ffffff !important;
        border-color: #005a87 !important;
    }

    /* 强制所有标题纯白 */
    h1, h2, h3, h4, h5, h6 {
        color: #ffffff !important;
    }

    /* 强制所有链接可见 */
    a:not(.button):not(.btn) {
        color: #66b3ff !important;
    }

    /* 表格强制深色 */
    table {
        background-color: #1a1a1a !important;
        color: #ffffff !important;
        border-color: #555 !important;
    }

    table * {
        color: #ffffff !important;
        border-color: #555 !important;
    }

    th, thead {
        background-color: #2a2a2a !important;
        color: #ffffff !important;
    }

    thead * {
        color: #ffffff !important;
    }

    td {
        background-color: #1a1a1a !important;
        color: #ffffff !important;
    }
}
