/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 移除默认的点击反馈样式 */
button, div, span, a {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* 确保按钮没有默认的焦点样式 */
button:focus {
    outline: none;
    box-shadow: none;
}

/* 允许输入元素选择文本 */
input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

html, body {
    height: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    position: relative;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    margin: 0;
    padding: 0;
}

/* Material Design 颜色方案 */
:root {
    --primary-color: #2196f3;
    --secondary-color: #f44336;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --info-color: #03a9f4;
    --light-color: #f5f5f5;
    --dark-color: #333333;
    --white-color: #ffffff;
    --gray-light: #e0e0e0;
    --gray-medium: #9e9e9e;
    --gray-dark: #616161;
}

/* 电脑样式 */
.desktop-layout {
    display: flex;
    min-height: 100vh;
    height: 100%;
    padding: 20px;
    gap: 20px;
    box-sizing: border-box;
}

.left-sidebar {
    flex: 1;
    background-color: var(--white-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

.right-section {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: hidden;
}

.like-section, .dislike-section {
    flex: 1;
    background-color: var(--white-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

/* 手机样式 */
.mobile-layout {
    display: none;
    flex-direction: column;
    height: 100vh;
}

.mobile-unclassified {
    flex: 1;
    background-color: var(--white-color);
    padding: 20px;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

.mobile-toggle {
    display: flex;
    background-color: var(--white-color);
    border-bottom: 1px solid var(--gray-light);
}

.toggle-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: none;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--gray-medium);
}

.toggle-btn.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.mobile-classified {
    flex: 1;
    background-color: var(--white-color);
    overflow-y: auto;
}

.mobile-section {
    display: none;
    padding: 20px;
    height: 100%;
    overflow-y: hidden;
    flex-direction: column;
}

.mobile-section.active {
    display: flex;
}

/* 标签容器 */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    min-height: 200px;
    max-height: calc(100% - 60px);
    padding: 20px;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
    background-color: #fafafa;
    align-content: flex-start;
    overflow-y: auto;
    box-sizing: border-box;
    flex: 1;
}

/* 拖拽悬停效果 */
.tags-container.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(33, 150, 243, 0.1);
    transform: scale(1.02);
}

/* 喜欢区域容器 */
#like-container {
    border-color: rgba(76, 175, 80, 0.3);
}

#like-container.drag-over {
    border-color: var(--success-color);
    background-color: rgba(76, 175, 80, 0.1);
}

/* 不喜欢区域容器 */
#dislike-container {
    border-color: rgba(244, 67, 54, 0.3);
}

#dislike-container.drag-over {
    border-color: var(--secondary-color);
    background-color: rgba(244, 67, 54, 0.1);
}

/* 手机端容器 */
#mobile-like-container {
    border-color: rgba(76, 175, 80, 0.3);
}

#mobile-like-container.drag-over {
    border-color: var(--success-color);
    background-color: rgba(76, 175, 80, 0.1);
}

#mobile-dislike-container {
    border-color: rgba(244, 67, 54, 0.3);
}

#mobile-dislike-container.drag-over {
    border-color: var(--secondary-color);
    background-color: rgba(244, 67, 54, 0.1);
}

/* 标签样式 */
.tag {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border-radius: 20px;
    background-color: var(--gray-light);
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    height: auto;
    min-height: 40px;
    /* 移动端触摸优化 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* 确保拖拽时显示在最上层 */
    z-index: 1;
}

/* 拖拽中的标签样式 */
.tag.dragging {
    z-index: 9999;
    transition: none;
    transform: rotate(5deg);
}

/* 移动端触摸优化 */
@media (max-width: 768px) {
    .tag {
        touch-action: none;
        /* 增加点击区域 */
        padding: 12px 16px;
        min-height: 44px;
    }
    
    /* 优化移动端切换按钮 */
    .toggle-btn {
        padding: 18px 15px;
        font-size: 16px;
    }
    
    /* 移动端隐藏标题 */
    .mobile-unclassified h2,
    .mobile-section h2 {
        display: none;
    }
    
    /* 调整移动端标签容器的margin-top */
    .mobile-unclassified .tags-container,
    .mobile-section .tags-container {
        margin-top: 0;
        min-height: 100%;
        max-height: 100%;
    }
    
    /* 确保移动端区域填充整个空间 */
    .mobile-unclassified,
    .mobile-section {
        padding: 10px;
    }
}

.tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 标签问号按钮 */
.tag-info-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--gray-medium);
    color: var(--white-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: help;
    transition: all 0.3s ease;
}

.tag-info-btn:hover {
    background-color: var(--primary-color);
}

/* 标签点击次数 */
.tag-count {
    font-size: 12px;
    color: var(--gray-dark);
    min-width: 20px;
    text-align: right;
}

