﻿/* Tabs */
.bg-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--sr-color-border);
}
.bg-tab {
    padding: 8px 20px;
    cursor: pointer;
    font-size: 14px;
    color: var(--sr-color-text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    user-select: none;
}
.bg-tab:hover {
    color: var(--sr-color-primary);
}
.bg-tab.active {
    color: var(--sr-color-primary);
    border-bottom-color: var(--sr-color-primary);
    font-weight: 600;
}
/* 类别列表 */
.category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.cat-item {
    padding: 4px 14px;
    border: 1.5px solid var(--sr-color-border);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    color: var(--sr-color-text);
    background: #fff;
    transition: all 0.2s;
    user-select: none;
}
.cat-item:hover {
    border-color: var(--sr-color-primary);
}
.cat-item.active {
    border-color: var(--sr-color-primary);
    background: var(--sr-color-primary);
    color: #fff;
}
/* 背景网格 */
.bg-list-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 90%;
    overflow-y: auto;
}
.bg-list-item {
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}
.bg-list-item:hover {
    border-color: var(--sr-color-primary);
}
.bg-list-item.active {
    border-color: var(--sr-color-primary);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}
.bg-list-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}
.bg-list-item .bg-name {
    font-size: 11px;
    text-align: center;
    padding: 4px 2px;
    color: var(--sr-color-text);
    background: #f9fafb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bg-loading-tip {
    font-size: 12px;
    color: var(--sr-color-text-muted);
    text-align: center;
    padding: 20px 0;
    grid-column: 1 / -1;
}
/* 自定义选项卡 */
.custom-section {
    margin-bottom: 12px;
}
.custom-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--sr-color-text);
    margin: 0 0 6px;
}
.custom-input {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--sr-color-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: var(--sr-color-text);
    box-sizing: border-box;
    outline: none;
    background: #fafbfc;
    transition: border-color 0.2s;
}
.custom-input:focus {
    border-color: var(--sr-color-primary);
    background: #fff;
}
.custom-input::placeholder {
    color: var(--sr-color-text-muted);
}
.custom-textarea {
    min-height: 80px;
    resize: vertical;
}
.bg-ref-upload-box {
    width: 100%;
    max-height: 130px;
    aspect-ratio: 1 / 1;
    border: 2px dashed var(--sr-color-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
    background: #fafbfc;
    position: relative;
    box-sizing: border-box;
}
.bg-ref-upload-box:hover {
    border-color: var(--sr-color-primary);
    background: #f5f3ff;
}
.bg-ref-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--sr-color-text-muted);
    font-size: 12px;
    user-select: none;
}
.bg-ref-upload-placeholder svg {
    width: 28px;
    height: 28px;
}
.bg-ref-upload-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}
/* 选项卡内容容器 */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}
/* 加载进度条 */
.loading-progress-wrapper {
    padding: 0 20px;
    margin-top: 20px;
    text-align: center;
}
.loading-progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}
.loading-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #818cf8);
    border-radius: 10px;
    transition: width 0.3s ease;
}
.loading-progress-text {
    font-size: 13px;
    color: var(--sr-color-text-secondary);
    margin-top: 8px;
}
/* 加载遮罩 */
.hero-img-wrapper { position: relative; border-radius: 12px; overflow: hidden; line-height: 0; }
.hero-img-wrapper > img { display: block; width: 100%; border-radius: 12px; }
.hero-loading-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: none; flex-direction: column; align-items: center; justify-content: center; border-radius: 12px; z-index: 10; }
.hero-loading-overlay .loading-text { color: #fff; font-size: 15px; margin-bottom: 18px; text-shadow: 0 1px 4px rgba(0,0,0,0.4); }
.hero-loading-overlay .loading-bar { width: 65%; max-width: 320px; height: 8px; background: rgba(255,255,255,0.3); border-radius: 4px; overflow: hidden; }
.hero-loading-overlay .loading-bar-fill { height: 100%; background: #fff; border-radius: 4px; transition: width 0.3s ease; width: 0%; }

.sec-desc {
    font-size: 12px;
    color: var(--sr-color-text-secondary);
    line-height: 1.6;
    margin: 0 0 10px;
}
/* 开关网格 */
.switch-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.toggle-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1.5px solid var(--sr-color-border);
    border-radius: 20px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    font-size: 13px;
    color: var(--sr-color-text);
    font-family: inherit;
}

    .toggle-item:hover {
        border-color: var(--sr-color-primary);
        background: #f5f3ff;
    }

    .toggle-item.checked {
        border-color: var(--sr-color-primary);
        background: var(--sr-color-primary);
        color: #fff;
    }

    .toggle-item input {
        display: none;
    }

    .toggle-item .check-icon {
        display: none;
        width: 14px;
        height: 14px;
    }

    .toggle-item.checked .check-icon {
        display: inline-block;
    }

    .toggle-item .check-icon svg {
        width: 14px;
        height: 14px;
        fill: currentColor;
    }
/* 文本框 */
.fix-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 14px;
    border: 1.5px solid var(--sr-color-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: var(--sr-color-text);
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    background: #fafbfc;
}

    .fix-textarea:focus {
        border-color: var(--sr-color-primary);
        background: #fff;
    }

    .fix-textarea::placeholder {
        color: var(--sr-color-text-muted);
    }
/* 背景样式预览 */
.bg-style-preview {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    flex-shrink: 0;
    overflow: hidden;
    line-height: 0;
}

    .bg-style-preview svg {
        display: block;
        width: 100%;
        height: 100%;
    }

.size-desc {
    font-size: 10px;
    color: var(--sr-color-text-muted);
    display: block;
    text-align: center;
    margin-top: 2px;
}

/* 移动端H5样式 */
@media (max-width: 639px) {
    .sr-ref-img {
        width: 80px;
        height: 80px;
    }
}
