/**
 * 深色模式：将黄色主色改为青蓝色 + 卡片等组件适配（sanxio 扩展覆盖）
 * 覆盖 material-design-3.css 中的深色主题 primary 相关变量
 */

/* 卡片 style5 标题栏：深色模式下覆盖浅蓝背景 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --sanxio-card-style5-head-bg: var(--md-sys-color-surface-container-high, #1e1e1e);
    }
}
:root[data-theme="dark"],
:root.theme-dark {
    --sanxio-card-style5-head-bg: var(--md-sys-color-surface-container-high, #1e1e1e);
}

/* 系统偏好深色：主色 = cyan-extra-bright-A，配套淡色 = cyan-extra-soft-A */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --md-sys-color-primary: #18FFFF;
        --md-sys-color-primary-hover: #00E5FF;
        --md-sys-color-primary-pressed: #00B8D4;
        --md-sys-color-on-primary: #001218;               /* 深色文字（在亮青蓝上） */
        --md-sys-color-primary-container: #005B66;        /* 深一点的青蓝容器 */
        --md-sys-color-on-primary-container: #E0FFFF;     /* 浅青蓝文字（在容器上） */
        --md-sys-color-input-background: #E0FFFF;         /* 输入框 / 浅底专用 */

        /* 青蓝色阴影效果（保持不变） */
        --md-sys-elevation-level1: 0px 1px 3px rgba(0, 188, 212, 0.3), 0px 1px 2px rgba(0, 188, 212, 0.4);
        --md-sys-elevation-level2: 0px 3px 6px rgba(0, 188, 212, 0.35), 0px 3px 6px rgba(0, 188, 212, 0.45);
        --md-sys-elevation-level3: 0px 10px 20px rgba(0, 188, 212, 0.4), 0px 6px 6px rgba(0, 188, 212, 0.5);
        --md-sys-elevation-level4: 0px 15px 25px rgba(0, 188, 212, 0.45), 0px 5px 10px rgba(0, 188, 212, 0.4);
        --md-sys-elevation-level5: 0px 20px 40px rgba(0, 188, 212, 0.5);
    }
}

/* 显式深色主题：保持与上方一致，避免 token 不同步 */
:root[data-theme="dark"],
:root.theme-dark {
    --md-sys-color-primary: #18FFFF;
    --md-sys-color-primary-hover: #00E5FF;
    --md-sys-color-primary-pressed: #00B8D4;
    --md-sys-color-on-primary: #001218;
    --md-sys-color-primary-container: #005B66;
    --md-sys-color-on-primary-container: #E0FFFF;
    --md-sys-color-input-background: #E0FFFF;

    /* 青蓝色阴影效果 */
    --md-sys-elevation-level1: 0px 1px 3px rgba(0, 188, 212, 0.3), 0px 1px 2px rgba(0, 188, 212, 0.4);
    --md-sys-elevation-level2: 0px 3px 6px rgba(0, 188, 212, 0.35), 0px 3px 6px rgba(0, 188, 212, 0.45);
    --md-sys-elevation-level3: 0px 10px 20px rgba(0, 188, 212, 0.4), 0px 6px 6px rgba(0, 188, 212, 0.5);
    --md-sys-elevation-level4: 0px 15px 25px rgba(0, 188, 212, 0.45), 0px 5px 10px rgba(0, 188, 212, 0.4);
    --md-sys-elevation-level5: 0px 20px 40px rgba(0, 188, 212, 0.5);
}

/* 覆盖 .mdc-button--text 的黄色悬停背景为青蓝色 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .mdc-button--text:hover,
    :root[data-theme="dark"] .mdc-button--text:hover,
    :root.theme-dark .mdc-button--text:hover {
        background-color: rgba(0, 188, 212, 0.08) !important;
    }
}

:root[data-theme="dark"] .mdc-button--text:hover,
:root.theme-dark .mdc-button--text:hover {
    background-color: rgba(0, 188, 212, 0.08) !important;
}

/* ===== 商品卡片（首页/商城列表）深色模式 ===== */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .sanxio-home-product-card {
        background: #1e1e1e !important;
        border-color: #3c3c3c !important;
    }
    :root:not([data-theme="light"]) .sanxio-home-product-card__img-wrap {
        background: #2a2a2a !important;
    }
    :root:not([data-theme="light"]) .sanxio-home-product-card__title {
        color: #f5f5f5 !important;
    }
    :root:not([data-theme="light"]) .sanxio-home-product-card__sold {
        color: #c0c0c0 !important;
    }
    :root:not([data-theme="light"]) .sx-mall-feed__title,
    :root:not([data-theme="light"]) .sanxio-mall-index-products__title {
        color: #f5f5f5 !important;
    }
    :root:not([data-theme="light"]) .sx-mall-feed__head {
        border-bottom-color: #3c3c3c !important;
    }
}
:root[data-theme="dark"] .sanxio-home-product-card,
:root.theme-dark .sanxio-home-product-card {
    background: #1e1e1e !important;
    border-color: #3c3c3c !important;
}
:root[data-theme="dark"] .sanxio-home-product-card__img-wrap,
:root.theme-dark .sanxio-home-product-card__img-wrap {
    background: #2a2a2a !important;
}
:root[data-theme="dark"] .sanxio-home-product-card__title,
:root.theme-dark .sanxio-home-product-card__title {
    color: #f5f5f5 !important;
}
:root[data-theme="dark"] .sanxio-home-product-card__sold,
:root.theme-dark .sanxio-home-product-card__sold {
    color: #c0c0c0 !important;
}
:root[data-theme="dark"] .sx-mall-feed__title,
:root.theme-dark .sx-mall-feed__title,
:root[data-theme="dark"] .sanxio-mall-index-products__title,
:root.theme-dark .sanxio-mall-index-products__title {
    color: #f5f5f5 !important;
}
:root[data-theme="dark"] .sx-mall-feed__head,
:root.theme-dark .sx-mall-feed__head {
    border-bottom-color: #3c3c3c !important;
}