/* 弹窗背景遮罩 */
.tooltip-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tooltip-backdrop.show {
    opacity: 1;
    visibility: visible;
}

/* 弹窗样式 */
.tooltip {
    position: fixed;
    background-color: var(--white-color);
    color: var(--dark-color);
    padding: 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    max-width: 90%;
    min-width: 300px;
    width: 600px;
    max-height: 80%;
    overflow-y: auto;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* 导入导出弹窗特殊样式 */
#import-export-tooltip {
    max-width: 95%;
    width: 700px;
    max-height: 85%;
}

.tooltip.show {
    opacity: 1;
    visibility: visible;
}

/* 弹窗标题 */
.tooltip-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* 弹窗内容 */
.tooltip-content {
    line-height: 1.4;
    margin: 0;
}

/* 标签内容 */
.tab-content {
    display: none;
    margin: 0;
}

.tab-content.active {
    display: block;
}

/* 导入导出功能样式 */
.header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background-color: var(--primary-color);
    color: var(--white-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.action-btn:hover {
    background-color: #1976d2;
    transform: translateY(-1px);
}

/* 移动端操作按钮 */
.mobile-actions {
    justify-content: center;
    margin-bottom: 10px;
}

/* 操作结果区域 */
.operation-result {
    margin-bottom: 20px;
}

/* 操作按钮区域 */
.operation-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 导出按钮行 */
.export-buttons-row {
    display: flex;
    gap: 20px;
}

/* 操作按钮卡片 */
.operation-button-card {
    border: 2px solid var(--gray-light);
    border-radius: 8px;
    padding: 15px;
    background-color: var(--white-color);
    color: var(--dark-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.operation-button-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

/* 导出图片卡片 */
.export-image-card {
    flex: 1;
    min-width: 150px;
}

/* 导出JSON卡片 */
.export-json-card {
    flex: 1;
    min-width: 150px;
}

/* 剪贴板导入卡片 */
.clipboard-import-card {
    width: 100%;
}

/* 导入JSON卡片 */
.import-json-card {
    width: 100%;
}

/* 操作按钮样式 */
.operation-btn {
    width: 100%;
    height: 100%;
    min-height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    margin-top: 0;
}

/* 移动端响应式布局 */
@media (max-width: 768px) {
    /* 导入导出弹窗样式 */
    #import-export-tooltip {
        width: 95%;
        max-width: 95%;
        background-color: var(--white-color);
        color: var(--dark-color);
    }
    
    /* 弹窗标题 */
    #import-export-tooltip .tooltip-title {
        color: var(--primary-color);
        font-size: 18px;
        font-weight: bold;
        text-align: center;
        margin-bottom: 20px;
    }
    
    /* 移动端操作按钮区域 */
    .operation-buttons {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    /* 移动端导出按钮行 */
    .export-buttons-row {
        display: flex;
        gap: 15px;
    }
    
    /* 移动端卡片样式 */
    .operation-button-card {
        border: 2px solid var(--gray-light);
        border-radius: 8px;
        padding: 15px;
        background-color: var(--white-color);
        color: var(--dark-color);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 80px;
    }
    
    .operation-button-card:hover {
        border-color: var(--primary-color);
        box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
    }
    
    /* 移动端导出卡片 */
    .export-image-card,
    .export-json-card {
        flex: 1;
        min-height: 60px;
    }
    
    /* 移动端按钮样式 */
    .btn {
        background-color: var(--primary-color);
        color: var(--white-color);
    }
    
    .btn:hover {
        background-color: #1976d2;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    /* 移动端文本区域样式 */
    textarea {
        border: 1px solid var(--gray-light);
        background-color: var(--white-color);
        color: var(--dark-color);
    }
    
    textarea::placeholder {
        color: var(--gray-medium);
    }
    
    /* 移动端拖拽上传区域 */
    .drag-drop-area {
        border: 2px dashed var(--gray-light);
    }
    
    .drag-drop-area:hover {
        border-color: var(--primary-color);
        background-color: rgba(33, 150, 243, 0.05);
    }
    
    .drag-drop-area.drag-over {
        border-color: var(--primary-color);
        background-color: rgba(33, 150, 243, 0.1);
    }
    
    .drag-drop-area p {
        color: var(--gray-dark);
    }
    
    /* 移动端导入结果 */
    .import-result,
    .export-result {
        border: 1px solid var(--gray-light);
        background-color: var(--light-color);
        color: var(--dark-color);
    }
    
    .import-result h4,
    .export-result h4 {
        color: var(--gray-dark);
    }
    
    .result-content {
        color: var(--dark-color);
    }
}

/* 项目标题 */
.operation-button-card h3 {
    color: var(--primary-color);
    font-size: 18px;
    margin-bottom: 15px;
    text-align: center;
    margin: 0 0 15px 0;
}

/* 拖拽上传区域 */
.drag-drop-area {
    border: 2px dashed var(--gray-light);
    border-radius: 4px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 10px;
    background-color: var(--light-color);
}

.drag-drop-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(33, 150, 243, 0.05);
}

.drag-drop-area.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(33, 150, 243, 0.1);
}

.drag-drop-area p {
    color: var(--gray-dark);
    margin-bottom: 15px;
    font-size: 14px;
}

/* 按钮样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background-color: var(--primary-color);
    color: var(--white-color);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
}

.btn:hover {
    background-color: #1976d2;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 大按钮样式 */
.large-btn {
    font-size: 16px;
    padding: 20px 30px;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    margin-top: 0;
}

/* 文本区域样式 */
textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px;
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    background-color: var(--white-color);
    color: var(--dark-color);
    margin-bottom: 10px;
    resize: none;
    font-family: inherit;
}

