/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* 夜间模式 */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}

/* 主题切换按钮 */
.theme-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 12px 24px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e2e8f0;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
    background-color: #cbd5e0;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

body.dark-mode .theme-toggle {
    background-color: #2d3748;
}

body.dark-mode .theme-toggle:hover {
    background-color: #4a5568;
}

body.dark-mode .container {
    background-color: #1e1e1e;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* 夜间模式下的组件样式 */
body.dark-mode header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

body.dark-mode .search-box input {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e0e0e0;
}

body.dark-mode .search-box input:focus {
    border-color: #667eea;
}

body.dark-mode .search-box button,
body.dark-mode .import-btn,
body.dark-mode #clear-btn {
    background-color: #4a5568;
}

body.dark-mode .search-box button:hover,
body.dark-mode .import-btn:hover,
body.dark-mode #clear-btn:hover {
    background-color: #2d3748;
}

body.dark-mode .category-tag {
    background-color: #2d3748;
    color: #e0e0e0;
}

body.dark-mode .category-tag:hover {
    background-color: #4a5568;
}

body.dark-mode .category-tag.active {
    background-color: #667eea;
    color: white;
}

body.dark-mode .kaomoji-item {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e0e0e0;
}

body.dark-mode .kaomoji-item:hover {
    border-color: #667eea;
}

body.dark-mode .modal-content {
    background-color: #2d3748;
    color: #e0e0e0;
}

body.dark-mode .modal-content pre {
    background-color: #1a202c;
    border-color: #4a5568;
    color: #e0e0e0;
}

body.dark-mode footer {
    background-color: #1a202c;
    color: #a0aec0;
    border-top-color: #4a5568;
}

body.dark-mode .tooltip {
    background-color: rgba(255, 255, 255, 0.9);
    color: #1a202c;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主内容区域 */
main {
    padding: 20px;
}

/* 搜索和导入区域 */
.search-import-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    gap: 10px;
    width: 100%;
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.search-box button {
    padding: 12px 24px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-box button:hover {
    background-color: #5a67d8;
}

.import-box {
    display: flex;
    gap: 10px;
}

.import-btn, #clear-btn {
    padding: 10px 20px;
    background-color: #48bb78;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
}

.import-btn:hover, #clear-btn:hover {
    background-color: #38a169;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#clear-btn {
    background-color: #f56565;
}

#clear-btn:hover {
    background-color: #e53e3e;
}

/* 分类区域 */
.category-section {
    margin-bottom: 30px;
}

.categories {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.category-tag {
    padding: 8px 16px;
    background-color: #e9ecef;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.category-tag:hover {
    background-color: #dee2e6;
}

.category-tag.active {
    background-color: #667eea;
    color: white;
}

/* 颜文字展示区域 */
.kaomoji-section {
    margin-bottom: 30px;
}

.kaomoji-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.kaomoji-item {
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.5rem;
    user-select: none;
    min-width: 60px;
    white-space: nowrap;
}

.kaomoji-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.kaomoji-item.copied {
    background-color: #48bb78;
    color: white;
    border-color: #48bb78;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.close-modal:hover {
    color: #333;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #667eea;
}

.modal-content h4 {
    margin: 15px 0 10px 0;
    color: #4a5568;
}

.modal-content pre {
    background-color: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
}

/* 页脚样式 */
footer {
    background-color: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid #e9ecef;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    /* 确保搜索和导入区域容器居中 */
    .search-import-section {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .search-box, .import-box {
        display: flex;
        flex-direction: column;

        width: 100%;
        max-width: 300px;
    }
    
    /* 确保所有按钮统一样式和居中 */
    .search-box button, .import-btn, #clear-btn {
        width: 100%;
        text-align: center;
        border-radius: 8px;
    }
    
    /* 主题切换按钮保持与其他按钮一致 */
    .theme-toggle {
        width: 100%;
        padding: 12px 20px;
        border-radius: 8px;
        box-sizing: border-box;
        text-align: center;
        min-height: 48px;
    }
    
    /* 移动端禁用主题切换按钮倾斜动画 */
    .theme-toggle:hover {
        transform: none;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }
    
    .kaomoji-grid {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .kaomoji-item {
        font-size: 1.2rem;
        padding: 8px 12px;
        min-width: 50px;
    }
}

/* 加载动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kaomoji-item {
    animation: fadeIn 0.3s ease-out;
}

/* 提示框样式 */
.tooltip {
    position: fixed;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    z-index: 1001;
    animation: fadeInOut 1.5s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}