/* ============================================================
   便签空间社区 - 主题切换器组件样式
   前端（style.css）与后台（admin.css）共用，页面统一引入本文件
   ============================================================ */

/* ---------- 切换按钮 ---------- */
.theme-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-family: inherit;
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.admin-theme-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    padding: 7px 12px;
    border-radius: 9px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-family: inherit;
}

.admin-theme-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ---------- 容器定位 ---------- */
.theme-switcher {
    position: relative;
    display: inline-block;
}

.admin-theme-switcher {
    position: relative;
}

/* ---------- 面板 ---------- */
.theme-panel,
.admin-theme-panel {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background: var(--surface, #fff);
    color: var(--text-primary, #1e293b);
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    padding: 14px;
    width: 320px;
    z-index: 999;
    border: 1px solid var(--border-color, #e2e8f0);
}

.theme-panel.open,
.admin-theme-panel.open {
    display: block;
}

/* ---------- 面板标题 ---------- */
.theme-panel-title {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    margin-bottom: 10px;
    font-weight: 600;
}

/* ---------- 网格 ---------- */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

/* ---------- 单个主题选项 ---------- */
.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    border: 1.5px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    padding: 6px 2px;
    background: var(--surface-2, #f8fafc);
    transition: all 0.2s;
}

.theme-option:hover {
    border-color: var(--primary-color, #f97316);
    transform: translateY(-2px);
}

.theme-option.active {
    border-color: var(--primary-color, #f97316);
    box-shadow: 0 0 0 2px var(--primary-soft, rgba(249, 115, 22, 0.1));
}

/* ---------- 色点 ---------- */
.theme-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    display: inline-block;
    flex-shrink: 0;
}

/* ---------- 主题名称 ---------- */
.theme-name {
    font-size: 10px;
    color: var(--text-secondary, #64748b);
    white-space: nowrap;
}

/* ---------- 小屏适配：面板固定居中，防止超出屏幕被截断 ---------- */
@media (max-width: 768px) {
    .theme-panel,
    .admin-theme-panel {
        position: fixed;
        left: 50%;
        right: auto;
        top: 64px;
        transform: translateX(-50%);
        width: min(320px, calc(100vw - 24px));
        max-height: 70vh;
        overflow-y: auto;
    }

    /* 后台顶栏较矮时微调 */
    .admin-theme-panel {
        top: 56px;
    }

    .theme-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