textarea::placeholder {
    color: var(--gray-medium);
}

/* 导入结果 */
.import-result,
.export-result {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    background-color: var(--light-color);
    color: var(--dark-color);
}

.import-result h4,
.export-result h4 {
    color: var(--gray-dark);
    margin-bottom: 10px;
}

.result-content {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--dark-color);
}

/* 标题样式 */
h3 {
    font-size: 18px;
    margin: 16px 0;
    color: var(--dark-color);
    font-weight: 500;
}

h4 {
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--gray-dark);
    font-weight: 500;
}

/* 视觉飘出元素效果 */
.visual-effect {
    position: absolute;
    pointer-events: none;
    z-index: 9999;
    animation: float 1s ease-out forwards;
}

@keyframes float {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) translateY(-50px);
    }
}

/* 响应式布局 */
/* 小屏幕设备 */
@media (max-width: 768px) {
    .desktop-layout {
        display: none;
    }
    
    .mobile-layout {
        display: flex;
    }
    
    /* 优化移动端容器间距 */
    .mobile-unclassified {
        padding: 15px;
    }
    
    .mobile-section {
        padding: 15px;
    }
    
    /* 优化移动端标签样式 */
    .tag {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    /* 优化移动端标题大小 */
    h2 {
        font-size: 18px;
        margin-bottom: 15px;
    }
}

/* 中等屏幕设备 */
@media (min-width: 769px) and (max-width: 1024px) {
    .desktop-layout {
        padding: 15px;
        gap: 15px;
    }
    
    .left-sidebar,
    .like-section,
    .dislike-section {
        padding: 15px;
    }
    
    /* 优化标签容器最小高度 */
    .tags-container {
        min-height: 250px;
        padding: 15px;
    }
}

/* 大屏幕设备 */
@media (min-width: 1025px) {
    .desktop-layout {
        display: flex;
    }
    
    .mobile-layout {
        display: none;
    }
    
    /* 优化大屏幕布局 */
    .left-sidebar {
        flex: 1;
    }
    
    .right-section {
        flex: 3;
    }
}

/* 通用样式调整 */
h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--dark-color);
    font-weight: 500;
}

/* 标签颜色变化 */
.tag.like-1 {
    background-color: #e8f5e8;
}

.tag.like-2 {
    background-color: #c8e6c9;
}

.tag.like-3 {
    background-color: #a5d6a7;
}

.tag.like-4 {
    background-color: #81c784;
}

.tag.like-5 {
    background-color: #66bb6a;
}

.tag.dislike-1 {
    background-color: #ffebee;
}

.tag.dislike-2 {
    background-color: #ffcdd2;
}

.tag.dislike-3 {
    background-color: #ef9a9a;
}

.tag.dislike-4 {
    background-color: #e57373;
}

.tag.dislike-5 {
    background-color: #ef5350;
}

/* 本地配置文件列表样式 */
.config-files-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.config-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid var(--gray-light);
    border-radius: 4px;
    background-color: var(--light-color);
    transition: all 0.3s ease;
}

.config-file-item:hover {
    border-color: var(--primary-color);
    background-color: rgba(33, 150, 243, 0.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.config-file-item span {
    font-size: 14px;
    color: var(--dark-color);
}

.import-config-btn {
    margin-top: 0;
    font-size: 12px;
    padding: 6px 12px;
}

.no-config-files {
    text-align: center;
    padding: 30px 10px;
    color: var(--gray-medium);
    font-style: italic;
}

/* 本地配置弹窗样式 */
#local-config-tooltip {
    max-width: 95%;
    width: 500px;
    max-height: 85%;
}