/* ========================================
   CSS主题管理器 - 磨砂玻璃高级设计
   黑白灰配色 | iOS风格 | 极简主义
======================================== */

/* 主容器 */
.theme-manager-content {
    padding: 0;
    background: #f5f5f7;
    overflow-y: auto;
    height: calc(100% - 60px);
}

/* ========================================
   类型选择器 - 磨砂标签设计
======================================== */
.theme-type-selector {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    margin: 0;
    padding: 24px 20px;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.theme-type-title {
    font-size: 13px;
    font-weight: 600;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 16px;
}

.theme-type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.theme-type-tab {
    padding: 8px 16px;
    border: 0.5px solid rgba(0, 0, 0, 0.12);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.6);
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.theme-type-tab:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.theme-type-tab.active {
    background: #000000;
    color: #ffffff;
    border-color: #000000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-type-description {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #86868b;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
    border: 0.5px solid rgba(0, 0, 0, 0.06);
}

/* ========================================
   主题库区域 - 磨砂卡片列表
======================================== */
.theme-library-section {
    padding: 20px;
}

.theme-library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.theme-library-title {
    font-size: 13px;
    font-weight: 600;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.theme-create-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #000000;
    color: #ffffff;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-create-btn:hover {
    background: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-create-btn:active {
    transform: translateY(0);
}

.theme-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ========================================
   主题项 - 磨砂卡片
======================================== */
.theme-item {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 0.5px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.theme-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.12);
}

.theme-item.active {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.2);
}

.theme-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.theme-item-info {
    flex: 1;
}

.theme-item-name {
    font-size: 17px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}

.theme-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.theme-item-date {
    font-size: 11px;
    color: #86868b;
    background: rgba(0, 0, 0, 0.04);
    padding: 4px 10px;
    border-radius: 12px;
    letter-spacing: 0.2px;
}

.theme-binding-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.theme-binding-badge.global {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a1a;
}

.theme-binding-badge.single {
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
}

.theme-binding-badge.multiple {
    background: rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
}

.theme-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.theme-active-badge {
    background: #000000;
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.theme-apply-btn,
.theme-edit-btn,
.theme-delete-btn {
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.3px;
}

.theme-apply-btn {
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
}

.theme-apply-btn:hover {
    background: rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.theme-edit-btn {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1a1a;
}

.theme-edit-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.theme-delete-btn {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

.theme-delete-btn:hover {
    background: rgba(255, 59, 48, 0.15);
    transform: translateY(-1px);
}

.theme-apply-btn:active,
.theme-edit-btn:active,
.theme-delete-btn:active {
    transform: translateY(0);
}

/* 主题预览 - 代码编辑器风格 */
.theme-preview {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 16px;
    overflow-x: auto;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.theme-preview pre {
    margin: 0;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
}

.theme-preview code {
    color: #d4d4d4;
}

/* 空状态 */
.empty-state-text {
    text-align: center;
    color: #86868b;
    padding: 80px 20px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* ========================================
   主题编辑器模态框 - 磨砂玻璃设计
======================================== */
.theme-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.theme-editor-modal.show {
    display: flex;
}

.theme-editor-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.theme-editor-container {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 0.5px solid rgba(255, 255, 255, 0.8);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.theme-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 20px 24px;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

.theme-editor-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: 0.3px;
}

.theme-editor-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 50%;
    font-size: 20px;
    color: #1a1a1a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.theme-editor-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.theme-editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.theme-editor-field {
    margin-bottom: 20px;
}

.theme-editor-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: 0.2px;
}

.theme-input {
    width: 100%;
    padding: 12px 16px;
    border: 0.5px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    font-size: 15px;
    box-sizing: border-box;
    transition: all 0.3s;
    background: rgba(0, 0, 0, 0.02);
    color: #1a1a1a;
}

.theme-input:focus {
    outline: none;
    border-color: rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.04);
}

.theme-textarea {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    border: 0.5px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    font-size: 13px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    line-height: 1.6;
    box-sizing: border-box;
    resize: vertical;
    transition: all 0.3s;
    background: #1a1a1a;
    color: #d4d4d4;
}

.theme-textarea:focus {
    outline: none;
    border-color: rgba(0, 0, 0, 0.3);
}

.theme-editor-tips {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 10px;
    font-size: 12px;
    color: #86868b;
    line-height: 1.6;
    border: 0.5px solid rgba(0, 0, 0, 0.08);
}

.theme-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px 24px 24px;
    border-top: 0.5px solid rgba(0, 0, 0, 0.08);
}

.theme-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.3px;
}

.theme-btn-cancel {
    background: rgba(0, 0, 0, 0.04);
    color: #1a1a1a;
}

.theme-btn-cancel:hover {
    background: rgba(0, 0, 0, 0.08);
}

.theme-btn-save {
    background: #000000;
    color: #ffffff;
}

