/**
 * ========================================
 * 下载中心页面样式表
 * ========================================
 */

/* ========================================
   1. 桌面端侧边栏样式
   ======================================== */
@media (min-width: 992px) {
    /* 侧边栏固定定位 - 使用sticky实现智能固定 */
    .sidebar-sticky,
    .atf-sidebar-widget {
        position: sticky !important;
        top: 100px; /* 距离顶部的固定距离 */
        max-height: calc(100vh - 120px); /* 确保内容可滚动 */
        overflow-y: auto;
    }

    /* Firefox滚动条样式 */
    .sidebar-sticky,
    .atf-sidebar-widget {
        scrollbar-width: thin;
        scrollbar-color: var(--thm-ase) var(--thm-f3);
    }

    /* 确保父容器不影响sticky定位 */
    .desktop-sidebar,
    .sidebar-sticky-wrapper {
        position: static !important;
        height: auto !important;
    }
}

/* ========================================
   2. 移动端导航样式
   ======================================== */
@media (max-width: 991px) {
    /* 移动端导航容器 - 固定在顶部 */
    .mobile-nav-container {
        background: var(--color-white, #fff);
        border-bottom: 2px solid var(--thm-f3, #f3f3f3);
        position: sticky;
        top: 48px;
        z-index: 100;
        margin: -15px -15px 20px -15px;
        padding: 0;
        box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    /* 导航包装器 - 支持横向滚动 */
    .mobile-nav-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox隐藏滚动条 */
        -ms-overflow-style: none; /* IE和Edge隐藏滚动条 */
        padding: 0 15px;
    }

    /* Safari/Chrome/WebKit 隐藏滚动条 */
    .mobile-nav-wrapper::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }


    /* 导航列表 */
    .mobile-nav-list {
        display: flex;
        flex-wrap: nowrap;
        padding: 12px 0;
        margin: 0;
        list-style: none;
        gap: 8px;
        min-width: min-content;
    }

    /* 导航项 */
    .mobile-nav-item {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    /* 导航按钮样式 */
    .mobile-nav-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 12px 16px;
        border: 1px solid var(--thm-f3, #f3f3f3);
        border-radius: 12px;
        background: var(--color-white, #fff);
        color: var(--thm-gray, #8e8e8e);
        text-decoration: none;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        min-width: 85px;
        cursor: pointer;
        position: relative;
        overflow: hidden;
    }

    /* 导航按钮图标 */
    .mobile-nav-btn i {
        font-size: 1.5rem;
        margin-bottom: 6px;
        transition: transform 0.3s ease;
    }

    /* 导航按钮文字 */
    .mobile-nav-btn span {
        font-size: 12px;
        font-weight: 500;
        letter-spacing: 0.02em;
    }

    /* 激活状态背景动画 */
    .mobile-nav-btn::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: var(--thm-line);
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: -1;
    }

    /* 激活状态样式 */
    .mobile-nav-btn.active::before,
    .mobile-nav-btn:active::before {
        transform: translateY(0);
    }

    .mobile-nav-btn.active,
    .mobile-nav-btn:active {
        color: var(--color-white, #fff);
        border-color: transparent;
        transform: scale(0.95);
    }

    .mobile-nav-btn.active i {
        transform: scale(1.1);
    }

    /* 点击波纹效果 */
    .mobile-nav-btn:active::after {
        content: '';
        position: absolute;
        width: 100%;
        height: 100%;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.5);
        transform: scale(0);
        animation: ripple 0.6s ease-out;
    }

    /* 移动端布局调整 */
    .desktop-sidebar {
        display: none !important;
    }

    .mobile-content {
        width: 100%;
        padding: 0;
    }

    /* 移动端侧边栏取消固定 */
    .atf-sidebar-widget,
    .sidebar-sticky {
        position: static !important;
        margin-bottom: var(--thm-p);
    }
}

/* ========================================
   3. 通用组件样式
   ======================================== */

/* 侧边栏卡片容器 */
.atf-widget {
    background: var(--color-white, #fff);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.atf-widget:hover {
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

/* 侧边栏标题 */
.atf-widget-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--thm-black, #14296C);
    margin-bottom: 20px;
    padding-bottom: 12px;
    position: relative;
}

/* 标题下划线动画 */
.atf-widget-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--thm-line);
    transition: width 0.3s ease;
}

.atf-widget:hover .atf-widget-title::after {
    width: 100%;
}

/* 列表组样式 */
.atf-sidebar-widget .list-group {
    border: none;
}

.atf-sidebar-widget .list-group-item {
    border: none;
    padding: 14px 18px;
    margin-bottom: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    background: var(--thm-f6, #F1F8FF);
    position: relative;
    overflow: hidden;
}

/* 列表项图标容器 */
.atf-sidebar-widget .list-group-item span {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--color-white, #fff);
    transition: all 0.3s ease;
}

/* 列表项悬停效果 */
.atf-sidebar-widget .list-group-item:hover {
    background: var(--thm-f3, #f3f3f3);
    transform: translateX(8px);
}

.atf-sidebar-widget .list-group-item:hover span {
    transform: rotate(10deg) scale(1.1);
}

/* 列表项激活状态 */
.atf-sidebar-widget .list-group-item.active {
    background: var(--thm-line);
    color: var(--color-white, #fff);
    font-weight: 500;
}

.atf-sidebar-widget .list-group-item.active span {
    background: rgba(255, 255, 255, 0.2);
    color: var(--color-white, #fff);
}

/* 列表项点击动画 */
.atf-sidebar-widget .list-group-item:active {
    transform: scale(0.98);
}

/* ========================================
   4. 内容区域样式
   ======================================== */

/* Tab内容容器 */
.tab-content {
    background: var(--color-white, #fff);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.08);
    min-height: 500px;
    animation: fadeIn 0.5s ease;
}

/* Tab面板切换动画 */
.tab-pane {
    animation: slideIn 0.3s ease;
}

/* 下载按钮样式 */
.atf-themes-btn {
    background: var(--thm-line);
    color: var(--color-white, #fff);
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    text-align: center;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    font-size: 14px;
}

/* 下载按钮悬停背景动画 */
.atf-themes-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.atf-themes-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(31, 114, 195, 0.4);
    color: var(--color-white, #fff);
}

.atf-themes-btn:hover::before {
    width: 300px;
    height: 300px;
}

/* ========================================
   5. 动画定义
   ======================================== */

/* 淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 滑入动画 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 波纹动画 */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ========================================
   6. 响应式断点优化
   ======================================== */

/* 平板设备 */
@media (max-width: 768px) {
    .atf-section-padding {
        padding: 40px 0;
    }

    .atf-widget {
        padding: 15px;
    }

    .atf-widget-title {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .mobile-nav-btn {
        min-width: 75px;
        padding: 10px 12px;
    }

    .mobile-nav-btn i {
        font-size: 1.3rem;
    }

    .mobile-nav-btn span {
        font-size: 11px;
    }

    .tab-content {
        padding: 20px 15px;
        min-height: 400px;
    }
}

/* 手机设备 */
@media (max-width: 576px) {
    .mobile-nav-container {
        margin: -10px -10px 15px -10px;
    }

    .mobile-nav-list {
        gap: 5px;
        padding: 10px 0;
    }

    .tab-content {
        padding: 15px;
        border-radius: 10px;
    }
}

/* ========================================
   7. 打印样式
   ======================================== */
@media print {
    .mobile-nav-container,
    .desktop-sidebar {
        display: none !important;
    }

    .mobile-content,
    .col-lg-9 {
        width: 100% !important;
    }

    .tab-pane {
        display: block !important;
        opacity: 1 !important;
    }
}

/* ========================================
   8. 页面特定样式（从 extraStyles 迁移）
   ======================================== */

/* 桌面应用图标间距 */
.list-group-item > i {
    margin-right: 0.5em;
}

/* 列表组游标样式 */
.list-group {
    cursor: pointer;
}

/* 软件下载条目布局 */
.list-group-item.text-xxl-start {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
}

/* 软件图标尺寸 - 兼容 picture 标签和 img 标签 */
.list-group-item.text-xxl-start > img,
.list-group-item.text-xxl-start > picture {
    width: 60px;
    height: auto;
    margin-right: 1em;
    display: block;
}

/* picture 标签内的 img 继承样式 */
.list-group-item.text-xxl-start > picture img {
    width: 60px;
    height: auto;
    display: block;
}

/* 软件描述文本 */
.list-group-item.text-xxl-start > div > p {
    line-height: inherit;
}

/* 下载按钮布局 */
.list-group-item.col-lg-3.col-4 {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ========================================
   9. 工具类
   ======================================== */

/* 区域内边距 */
.atf-section-padding {
    padding: 60px 0;
}

/* 顶部边距工具类 */
.mt-4 {
    margin-top: 1.5rem !important;
}

/* ============================================================
   V2 Download Page Overrides
   说明：
   - 下载中心统一侧边栏、移动导航和内容区卡片视觉。
   ============================================================ */

.mobile-nav-container,
.atf-widget,
.tab-content {
    background: var(--v2-bg-primary);
    border: 1px solid var(--v2-bg-divider);
    border-radius: 8px;
    box-shadow: var(--v2-shadow-card);
}

.atf-sidebar-widget .atf-widget-title {
    font-size: 20px;
    line-height: 28px;
    font-weight: 500;
    color: var(--v2-text-heading);
}

.tab-content > .tab-pane > .atf-widget-title {
    font-size: 24px;
    line-height: 32px;
    font-weight: 500;
    color: var(--v2-text-heading);
}

.tab-content .list-group-item h4.fs-6 {
    font-size: 20px !important;
    line-height: 28px;
    font-weight: 500;
    color: var(--v2-text-heading);
    margin-bottom: 8px;
}

.tab-content .list-group-item p {
    font-size: 16px;
    line-height: 24px;
    color: var(--v2-text-body);
}

.mobile-nav-btn {
    border-radius: 8px;
    border-color: var(--v2-bg-divider);
    color: var(--v2-text-secondary);
}

.atf-sidebar-widget .list-group-item {
    border-radius: 8px;
}

.mobile-nav-btn::before,
.atf-widget-title::after {
    background: var(--v2-primary-500);
}

.mobile-nav-btn.active,
.mobile-nav-btn:active {
    color: var(--v2-text-inverse);
}

.atf-sidebar-widget .list-group-item.active,
.atf-themes-btn {
    background: var(--v2-primary-500);
    border-radius: var(--v2-radius-button-pill, 22px);
}

@media (max-width: 768px) {
    .atf-sidebar-widget .atf-widget-title,
    .tab-content > .tab-pane > .atf-widget-title {
        font-size: 20px;
        line-height: 28px;
    }

    .tab-content .list-group-item h4.fs-6 {
        font-size: 20px !important;
        line-height: 28px;
    }
}

@media (min-width: 992px) {
    .atf-sidebar-widget {
        padding: 18px;
    }

    .atf-sidebar-widget .atf-widget-title {
        font-size: 18px;
        line-height: 24px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }

    .atf-sidebar-widget .atf-widget-title.mt-4 {
        margin-top: 18px !important;
    }

    .atf-sidebar-widget .list-group-item {
        min-height: 42px;
        padding: 8px 12px;
        margin-bottom: 6px;
    }

    .atf-sidebar-widget .list-group-item span {
        width: 28px;
        height: 28px;
        margin-right: 10px;
    }
}
