/* ===== Functions Page - 功能分类浏览页面 ===== */

/* Hero */
.fns-hero {
    position: relative;
    padding: 3rem 0 2rem;
    text-align: center;
    background: transparent;
}

.fns-hero .post-hero-title {
    color: var(--text-primary);
    font-size: clamp(1.8rem, 3.5vw, 2.4rem);
    font-weight: 700;
}

.fns-hero .gradient-text {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.fns-hero .hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.fns-page-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 4px;
}

.fns-page-nav-item {
    padding: 8px 24px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.fns-page-nav-item:hover {
    color: var(--primary-color);
    background: var(--rfj-color-primary-light, #fff1f1);
}

.fns-page-nav-item.active {
    background: var(--rfj-gradient-primary-hover,var(--primary-color));
    color: #fff;
    font-weight: 600;
}

/* Container */
.fns-container {
    padding-bottom: 60px;
}

.fns-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* ===== Sidebar ===== */
.fns-sidebar {
    width: 300px;
    min-width: 300px;
    position: sticky;
    top: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-normal);
}

.fns-sidebar:hover {
    box-shadow: var(--shadow-md);
}

.fns-sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.fns-sidebar-header svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

.fns-nav-wrapper {
    max-height: calc(100vh - 260px);
    overflow-y: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.fns-nav-wrapper::-webkit-scrollbar {
    width: 4px;
}

.fns-nav-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.fns-nav-wrapper::-webkit-scrollbar-thumb {
    background: var(--border-strong, #d6dde8);
    border-radius: 999px;
}

/* Nav Group */
.fns-nav-group {
    border-bottom: 1px solid var(--border-color);
}

.fns-nav-group:last-child {
    border-bottom: none;
}

/* Parent Term */
.fns-nav-parent {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    user-select: none;
}

.fns-nav-parent:hover {
    background: var(--bg-card-hover);
}

.fns-nav-parent.active {
    background: var(--rfj-color-primary-light, #fff1f1);
    border-left-color: var(--primary-color);
}

.fns-nav-icon {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fns-nav-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fns-nav-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.fns-nav-arrow {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: -4px -6px -4px 0;
    padding: 4px 6px;
    border-radius: var(--radius-md);
    transition: transform var(--transition-normal), background var(--transition-fast);
    color: var(--text-muted);
    cursor: pointer;
}

.fns-nav-arrow:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.fns-nav-parent.expanded .fns-nav-arrow {
    transform: rotate(180deg);
}

/* Children */
.fns-nav-children {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.fns-nav-child {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px 8px 46px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.fns-nav-child:hover {
    background: var(--bg-card-hover);
}

.fns-nav-child.active {
    background: var(--rfj-color-primary-light, #fff1f1);
    border-left-color: var(--primary-color);
}

.fns-nav-child .fns-nav-name {
    font-size: 13px;
    font-weight: 400;
}

/* ===== Main Content ===== */
.fns-main {
    flex: 1;
    min-width: 0;
}

.fns-main-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.fns-main-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

.fns-main-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--secondary-color);
    text-decoration: none;
    margin-left: auto;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(22, 119, 255, 0.08);
    transition: all var(--transition-fast);
}

.fns-main-link:hover {
    color: var(--primary-color);
    background: rgba(209, 25, 26, 0.08);
}

.fns-main-link svg {
    flex-shrink: 0;
}

/* Placeholder */
.fns-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-muted);
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}

.fns-placeholder svg {
    margin-bottom: 16px;
    opacity: 0.3;
    color: var(--text-muted);
}

.fns-placeholder p {
    font-size: 15px;
    margin: 0;
}

/* Loading */
.fns-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 0;
    color: var(--text-muted);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: fns-spin 0.8s linear infinite;
}

@keyframes fns-spin {
    to { transform: rotate(360deg); }
}

/* No Results */
.fns-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}

.fns-no-results svg {
    margin-bottom: 12px;
    opacity: 0.3;
    color: var(--text-muted);
}

.fns-no-results p {
    font-size: 15px;
    margin: 0;
}

/* ===== Sections ===== */
.fns-section {
    margin-bottom: 24px;
}

.fns-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.fns-section-title svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

/* Related Terms */
.fns-related-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fns-related-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.fns-related-tag:hover {
    background: var(--rfj-color-primary-light, #fff1f1);
    color: var(--primary-color);
    border-color: var(--rfj-color-primary-border, #f4c4c5);
}

.fns-related-tag svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* Knowledge */
.fns-knowledge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fns-knowledge-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--secondary-color);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.fns-knowledge-item:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.fns-knowledge-item svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* Rankings */
.fns-rankings-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.fns-ranking-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all var(--transition-normal);
}

.fns-ranking-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.fns-ranking-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff6b6b, #d1191a);
    color: #fff;
    flex-shrink: 0;
}

.fns-ranking-info {
    flex: 1;
    min-width: 0;
}

.fns-ranking-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fns-ranking-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.fns-ranking-card:hover .fns-ranking-arrow {
    color: var(--primary-color);
}

/* Software Grid */
.fns-software-title {
    justify-content: space-between;
}

.fns-software-count {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: auto;
}

.fns-software-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 16px;
}

