/*
 * 主题切换器样式（参照 DevExpress 官方 theme-switcher demo 适配站点页头布局）。
 * 入口按钮挂在 Header.razor 的 navbar-loginout 区域（右上角），
 * 面板为按钮下方的小型弹层，带全屏透明遮罩用于点击外部关闭。
 */

/* ---------- 入口按钮外层：锚定弹层、与页头其他元素同行对齐 ---------- */
.theme-switcher-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-right: 10px;
}

/* ---------- 图标：SVG 遮罩随文字颜色变化 ---------- */
.dxbl-image.theme-icon {
    mask-size: cover;
    width: 1rem;
    height: 1rem;
    background-color: var(--dxds-color-content-neutral-default-rest, var(--bs-body-color, black));
    mask-image: url("../images/theme.svg");
    -webkit-mask-image: url("../images/theme.svg");
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
}

/* ---------- 入口按钮：圆形描边图标按钮 ---------- */
.theme-switcher-wrapper > .theme-settings {
    --dxbl-btn-border-radius: 50%;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    padding: 0;
    border-width: 2px;
    align-items: center;
    justify-content: center;
    display: inline-flex;
}

.theme-settings:hover .theme-icon {
    background-color: currentColor;
}

/* ---------- 点击外部关闭的透明遮罩 ---------- */
.theme-switcher-backdrop {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1028;
}

/* ---------- 主题面板：按钮下方右对齐弹层 ---------- */
.themeswitcher-container {
    display: block;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 240px;
    background-color: var(--dxds-color-surface-neutral-default-rest, var(--bs-body-bg, white));
    border-radius: 8px;
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .18);
    z-index: 1029;
    --themeswitcher-color-hover: var(--dxds-color-surface-neutral-default-selected, #e9e9e8);
    --themeswitcher-color-active: var(--dxds-color-surface-neutral-default-hovered, #f4f4f3);
    --themeswitcher-color-active-hover: var(--dxds-color-surface-neutral-default-selected-hovered, #d3d3d2);
}

/* 暗色主题下调整悬停色，避免色块在深色背景上过亮 */
.themeswitcher-container.theme-BlazingDark {
    --themeswitcher-color-hover: #2e2e2d;
    --themeswitcher-color-active: #3f3f3e;
    --themeswitcher-color-active-hover: #505150;
}

.themeswitcher-title {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    line-height: 100%;
    text-align: start;
    padding: 12px 12px 8px 12px;
    border-bottom: 1px solid var(--bs-border-color, #D6D6D6);
}

.themeswitcher-content {
    padding: 0;
    padding-bottom: 8px;
}

.themeswitcher-content + .themeswitcher-content .themeswitcher-title {
    border-bottom: none;
    padding-top: 4px;
}

.themeswitcher-colors {
    flex-flow: row wrap;
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
}

.themeswitcher-color {
    display: flex;
    flex: 1 0 100%;
    max-width: 100%;
    padding: 2px 4px;
}

.themeswitcher-color a {
    display: flex;
    border-radius: 4px;
    padding: 8px;
    width: 100%;
    height: 100%;
    cursor: pointer;
    font-size: 0.9rem;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.themeswitcher-color.active a {
    background-color: var(--themeswitcher-color-active);
}

.themeswitcher-color.active a:hover {
    background-color: var(--themeswitcher-color-active-hover);
}

.themeswitcher-color a:hover {
    background-color: var(--themeswitcher-color-hover);
}

/* 色块圆点：使用与官方 demo 一致的主题代表色 */
.themeswitcher-color a:before {
    content: '';
    margin-inline-end: 12px;
    display: block;
    border-radius: 4px;
    width: 1.25rem;
    height: 1.25rem;
    background-color: var(--themeswitcher-color);
    flex: 0 0 auto;
}

.themeswitcher-color.ParateraBlue {
    --themeswitcher-color: #04519f;
}

.themeswitcher-color.BlazingBerry {
    --themeswitcher-color: #5c2d91;
}

.themeswitcher-color.BlazingDark {
    --themeswitcher-color: #46444a;
}

.themeswitcher-color.Purple {
    --themeswitcher-color: #7989ff;
}

.themeswitcher-color.OfficeWhite {
    --themeswitcher-color: #fe7109;
}

/* 暗色主题下的色块加描边，避免与深色背景融合 */
.theme-BlazingDark .themeswitcher-color a:before {
    border: 1px solid #7a7a7a;
}
