/* Tool Navigator Frontend Styles */
.tn-tool-navigator {
    max-width: 1400px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.tn-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
}

.tn-header h1 {
    font-size: 32px;
    color: #1e293b;
    margin: 0 0 10px 0;
}

.tn-header p {
    color: #64748b;
    font-size: 16px;
    margin: 0;
}

/* 控制栏 */
.tn-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.tn-categories-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.tn-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tn-child-categories {
    padding-left: 8px;
    border-left: 3px solid #3b82f6;
    margin-left: 4px;
}

.tn-pill {
    padding: 8px 18px;
    border-radius: 30px;
    background: #f1f5f9;
    border: 2px solid transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tn-pill:hover {
    background: #e2e8f0;
    color: #1e293b;
    transform: translateY(-1px);
}

.tn-pill.active {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.tn-back-btn {
    background: #3b82f6 !important;
    color: #fff !important;
    padding-left: 14px;
}

.tn-back-btn:hover {
    background: #2563eb !important;
}

/* 二级分类中的"全部"按钮样式 */
.tn-child-categories .tn-pill[data-category]:not([data-category-id]) {
    background: #e0f2fe;
    color: #3b82f6;
    border-color: #bae6fd;
}

.tn-child-categories .tn-pill[data-category]:not([data-category-id]):hover {
    background: #bae6fd;
}

.tn-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.tn-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.tn-search-wrapper .fa-search {
    position: absolute;
    left: 14px;
    color: #64748b;
    font-size: 14px;
    pointer-events: none;
}

.tn-search {
    width: 240px;
    padding: 10px 36px 10px 38px;
    border: 2px solid #e2e8f0;
    border-radius: 30px;
    font-size: 14px;
    background: #ffffff;
    color: #1e293b;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tn-search:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    width: 300px;
}

.tn-search-clear {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
    padding: 0 6px;
    display: none;
    line-height: 1;
}

.tn-search-wrapper.has-value .tn-search-clear {
    display: block;
}

.tn-view-toggle {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
}

.tn-view-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.tn-view-btn.active {
    background: #ffffff;
    color: #3b82f6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tn-stats {
    margin-bottom: 16px;
    color: #64748b;
    font-size: 14px;
}

/* 工具网格 */
.tn-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.tn-tool-card {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    position: relative;
    animation: tnFadeIn 0.4s ease forwards;
    opacity: 0;
}

.tn-tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.tn-tool-card.hidden {
    display: none !important;
}

/* FIX: 增强链接下划线移除，防止主题样式覆盖 - 使用最高优先级 */
.tn-tool-card a.tn-tool-link,
.tn-tool-card a.tn-tool-link:hover,
.tn-tool-card a.tn-tool-link:focus,
.tn-tool-card a.tn-tool-link:active,
.tn-tool-card a.tn-tool-link:visited,
body .tn-tool-card a.tn-tool-link,
body .tn-tool-card a.tn-tool-link:hover,
body .tn-tool-card a.tn-tool-link:focus,
body .tn-tool-card a.tn-tool-link:active,
body .tn-tool-card a.tn-tool-link:visited,
html body .tn-tool-card a.tn-tool-link,
html body .tn-tool-card a.tn-tool-link:hover,
html body .tn-tool-card a.tn-tool-link:focus,
html body .tn-tool-card a.tn-tool-link:active,
html body .tn-tool-card a.tn-tool-link:visited {
    display: flex;
    gap: 16px;
    padding: 24px;
    text-decoration: none !important;
    color: inherit;
    border-bottom: none !important;
    box-shadow: none !important;
    background-image: none !important;
}

.tn-tool-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    flex-shrink: 0;
}

.tn-tool-content {
    flex: 1;
    min-width: 0;
}

/* FIX: 增强标题下划线移除 - 使用最高优先级 */
.tn-tool-card a.tn-tool-link .tn-tool-title,
.tn-tool-card a.tn-tool-link:hover .tn-tool-title,
.tn-tool-card a.tn-tool-link:focus .tn-tool-title,
.tn-tool-card a.tn-tool-link:active .tn-tool-title,
body .tn-tool-card a.tn-tool-link .tn-tool-title,
body .tn-tool-card a.tn-tool-link:hover .tn-tool-title,
body .tn-tool-card a.tn-tool-link:focus .tn-tool-title,
body .tn-tool-card a.tn-tool-link:active .tn-tool-title,
html body .tn-tool-card a.tn-tool-link .tn-tool-title,
html body .tn-tool-card a.tn-tool-link:hover .tn-tool-title,
html body .tn-tool-card a.tn-tool-link:focus .tn-tool-title,
html body .tn-tool-card a.tn-tool-link:active .tn-tool-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 6px 0;
    text-decoration: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    background-image: none !important;
}

.tn-tool-desc {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tn-tool-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tn-tool-tag {
    font-size: 12px;
    background: #f1f5f9;
    color: #64748b;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.tn-tool-action {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #64748b;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
}

.tn-tool-card:hover .tn-tool-action {
    opacity: 0.6;
}

/* 列表视图 */
.tn-tools-grid[data-view="list"] {
    grid-template-columns: 1fr;
}

.tn-tools-grid[data-view="list"] .tn-tool-link {
    padding: 16px 24px;
    align-items: center;
}

.tn-tools-grid[data-view="list"] .tn-tool-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    font-size: 16px;
}

.tn-tools-grid[data-view="list"] .tn-tool-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tn-tools-grid[data-view="list"] .tn-tool-title {
    margin: 0;
    min-width: 160px;
}

.tn-tools-grid[data-view="list"] .tn-tool-desc {
    margin: 0;
    flex: 1;
    -webkit-line-clamp: 1;
}

.tn-tools-grid[data-view="list"] .tn-tool-tags {
    margin: 0;
    min-width: 140px;
    justify-content: flex-end;
}

/* 无结果 */
.tn-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.tn-no-results i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

@keyframes tnFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 响应式 */
@media (max-width: 768px) {
    .tn-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .tn-actions {
        justify-content: space-between;
    }
    .tn-tools-grid {
        grid-template-columns: 1fr;
    }
}