.fns-software-grid .software-card,
.fns-software-grid .tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    transition: all var(--transition-normal);
}

.fns-software-grid .software-card:hover,
.fns-software-grid .tool-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.fns-software-grid .software-card-title {
    color: var(--text-primary);
}

.fns-software-grid .software-card-vendor,
.fns-software-grid .software-card-function-text {
    color: var(--text-secondary);
}

.fns-software-grid .software-card-brief {
    color: var(--text-muted);
}

.fns-software-grid .software-card-enquiry-btn {
    background: var(--primary-color);
    border: none;
    color: #fff;
}

/* Load More */
.fns-load-more {
    display: flex;
    justify-content: center;
    padding: 24px 0;
}

.fns-load-more-btn {
    padding: 10px 32px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
}

.fns-load-more-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.fns-load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fns-load-more-btn.loading {
    pointer-events: none;
    position: relative;
    color: transparent;
}

.fns-load-more-btn.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: fns-spin 0.8s linear infinite;
    top: 50%;
    left: 50%;
    margin-top: -9px;
    margin-left: -9px;
}

/* ===== Mobile ===== */
.fns-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
}

.fns-mobile-overlay.active {
    display: block;
}

.fns-mobile-sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: var(--bg-card);
    z-index: 999;
    transition: left var(--transition-slow);
    overflow-y: auto;
}

.fns-mobile-sidebar.active {
    left: 0;
}

.fns-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.fns-mobile-close {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.fns-mobile-close:hover {
    color: var(--text-primary);
}

.fns-mobile-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    border: none;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    z-index: 997;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
}

.fns-mobile-toggle:hover {
    transform: scale(1.1);
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .fns-layout {
        flex-direction: column;
    }

    .fns-sidebar {
        display: none;
    }

    .fns-mobile-toggle {
        display: flex;
    }

    .fns-mobile-sidebar .fns-nav-wrapper {
        max-height: none;
    }

    .fns-software-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }

    .fns-rankings-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .fns-hero {
        padding: 2rem 0 1.5rem;
    }

    .fns-hero .post-hero-title {
        font-size: 1.6rem;
    }

    .fns-page-nav {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: flex-start;
    }

    .fns-page-nav::-webkit-scrollbar {
        display: none;
    }

    .fns-page-nav-item {
        padding: 8px 16px;
        font-size: 13px;
    }

    .fns-software-grid {
        grid-template-columns: 1fr;
    }

    .fns-rankings-list {
        grid-template-columns: 1fr;
    }

    .fns-main-title {
        font-size: 18px;
    }

    .fns-mobile-toggle {
        bottom: 80px;
    }
}