/* ===== 搜索页左侧地区筛选输入框深色模式 ===== */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) #areaFilterList .mdc-search-filter__area-input-wrap {
        background-color: #2a2a2a !important;
        border-color: #5a5a5a !important;
    }
    :root:not([data-theme="light"]) #areaFilterList .mdc-search-filter__area-input-wrap:hover {
        background-color: #363636 !important;
        border-color: #6a6a6a !important;
    }
    :root:not([data-theme="light"]) #areaFilterList .mdc-search-filter__area-input {
        color: #f5f5f5 !important;
    }
    :root:not([data-theme="light"]) #areaFilterList .mdc-search-filter__area-input::placeholder {
        color: #a0a0a0 !important;
    }
    :root:not([data-theme="light"]) #areaFilterList .mdc-search-filter__area-input-icon {
        background-color: #a0a0a0 !important;
    }
    :root:not([data-theme="light"]) .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input-wrap {
        background-color: #2a2a2a !important;
        border-color: #5a5a5a !important;
    }
    :root:not([data-theme="light"]) .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input-wrap:hover,
    :root:not([data-theme="light"]) .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input-wrap:focus-within {
        background-color: #2a2a2a !important;
        border-color: var(--md-sys-color-primary) !important;
    }
    :root:not([data-theme="light"]) .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input {
        color: #f5f5f5 !important;
    }
    :root:not([data-theme="light"]) .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input::placeholder {
        color: #a0a0a0 !important;
    }
    :root:not([data-theme="light"]) .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input-icon {
        background-color: #a0a0a0 !important;
    }
}
:root[data-theme="dark"] #areaFilterList .mdc-search-filter__area-input-wrap,
:root.theme-dark #areaFilterList .mdc-search-filter__area-input-wrap {
    background-color: #2a2a2a !important;
    border-color: #5a5a5a !important;
}
:root[data-theme="dark"] #areaFilterList .mdc-search-filter__area-input-wrap:hover,
:root.theme-dark #areaFilterList .mdc-search-filter__area-input-wrap:hover {
    background-color: #363636 !important;
    border-color: #6a6a6a !important;
}
:root[data-theme="dark"] #areaFilterList .mdc-search-filter__area-input,
:root.theme-dark #areaFilterList .mdc-search-filter__area-input {
    color: #f5f5f5 !important;
}
:root[data-theme="dark"] #areaFilterList .mdc-search-filter__area-input::placeholder,
:root.theme-dark #areaFilterList .mdc-search-filter__area-input::placeholder {
    color: #a0a0a0 !important;
}
:root[data-theme="dark"] #areaFilterList .mdc-search-filter__area-input-icon,
:root.theme-dark #areaFilterList .mdc-search-filter__area-input-icon {
    background-color: #a0a0a0 !important;
}
:root[data-theme="dark"] .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input-wrap,
:root.theme-dark .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input-wrap {
    background-color: #2a2a2a !important;
    border-color: #5a5a5a !important;
}
:root[data-theme="dark"] .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input-wrap:hover,
:root.theme-dark .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input-wrap:hover,
:root[data-theme="dark"] .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input-wrap:focus-within,
:root.theme-dark .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input-wrap:focus-within {
    background-color: #2a2a2a !important;
    border-color: var(--md-sys-color-primary) !important;
}
:root[data-theme="dark"] .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input,
:root.theme-dark .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input {
    color: #f5f5f5 !important;
}
:root[data-theme="dark"] .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input::placeholder,
:root.theme-dark .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input::placeholder {
    color: #a0a0a0 !important;
}
:root[data-theme="dark"] .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input-icon,
:root.theme-dark .mdc-search-advanced-form .mdc-sf__area-filter-wrap .mdc-search-filter__area-input-icon {
    background-color: #a0a0a0 !important;
}