.theme-btn-save:hover {
    background: #1a1a1a;
}

.theme-btn:active {
    transform: scale(0.98);
}

/* ========================================
   角色选择器 - 磨砂列表
======================================== */
.theme-character-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding: 12px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
    border: 0.5px solid rgba(0, 0, 0, 0.08);
}

.theme-character-list::-webkit-scrollbar {
    width: 6px;
}

.theme-character-list::-webkit-scrollbar-track {
    background: transparent;
}

.theme-character-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.theme-character-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.theme-character-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    border: 0.5px solid rgba(0, 0, 0, 0.06);
}

.theme-character-item:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.12);
    transform: translateX(4px);
}

.theme-character-item input[type="radio"],
.theme-character-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #000000;
}

.theme-character-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.theme-character-name {
    flex: 1;
    font-size: 15px;
    color: #1a1a1a;
    font-weight: 500;
}

/* ========================================
   响应式设计 - 移动端优化
======================================== */
@media (max-width: 768px) {
    .theme-type-selector,
    .theme-library-section {
        padding: 20px 16px;
    }
    
    .theme-type-title {
        font-size: 12px;
    }
    
    .theme-type-tabs {
        gap: 8px;
    }
    
    .theme-type-tab {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .theme-library-title {
        font-size: 12px;
    }
    
    .theme-create-btn {
        padding: 9px 18px;
        font-size: 12px;
    }
    
    .theme-item {
        padding: 18px;
    }
    
    .theme-item-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .theme-item-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .theme-preview {
        font-size: 11px;
        padding: 14px;
    }
    
    .theme-editor-container {
        width: 95%;
        max-height: 90vh;
    }
    
    .theme-editor-header {
        padding: 20px;
    }
    
    .theme-editor-body {
        padding: 20px;
    }
    
    .theme-editor-footer {
        padding: 16px 20px;
    }
    
    .theme-textarea {
        min-height: 200px;
    }
    
    .theme-character-list {
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .theme-manager-content {
        padding: 0;
    }
    
    .theme-type-selector {
        padding: 16px 12px;
    }
    
    .theme-type-title {
        font-size: 11px;
        margin-bottom: 12px;
    }
    
    .theme-type-tabs {
        gap: 6px;
    }
    
    .theme-type-tab {
        padding: 6px 14px;
        font-size: 12px;
    }
    
    .theme-type-description {
        font-size: 11px;
        padding: 8px 12px;
    }
    
    .theme-library-section {
        padding: 16px 12px;
    }
    
    .theme-library-header {
        margin-bottom: 16px;
    }
    
    .theme-library-title {
        font-size: 11px;
    }
    
    .theme-create-btn {
        padding: 8px 16px;
        font-size: 11px;
    }
    
    .theme-list {
        gap: 10px;
    }
    
    .theme-item {
        padding: 16px;
        border-radius: 14px;
    }
    
    .theme-item-name {
        font-size: 16px;
    }
    
    .theme-item-date {
        font-size: 10px;
    }
    
    .theme-binding-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .theme-item-actions {
        gap: 6px;
    }
    
    .theme-active-badge,
    .theme-apply-btn,
    .theme-edit-btn,
    .theme-delete-btn {
        padding: 5px 12px;
        font-size: 11px;
    }
    
    .theme-preview {
        font-size: 10px;
        padding: 12px;
    }
    
    .theme-editor-container {
        width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        margin-top: auto;
    }
    
    .theme-editor-header h3 {
        font-size: 18px;
    }
    
    .theme-editor-field label {
        font-size: 12px;
    }
    
    .theme-input {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .theme-textarea {
        min-height: 180px;
        font-size: 12px;
    }
    
    .theme-editor-tips {
        font-size: 11px;
        padding: 10px 14px;
    }
    
    .theme-btn {
        padding: 10px 24px;
        font-size: 14px;
    }
    
    .theme-character-list {
        max-height: 180px;
        padding: 10px;
    }
    
    .theme-character-item {
        padding: 10px;
    }
    
    .theme-character-avatar {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .theme-character-name {
        font-size: 14px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .theme-type-tab,
    .theme-create-btn,
    .theme-apply-btn,
    .theme-edit-btn,
    .theme-delete-btn,
    .theme-btn,
    .theme-character-item {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .theme-item {
        touch-action: manipulation;
    }
}

/* 滚动条样式 */
.theme-manager-content::-webkit-scrollbar,
.theme-editor-body::-webkit-scrollbar {
    width: 8px;
}

.theme-manager-content::-webkit-scrollbar-track,
.theme-editor-body::-webkit-scrollbar-track {
    background: transparent;
}

.theme-manager-content::-webkit-scrollbar-thumb,
.theme-editor-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.theme-manager-content::-webkit-scrollbar-thumb:hover,
.theme-editor-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}