/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --accent-color: #7209b7;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --light-gray: #e9ecef;
    --success-color: #4CAF50;
    --info-color: #2196F3;
    --warning-color: #FF9800;
    --danger-color: #f72585;
    --border-radius: 12px;
    --box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    --box-shadow-hover: 0 15px 30px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background-color: #f7fafc;
    min-height: 100vh;
    padding: 12px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #ffffff;
    padding: 10px;
}

/* 头部样式 */
.header {
    text-align: center;
    padding: 16px;
    margin-bottom: 16px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #2c5282;
    margin-bottom: 8px;
}

.header .icon {
    display: none; /* 隐藏Emoji图标 */
}

.subtitle {
    font-size: 14px;
    color: #718096;
    max-width: 600px;
    margin: 0 auto;
}

/* 工具栏 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-box {
    display: flex;
    flex: 1;
    max-width: 400px;
    min-width: 250px;
}

#searchInput {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-right: none;
    font-size: 14px;
}

#searchInput:focus {
    outline: none;
    border-color: #2c5282;
}

#searchBtn {
    padding: 8px 16px;
    background: #2c5282;
    color: white;
    border: 1px solid #2c5282;
    cursor: pointer;
    font-size: 14px;
}

#searchBtn:hover {
    background: #2b6cb0;
}

.category-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 16px;
    flex: 1;
    justify-content: center;
}

.category-btn {
    padding: 6px 12px;
    border: 1px solid var(--category-color, #e2e8f0);
    background-color: #ffffff;
    color: var(--category-color, #4a5568);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-btn:hover {
    background-color: var(--category-color, #f7fafc);
    color: white;
    border-color: var(--category-color, #cbd5e0);
}

.category-btn.active {
    background-color: var(--category-color, #2c5282);
    color: white;
    border-color: var(--category-color, #2c5282);
}

.stats {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    font-weight: 500;
    font-size: 13px;
    color: #718096;
}

.stats #toolCount {
    color: #2c5282;
    font-size: 14px;
    font-weight: 600;
}

/* 工具网格 */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.tool-card {
    background: #ffffff;
    padding: 12px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #2c5282;
    position: relative;
    min-height: 50px;
}

.tool-card:hover {
    background-color: #f7fafc;
    border-color: #cbd5e0;
}

.tool-card-icon {
    display: none; /* 隐藏Emoji图标 */
}

.tool-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tool-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.tool-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c5282;
    margin: 0;
    flex: 1;
    line-height: 1.4;
}

.tool-card-category {
    color: var(--category-color, #718096);
    font-size: 11px;
    padding: 2px 6px;
    background-color: #f7fafc;
    border: 1px solid var(--category-color, #e2e8f0);
    margin-left: 8px;
    white-space: nowrap;
    line-height: 1.2;
}

.tool-card-body {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex: 1;
}

.tool-card-description {
    color: #718096;
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
    flex: 1;
    padding-right: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tool-card-actions {
    margin: 0;
    padding: 0;
    border: none;
}

.tool-card-link {
    color: #2c5282;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

/* 添加新工具卡片 */
.add-new-card {
    border: 2px dashed var(--light-gray);
    background: rgba(255, 255, 255, 0.7);
    border-left-color: var(--light-gray);
    cursor: pointer;
    align-items: center;
    text-align: center;
}

.add-new-card:hover {
    background: rgba(67, 97, 238, 0.05);
    border-color: var(--primary-color);
}

.add-new-card .tool-card-icon {
    color: var(--gray-color);
}

.add-new-card .tool-card-title {
    color: var(--gray-color);
}

/* 使用说明 */
.instructions {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 16px;
    margin-bottom: 16px;
}

.instructions h2 {
    margin-bottom: 16px;
    color: #2c5282;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.instructions-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.instruction-item {
    padding: 12px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    margin-bottom: 12px;
}

.instruction-item h3 {
    margin-bottom: 8px;
    color: #2c5282;
    font-size: 14px;
    font-weight: 600;
}

.instruction-item p {
    color: #4a5568;
    line-height: 1.5;
    font-size: 13px;
}

.instruction-item code {
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: var(--danger-color);
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #718096;
    font-size: 12px;
}

.footer p {
    margin-bottom: 0.5rem;
}

.footer code {
    background: var(--light-gray);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

#serverStatus {
    color: var(--success-color);
    font-weight: bold;
}

.copyright {
    margin-top: 1rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2.2rem;
    }
    
    .header .icon {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        max-width: 100%;
    }
    
    .category-filter {
        margin: 16px 0;
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 8px;
    }
    
    .category-btn {
        white-space: nowrap;
    }
    
    .instructions-content {
        grid-template-columns: 1fr;
    }
    
    .tool-card {
        height: auto;
        min-height: 50px;
    }
    
    .tool-card-body {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .tool-card-description {
        padding-right: 0;
        margin-bottom: 8px;
        -webkit-line-clamp: 3;
    }
    
    .tool-card-actions {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        padding: 2rem 1rem;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tool-card {
    animation: fadeIn 0.5s ease forwards;
}

.tool-card:nth-child(1) { animation-delay: 0.1s; }
.tool-card:nth-child(2) { animation-delay: 0.2s; }
.tool-card:nth-child(3) { animation-delay: 0.3s; }
.tool-card:nth-child(4) { animation-delay: 0.4s; }
.tool-card:nth-child(5) { animation-delay: 0.5s; }
.tool-card:nth-child(6) { animation-delay: 0.6s; }

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #121212;
        --dark-color: #e0e0e0;
        --light-gray: #2d2d2d;
        --gray-color: #a0a0a0;
    }
    
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
    
    .header, .instructions, .footer, .tool-card, .stats {
        background: rgba(30, 30, 46, 0.9);
    }
    
    .instruction-item {
        background: rgba(40, 40, 60, 0.9);
    }
    
    .add-new-card {
        background: rgba(30, 30, 46, 0.5);
    }
}