/* 统计之家：Ocean / Teal / Deep-Ocean 主题选择器样式 */

/* 处于「海洋蓝」主题时，隐藏各页面自带的 sun/moon toggle 按钮，
   避免它把主题在 ocean/teal 之间强制切换、跳出海洋蓝态。 */
[data-theme="deep-ocean"] .theme-toggle {
    display: none !important;
}

.theme-switcher.hm-theme-picker {
    position: relative;
    display: flex !important;
    align-items: center;
    z-index: 1100;
}

/* 统计页旧壳层会隐藏整个右侧工具组；仅恢复主题按钮。 */
body.lab-features-theme .sub-header-right .theme-switcher.hm-theme-picker {
    display: flex !important;
}

.hm-theme-trigger {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text-muted);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease, background .18s ease;
}

.hm-theme-trigger:hover,
.hm-theme-picker.is-open .hm-theme-trigger {
    border-color: var(--accent);
    color: var(--text);
    background: var(--accent-soft);
}

.hm-theme-trigger .hm-theme-swatch,
.hm-theme-option .hm-theme-swatch {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .5);
    box-shadow: 0 0 0 1px rgba(16, 44, 42, .15);
}

.hm-theme-chevron {
    font-size: 9px;
    opacity: .7;
    transition: transform .18s ease;
}

.hm-theme-picker.is-open .hm-theme-chevron {
    transform: rotate(180deg);
}

.hm-theme-menu {
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    width: 154px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-elevated);
    box-shadow: 0 12px 32px rgba(5, 15, 30, .24);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity .16s ease, visibility .16s ease, transform .16s ease;
}

.hm-theme-picker.is-open .hm-theme-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.hm-theme-option {
    width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}

.hm-theme-option:hover {
    background: var(--surface);
    color: var(--text);
}

.hm-theme-option.is-active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}

.hm-theme-option.is-active::after {
    content: "✓";
    margin-left: auto;
}

.hm-swatch-ocean { background: #176b67; }
.hm-swatch-teal { background: #0d4d4a; }
.hm-swatch-deep-ocean { background: linear-gradient(135deg, #0C322C 0%, #C6A15B 100%); }

@media (max-width: 768px) {
    .theme-switcher.hm-theme-picker {
        display: flex !important;
    }

    .hm-theme-trigger {
        width: 30px;
        min-width: 30px;
        height: 30px;
        padding: 0;
        border-radius: 50%;
    }

    .hm-theme-trigger-label,
    .hm-theme-chevron {
        display: none;
    }

    .hm-theme-menu {
        position: fixed;
        top: 0;
        left: 0;
        right: auto;
        bottom: auto;
        width: min(220px, calc(100vw - 24px));
        padding: 8px;
        /* 具体坐标由 theme-manager.js 按触发按钮 getBoundingClientRect 写入 */
    }

    .hm-theme-option {
        min-height: 42px;
        font-size: 14px;
    }
}
