* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    padding: 30px;
    text-align: center;
    border-bottom: 5px solid #ff7e5f;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 搜索区域 */
.search-container {
    padding: 25px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eaeaea;
}

.search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto 15px;
}

.search-box i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 1.2rem;
}

#searchInput {
    width: 100%;
    padding: 18px 60px 18px 50px;
    border: 2px solid #dee2e6;
    border-radius: 50px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: #2575fc;
    box-shadow: 0 0 0 0.2rem rgba(37, 117, 252, 0.25);
}

.clear-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    display: none;
}

.clear-btn:hover {
    color: #dc3545;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.95rem;
    color: #6c757d;
}

/* 控制栏 */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background-color: white;
    border-bottom: 1px solid #eaeaea;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-controls label {
    font-weight: 500;
}

#sortSelect {
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid #ced4da;
    background-color: white;
    font-size: 1rem;
    cursor: pointer;
}

.view-toggle {
    padding: 10px 20px;
    background-color: #2575fc;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.3s ease;
}

.view-toggle:hover {
    background-color: #1c6ae4;
}

/* 术语容器 */
.terms-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 25px;
}

.term-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-left: 5px solid #2575fc;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.term-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.term-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6a11cb, #2575fc);
}

.term-card h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.4rem;
}

.term-card .chinese {
    color: #27ae60;
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.term-card .category {
    display: inline-block;
    background-color: #e8f4fd;
    color: #2575fc;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-top: 10px;
}

.term-card .abbreviation {
    color: #e74c3c;
    font-weight: 500;
    margin-top: 5px;
    font-size: 0.9rem;
}

/* 列表视图 */
.list-view .terms-container {
    display: block;
}

.list-view .term-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.list-view .term-card h3 {
    margin-bottom: 0;
    flex: 1;
}

.list-view .term-card .chinese {
    flex: 1;
    margin-bottom: 0;
    text-align: center;
}

.list-view .term-card .category {
    margin-top: 0;
}

/* 分类筛选 */
.category-filter {
    padding: 20px 25px;
    background-color: #f8f9fa;
    border-top: 1px solid #eaeaea;
}

.category-filter h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.category-tag {
    padding: 8px 16px;
    background-color: white;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.category-tag:hover {
    background-color: #f1f3f4;
}

.category-tag.active {
    background-color: #2575fc;
    color: white;
    border-color: #2575fc;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close-modal:hover {
    color: #333;
}

.modal-body {
    margin-top: 20px;
}

.detail-row {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row strong {
    display: inline-block;
    width: 80px;
    color: #555;
}

/* 页脚 */
footer {
    text-align: center;
    padding: 20px;
    background-color: #2c3e50;
    color: white;
    font-size: 0.9rem;
}

footer p {
    margin: 0;
}

#totalTerms {
    color: #ff7e5f;
    font-weight: bold;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .terms-container {
        grid-template-columns: 1fr;
        padding: 15px;
    }
    
    .list-view .term-card {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .list-view .term-card .chinese {
        text-align: left;
        margin: 5px 0;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}