/*
 * 所有工具页面样式
 * 版本: 1.0.0
 */

/* 页面头部 */
.page-header {
    text-align: center;
    margin: 80px 0 30px; /* 进一步增加顶部边距，确保与固定导航栏有足够间距 */
}

.page-header h1 {
    font-size: 2.2em;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.page-description {
    font-size: 1.1em;
    color: var(--light-text);
    max-width: 800px;
    margin: 0 auto;
}

/* Commitly Card Wrapper */
.commitly-card-wrapper {
    margin-bottom: 20px; /* 与下方搜索框的间距 */
    display: flex;
    justify-content: center; /* 居中其内容 */
    width: 100%; /* 确保占据可用宽度 */
    max-width: 600px; /* 与搜索框的 max-width 保持一致 */
    margin-left: auto; /* 居中 */
    margin-right: auto; /* 居中 */
}

/* 调整沟通模块在 wrapper 中的样式 */
.commitly-card-wrapper .contact-card-final-touch-v2 {
    max-width: 100%; /* 确保填充父容器 */
    margin: 0; /* 移除自动边距，由 wrapper 处理 */
}

/* 工具搜索 */
.tools-search {
    margin: 30px auto; /* 自动居中 */
    display: flex;
    justify-content: center;
}

.search-container {
    display: flex;
    width: 100%;
    max-width: 600px;
    position: relative;
}

.search-container input {
    flex-grow: 1;
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 1em;
    background-color: var(--white-bg);
    color: var(--dark-text);
    transition: all 0.3s ease;
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color-light);
}

.search-container button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-container button:hover {
    background-color: var(--primary-hover);
}

.search-container button i {
    font-size: 1.2em;
}

/* 分类导航 */
.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: flex-start;
    position: sticky;
    top: 10px;
    z-index: 10;
    background-color: var(--body-bg);
    padding: 10px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.category-item {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background-color: var(--white-bg);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.category-item i {
    margin-right: 8px;
    font-size: 1.1em;
    color: var(--secondary-color);
    transition: color 0.3s ease;
}

.category-item span {
    font-size: 0.95em;
    color: var(--light-text);
    transition: color 0.3s ease;
}

.category-item:hover {
    background-color: var(--primary-color-light);
    border-color: var(--primary-color);
}

.category-item:hover i,
.category-item:hover span {
    color: var(--primary-color);
}

.category-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.category-item.active i,
.category-item.active span {
    color: white;
}

/* 工具列表 */
.tools-list {
    margin-bottom: 50px;
}

.tools-count {
    text-align: right;
    margin-bottom: 15px;
    color: var(--light-text);
    font-size: 0.9em;
}

/* 分类组 */
.category-group {
    margin-bottom: 30px;
}

.category-group-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.category-group-header i {
    font-size: 1.5em;
    color: var(--primary-color);
    margin-right: 10px;
}

.category-group-header h2 {
    font-size: 1.4em;
    color: var(--dark-text);
    margin: 0;
}



/* 工具项 */
.category-group-tools {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.tool-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: var(--white-bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}



.tool-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.tool-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--primary-color-light);
    border-radius: 8px;
    margin-right: 15px;
    flex-shrink: 0;
}

.tool-icon i {
    font-size: 1.2em;
    color: var(--primary-color);
}

.tool-info {
    flex-grow: 1;
    min-width: 0;
}

.tool-name-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: color 0.2s ease;
}

.tool-name-link:hover {
    color: var(--primary-color);
}

.tool-info h3 {
    font-size: 1.1em;
    margin: 0 0 5px;
    color: var(--dark-text);
    transition: color 0.2s ease;
}

.tool-name-link:hover h3 {
    color: var(--primary-color);
}

.tool-info p {
    font-size: 0.9em;
    color: var(--light-text);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30em;
}

.tool-actions {
    display: flex;
    align-items: center;
    margin-left: 15px;
    flex-shrink: 0;
}

.tool-source-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    background-color: #f5f5f5;
    color: #666;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.9em;
    text-decoration: none;
    white-space: nowrap;
}

.tool-source-link:hover {
    background-color: #e0e0e0;
    color: #333;
}

.tool-source-link.disabled {
    background-color: var(--border-color);
    color: var(--light-text);
    cursor: not-allowed;
    pointer-events: none;
}

.no-tools {
    text-align: center;
    padding: 40px;
    color: var(--light-text);
    font-size: 1.1em;
}

.search-category {
    display: inline-block;
    font-size: 0.85em;
    color: var(--secondary-color);
    margin-top: 5px;
}

.error-message {
    text-align: center;
    padding: 20px;
    color: #e74c3c;
}

/* 问卷链接容器 */
.survey-link-container {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(var(--primary-color-rgb), 0.1);
    border-radius: 8px;
    text-align: center;
}

.survey-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    padding: 8px 16px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.survey-button:hover {
    background-color: var(--primary-color-dark);
    transform: translateY(-2px);
}

.survey-button i {
    margin-right: 8px;
    color: white;
}

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--light-text);
}

.loading-indicator i {
    font-size: 2em;
    margin-bottom: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 1.8em;
    }

    .page-description {
        font-size: 1em;
    }

    .category-nav {
        padding: 8px;
        top: 5px;
    }

    .category-item {
        padding: 5px 10px;
        font-size: 0.85em;
    }

    .category-group-header h2 {
        font-size: 1.2em;
    }

    .tool-item {
        flex-wrap: wrap;
        padding: 10px;
    }

    .tool-info {
        width: calc(100% - 55px);
    }

    .tool-actions {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }

    .tool-source-link {
        width: 100%;
        justify-content: center;
    }
}

/* 深色模式优化 */
[data-theme="dark"] .tool-item {
    background: var(--tool-card-bg) !important;
    border-color: var(--border-color);
    color: var(--dark-text);
    box-shadow: var(--card-shadow);
}

[data-theme="dark"] .tool-item:hover {
    background: var(--tool-card-hover-bg) !important;
    border-color: var(--primary-color);
    box-shadow: var(--card-hover-shadow);
}
