/* ==========================================================
   components.css - 可复用的 UI 组件样式
   工具卡片、徽章、标签、分类标签区、错误页面等
   ========================================================== */

/* ===== 分类标签区（横向滚动） ===== */
.category-tags {
    background: white;
    border-bottom: 1px solid var(--border-light, #edf2f7);
    padding: 12px 0;
}

.category-tags-inner {
    max-width: var(--max-width, 1400px);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-tags-inner::-webkit-scrollbar {
    display: none;
}

.category-tag {
    display: inline-block;
    padding: 6px 16px;
    background: #f1f5f9;
    border-radius: 30px;
    color: #334155;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.category-tag:hover {
    background: var(--primary-color, #007bff);
    color: white;
}

/* ===== 工具卡片网格 ===== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* ===== 工具卡片 ===== */
.tool-card {
    display: flex;
    gap: 12px;
    background: white;
    border: 1px solid var(--border-light, #edf2f7);
    border-radius: 15px;
    padding: 15px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 24px -8px rgba(0,0,0,0.12);
    border-color: #cbd5e0;
}

/* 左侧内容区域（主体 + 标签） */
.tool-card-main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 卡片主体链接 */
.tool-card-main {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: opacity 0.2s;
}

.tool-card-main:hover {
    opacity: 0.85;
}

/* 图标与文字行 */
.tool-card-row {
    display: flex;
    gap: 14px;
    margin-bottom: 0;
}

.tool-card-row img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    flex-shrink: 0;
}

.tool-card-content {
    flex: 1;
    min-width: 0;
}

.tool-card-content h3 {
    margin: 0 0 6px 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-card-content .short-desc {
    margin: 0;
    font-size: 13px;
    color: #5a6a7e;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 右侧详情侧边栏 */
.tool-detail-side {
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--border-light, #edf2f7);
}

.detail-icon {
    color: #94a3b8;
    font-size: 18px;
    transition: color 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.detail-icon:hover {
    background: #f1f5f9;
    color: var(--primary-color, #007bff);
}

/* ===== 徽章（Badge） ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
    margin-left: 8px;
    vertical-align: middle;
}
.badge-simple {
    background: #d1fae5;
    color: #065f46;
}
.badge-software {
    background: #e6f0ff;
    color: #007bff;
}
.badge-online {
    background: #fff3cd;
    color: #856404;
}

/* ===== 标签（Tag） ===== */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    background: #f1f4f9;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    color: #3c4a5b;
    text-decoration: none;
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s;
    border: 1px solid transparent;
    cursor: pointer;
}

.tag:hover {
    background: var(--primary-color, #007bff);
    color: white;
    border-color: var(--primary-color, #007bff);
    transform: scale(1.02);
    max-width: none;
    overflow: visible;
    position: relative;
    z-index: 5;
}

.more-tag {
    background: #e2e8f0;
    color: #2d3a4b;
    font-weight: 600;
    border: 1px solid #d0d9e6;
}

.more-tag:hover {
    background: #cbd5e0;
    color: #1e293b;
    transform: scale(1.02);
    border-color: #a0b3c9;
}

/* ===== 错误页面样式 ===== */
.error-container {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.error-card {
    text-align: center;
    max-width: 500px;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    border: 1px solid var(--border-light, #edf2f7);
}

.error-card h1 {
    font-size: 72px;
    color: var(--primary-color, #007bff);
    margin: 0;
    line-height: 1;
}

.error-card h1 i {
    font-size: 60px;
    margin-right: 10px;
}

.error-card h2 {
    font-size: 24px;
    color: var(--text-color, #1e293b);
    margin: 20px 0 10px;
}

.error-card p {
    color: var(--text-secondary, #64748b);
    margin-bottom: 30px;
    font-size: 16px;
}

.btn-home {
    display: inline-block;
    padding: 12px 32px;
    background: var(--primary-color, #007bff);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-home:hover {
    background: var(--primary-hover, #0056b3);
}

/* ===== 分页组件 ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-link {
    display: inline-block;
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    color: var(--primary-color, #007bff);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.page-link:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.page-link.current {
    background: var(--primary-color, #007bff);
    color: white;
    border-color: var(--primary-color, #007bff);
    pointer-events: none;
}

.page-link.disabled {
    color: #94a3b8;
    background: #f1f5f9;
    border-color: var(--border-color, #e2e8f0);
    pointer-events: none;
}

.page-link.dots {
    border: none;
    background: transparent;
    color: var(--text-secondary, #64748b);
    pointer-events: none;
}

/* ===== 组件响应式 ===== */
@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
    .tool-card-row {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .tool-card {
        flex-direction: column;
        gap: 8px;
    }
    .tool-detail-side {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-light, #edf2f7);
        padding-top: 8px;
        justify-content: flex-end;
    }
}
