/* 全局基础 */
body {
    padding-top: 80px;
    background-color: #f4f6f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 导航栏扁平化 */
.navbar-inverse {
    background-color: #fff;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: none;
    height: 70px;
}

.navbar-inverse .navbar-nav > li > a {
    color: #4b5563;
    font-weight: 500;
    padding: 0 20px;
    height: 70px;
    display: flex;
    align-items: center;
    font-size: 15px;
    transition: all 0.2s;
}

.navbar-inverse .navbar-nav > .active > a, 
.navbar-inverse .navbar-nav > .active > a:hover, 
.navbar-inverse .navbar-nav > .active > a:focus,
.navbar-inverse .navbar-nav > .open > a,
.navbar-inverse .navbar-nav > .open > a:hover,
.navbar-inverse .navbar-nav > .open > a:focus {
    background-color: transparent !important;
    color: #2563eb !important;
    position: relative;
}

.navbar-inverse .navbar-nav > li > a:hover,
.navbar-inverse .navbar-nav > li > a:focus {
    color: #2563eb;
    background-color: transparent;
}

.navbar-inverse .navbar-nav > .active > a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: #2563eb;
}

.navbar-inverse .navbar-brand {
    color: #2563eb;
    font-size: 24px;
    font-weight: 800;
    padding: 25px 15px;
}

/* 导航栏搜索框样式优化 */
.navbar-inverse .navbar-form {
    padding: 18px 0;
    margin-top: 0;
    margin-bottom: 0;
    border: none;
    box-shadow: none;
    display: flex;
    align-items: center;
}

.navbar-inverse .navbar-form .form-group {
    display: flex;
    align-items: center;
}

.navbar-inverse .navbar-form .form-control {
    border-radius: 4px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    width: 240px;
    box-shadow: none;
    padding-left: 15px;
    color: #334155;
    height: 34px;
}

.navbar-inverse .navbar-form .form-control:focus {
    background: #fff;
    border-color: #3b82f6;
}

.navbar-inverse .navbar-form .btn {
    border-radius: 4px;
    background: #3b82f6;
    color: #fff;
    border: none;
    padding: 0 20px;
    margin-left: 10px;
    height: 34px;
    line-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.navbar-inverse .navbar-form .btn:hover {
    background: #2563eb;
}

.avatar-img {
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-top: -3px;
}

/* 导航栏样式覆盖 */
.navbar-inverse .navbar-brand:hover,
.navbar-inverse .navbar-brand:focus {
    color: #9d9d9d !important;
    background-color: transparent !important;
}

/* 强制覆盖所有可能的冲突，确保 active 状态生效 */
.navbar-inverse .navbar-nav > li.active > a, 
.navbar-inverse .navbar-nav > li.active > a:hover, 
.navbar-inverse .navbar-nav > li.active > a:focus {
    color: #2563eb !important;
    background-color: transparent !important;
    font-weight: bold;
}

/* 轮播图 */
#carousel-generic .carousel-inner {
    border-radius: 4px;
    overflow: hidden;
    border: none;
    height: 350px;
}

#carousel-recommend .carousel-inner {
    height: auto;
    overflow: hidden;
}

.carousel-inner > .item {
    height: 100%;
    width: 100%;
}

.carousel-inner > .item > a {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
}

.carousel-inner .item img { 
    display: block;
    width: 100% !important; 
    height: 100% !important; 
    max-width: none;
    object-fit: cover;
    object-position: center center;
}

.carousel-caption {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    padding: 40px 20px 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    transform: none;
    border-radius: 0 0 4px 4px;
}

.carousel-caption h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
    color: #fff;
    letter-spacing: 1px;
}

/* 标题栏 */
.section-header {
    margin: 0 0 25px;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding-left: 15px;
}

.main-content {
    margin-top: 30px;
}

.section-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    bottom: 5px;
    width: 4px;
    background: #2563eb;
    border-radius: 0;
}

.section-header h3 {
    margin: 0;
    color: #1e293b;
    font-weight: 700;
    font-size: 20px;
}

.section-header a {
    color: #64748b;
    font-size: 14px;
    text-decoration: none;
}

.section-header a:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* 推荐软件轮播控制 */
.carousel-controls {
    display: flex;
    gap: 10px;
}

.carousel-control-custom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s;
}

.carousel-control-custom:hover {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #fff !important;
}

.carousel-control-custom:hover i {
    color: #fff !important;
}

/* 修复推荐轮播截断问题 */
#carousel-recommend .item {
    padding: 10px 5px;
}

/* 软件卡片 */

.soft-card {
    background: #fff;
    border: none;
    border-radius: 4px;
    padding: 25px 20px;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    box-shadow: none;
    position: relative;
    /* overflow: hidden; */
}

/* 三角标样式 */
.ribbon {
    position: absolute;
    right: -5px; 
    top: -5px;
    z-index: 1;
    overflow: hidden;
    width: 75px; 
    height: 75px; 
    text-align: right;
}

.ribbon span {
    font-size: 10px;
    font-weight: bold;
    color: #FFF;
    text-transform: uppercase;
    text-align: center;
    line-height: 20px;
    transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    width: 100px;
    display: block;
    background: #2563eb;
    position: absolute;
    top: 19px; 
    right: -21px;
}

.ribbon span::before {
    content: "";
    position: absolute; left: 0px; top: 100%;
    z-index: -1;
    border-left: 3px solid #1e5799;
    border-right: 3px solid transparent;
    border-bottom: 3px solid transparent;
    border-top: 3px solid #1e5799;
}

.ribbon span::after {
    content: "";
    position: absolute; right: 0px; top: 100%;
    z-index: -1;
    border-left: 3px solid transparent;
    border-right: 3px solid #1e5799;
    border-bottom: 3px solid transparent;
    border-top: 3px solid #1e5799;
}

.soft-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-5px);
}

.soft-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 15px;
    display: block;
    border-radius: 4px;
    border: none;
}

.soft-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.soft-desc {
    color: #64748b;
    font-size: 13px;
    height: 40px;
    overflow: hidden;
    margin-bottom: 15px;
    text-align: center;
    line-height: 1.5;
}

.soft-meta {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 15px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}

.btn-download {
    width: 100%;
    border-radius: 4px;
    background: #f1f5f9;
    color: #475569;
    border: none;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-download:hover {
    background: #3b82f6;
    color: #fff;
}

/* 列表样式 */
.list-group-item {
    border: none;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 0;
    padding: 15px 20px;
    border-radius: 0;
}

.list-group-item:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.list-group-item:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    border-bottom: none;
}

.list-group {
    box-shadow: none;
    border: none;
    border-radius: 4px;
    background: #fff;
}

.list-title {
    font-size: 15px;
    font-weight: 500;
    color: #334155;
}

.list-desc {
    font-size: 13px;
    color: #94a3b8;
}

.loading-more {
    display: none;
    padding: 20px;
}

/* 侧边栏吸附与布局 */
@media (min-width: 992px) {
    .row-flex {
        display: flex;
    }
    
    .sidebar-wrapper {
        position: -webkit-sticky;
        position: sticky;
        top: 90px;
    }
}

.panel {
    border: none;
    box-shadow: none;
    border-radius: 4px;
    margin-bottom: 30px;
}

.panel-heading {
    background-color: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    padding: 15px 20px;
    color: #334155;
}

.panel-title {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-body {
    padding: 0;
}

/* 装机必备 */
.essentials-body {
    padding: 15px;
}

.soft-item {
    margin-bottom: 15px;
}

.soft-link {
    display: block;
    color: #333;
    text-decoration: none;
}

.soft-mini-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 5px;
}

.soft-mini-name {
    font-size: 12px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* 排行榜 */
.rank-list .list-group-item {
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rank-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.rank-num {
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 2px;
    margin-right: 12px;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.rank-list .list-group-item:nth-child(1) .rank-num { background: #ef4444; color: #fff; }
.rank-list .list-group-item:nth-child(2) .rank-num { background: #f97316; color: #fff; }
.rank-list .list-group-item:nth-child(3) .rank-num { background: #f59e0b; color: #fff; }

.rank-title {
    color: #475569;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 10px;
}

.rank-count {
    flex-shrink: 0;
    color: #94a3b8;
    font-size: 12px;
}

/* 页脚 */
.footer {
    background: #2d3748;
    padding: 60px 0 30px;
    margin-top: 60px;
    border-top: none;
    font-size: 14px;
    color: #cbd5e1;
}

.footer-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 25px;
    position: relative;
    padding-bottom: 15px;
}

.footer-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 30px;
    height: 2px;
    background: #3b82f6;
}

.footer .text-muted {
    color: #94a3b8;
    line-height: 1.8;
    margin-bottom: 10px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    margin-left: -5px;
    margin-right: -5px;
}

.footer-links li {
    float: none;
    width: auto;
    padding: 0 5px;
    margin-bottom: 12px;
    margin-right: 15px;
}

.footer-links a {
    color: #94a3b8;
    transition: all 0.2s;
    display: inline-block;
}

.footer-links a:hover {
    color: #fff;
    text-decoration: none;
    padding-left: 0;
    transform: translateY(-2px);
}

.footer-qrcode img {
    width: 110px;
    height: 110px;
    border-radius: 4px;
    background: #fff;
    padding: 5px;
}

.footer-copyright {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #374151;
}

.footer-copyright p {
    margin-bottom: 5px;
    color: #64748b;
    font-size: 13px;
}

.footer-copyright a {
    color: #64748b;
}

.footer-copyright a:hover {
    color: #94a3b8;
}

/* 客服微信二维码放大效果 */
.qrcode-wrapper {
    position: relative;
    display: inline-block;
}

.qrcode-wrapper .qrcode-small {
    cursor: pointer;
}

.qrcode-popup {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 12px;
    background: #fff;
    padding: 5px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1050;
    width: 180px;
    height: 180px;
}

/* 小三角箭头 */
.qrcode-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
}

/* 覆写内部图片样式，确保放大显示 */
.footer-qrcode .qrcode-popup img {
    width: 100%;
    height: 100%;
    padding: 0;
    border-radius: 2px;
    background: transparent;
}

/* 鼠标悬停显示 */
.qrcode-wrapper:hover .qrcode-popup {
    display: block;
    animation: qrcodeFadeIn 0.3s ease;
}

@keyframes qrcodeFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, 10px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* =========================================
   移动端响应式适配
   ========================================= */
@media (max-width: 768px) {
    /* 1. 基础布局调整 */
    body {
        padding-top: 60px; /* 减小顶部留白 */
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* 2. 导航栏适配 */
    .navbar-inverse {
        height: auto; /* 允许高度自适应 */
        min-height: 50px;
        padding-bottom: 5px;
    }

    .navbar-header {
        height: 60px; /* 头部高度 */
    }

    .navbar-toggle {
        margin-top: 13px;
        margin-right: 15px;
        border: none;
    }
    
    /* 修复汉堡菜单在白色背景下不可见的问题 */
    .navbar-inverse .navbar-toggle .icon-bar {
        background-color: #334155;
    }
    
    .navbar-toggle:hover, 
    .navbar-toggle:focus {
        background-color: transparent !important;
    }

    .navbar-inverse .navbar-brand {
        padding: 15px;
        font-size: 20px;
        height: 60px;
        line-height: 30px;
    }

    .navbar-collapse {
        border-top: 1px solid #f1f5f9;
        box-shadow: none;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        background: #fff;
    }

    .navbar-inverse .navbar-nav {
        margin: 0;
        padding: 10px 0;
    }

    .navbar-inverse .navbar-nav > li > a {
        height: 45px;
        line-height: 45px;
        padding: 0 20px;
        display: block;
        width: 100%;
    }
    
    .navbar-inverse .navbar-nav > .active > a::after {
        display: none; /* 移动端隐藏下划线 */
    }
    
    /* 移动端搜索框 */
    .navbar-inverse .navbar-form {
        border: none;
        margin: 0;
        padding: 10px 20px 20px;
        display: block;
        box-shadow: none;
    }
    
    .navbar-inverse .navbar-form .form-group {
        display: flex;
        margin-bottom: 0;
    }
    
    .navbar-inverse .navbar-form .form-control {
        width: 100%;
        height: 40px;
    }
    
    .navbar-inverse .navbar-form .btn {
        height: 40px;
    }

    /* 3. 轮播图适配 */
    #carousel-generic {
        margin-top: 15px;
    }

    #carousel-generic .carousel-inner {
        height: 200px;
    }
    
    .carousel-caption {
        padding: 10px;
        bottom: 0;
    }
    
    .carousel-caption h3 {
        font-size: 16px;
        margin-bottom: 5px;
    }

    /* 4. 版块标题适配 */
    .main-content {
        margin-top: 20px;
    }
    
    .section-header {
        margin-bottom: 20px;
        padding-right: 0;
    }
    
    .section-header h3 {
        font-size: 18px;
    }

    /* 5. 软件卡片适配 */
    .col-xs-6 {
        width: 50%; /* 确保在极小屏幕也是两列，如果希望如此 */
    }
    
    .soft-card {
        padding: 15px 10px;
        margin-bottom: 15px;
    }
    
    .ribbon {
        width: 50px;
        height: 50px;
    }

    .ribbon span {
        width: 70px;
        top: 10px;
        right: -15px;
        line-height: 16px;
        font-size: 8px;
    }

    .soft-icon {
        width: 56px;
        height: 56px;
        margin-bottom: 10px;
    }
    
    .soft-title {
        font-size: 14px;
    }
    
    .soft-desc {
        font-size: 12px;
        height: 36px;
        -webkit-line-clamp: 2;
    }
    
    /* 6. 侧边栏适配 */
    .sidebar-wrapper {
        position: static;
        margin-top: 30px;
    }

    /* 7. 页脚适配 */
    .footer {
        padding: 40px 0 20px;
        text-align: center;
    }
    
    .footer .col-md-4 {
        margin-bottom: 40px;
    }
    
    .footer-title::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .footer-links {
        justify-content: center;
    }
    
    .footer .text-right {
        text-align: center;
    }
    
    .qrcode-wrapper {
        margin: 0 auto;
    }
    
    .qrcode-popup {
        left: 50%;
        transform: translateX(-50%);
        bottom: 110%; /* 稍微抬高 */
    }
}

/* 移动端导航栏深度优化 */
@media (max-width: 768px) {
    /* 1. 头部 Flex 布局（确保垂直居中） */
    .navbar-header {
        display: flex;
        align-items: center;
        padding-right: 15px;
        position: relative;
        height: 60px; /* 强制头部高度 */
    }
    
    /* Logo: 靠左，自动占据剩余空间 */
    .navbar-brand {
        float: none;
        margin-right: auto;
        order: 1;
        padding: 0 15px;
        height: 60px;
        line-height: 60px; /* 文字垂直居中 */
        display: block;
    }
    
    /* 用户信息区: 居中 */
    .mobile-user-info {
        float: none;
        margin: 0;
        padding: 0;
        order: 2;
        height: 100%;
        display: flex;
        align-items: center; /* 关键：Flex 垂直居中 */
    }
    
    /* 头像链接容器 */
    .mobile-avatar-link {
        position: relative;
        display: block;
        padding: 0 10px;
        height: 32px; /* 限制点击区域高度为头像高度，或更优 */
        line-height: 1;
    }
    
    /* 用户头像 */
    .mobile-user-info .user-avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        border: 1px solid #e2e8f0;
        object-fit: cover;
        display: block;
    }
    
    /* 登录链接 */
    .mobile-login-link {
        color: #334155;
        font-weight: 500;
        text-decoration: none;
        padding: 5px 12px;
        font-size: 14px;
        display: block;
        border-radius: 4px;
        background: rgba(0,0,0,0.03); /* 增加一点背景增强点击感 */
    }
    
    /* VIP 小红点 */
    .vip-dot {
        position: absolute;
        bottom: 0;
        right: 8px;
        width: 10px;
        height: 10px;
        background: #f59e0b;
        border: 2px solid #fff;
        border-radius: 50%;
    }

    /* 菜单按钮: 靠右 */
    .navbar-toggle {
        float: none;
        margin: 0 0 0 10px;
        order: 3;
        display: block;
        position: relative; /* 恢复定位以免被吞 */
        padding: 9px 10px;
    }
    
    /* 2. 搜索框优化 */
    .navbar-inverse .navbar-form {
        display: flex;
        padding: 10px 15px;
        align-items: center;
        border-top: 1px solid #f1f5f9;
        margin: 0;
    }
    .navbar-inverse .navbar-form .form-group {
        flex: 1;
        margin-right: 10px;
        margin-bottom: 0;
    }
    .navbar-inverse .navbar-form .form-control {
        width: 100% !important;
    }
    .navbar-inverse .navbar-form .btn {
        margin-left: 0;
        flex-shrink: 0;
    }
    
    /* 3. 下拉菜单内用户信息 */
    .mobile-menu-options {
        border-top: 1px solid #f1f5f9;
        margin: 10px 0 0;
        padding: 10px 0;
        background: #f8fafc;
    }
    
    .dropdown-header {
        padding: 10px 20px;
        font-size: 14px;
        color: #64748b;
        font-weight: 600;
    }
}

/* 移动端菜单用户信息卡片样式 */
@media (max-width: 768px) {
    /* 修正导航栏头部，移除之前添加的用户信息相关占位 */
    .navbar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-right: 15px;
        position: relative;
        height: 60px;
    }
    
    .navbar-brand {
        float: none;
        margin-right: auto;
        padding: 0 15px;
        height: 60px;
        line-height: 60px;
        display: block;
        order: 1;
    }
    
    .navbar-toggle {
        float: none;
        margin: 0;
        display: block;
        position: relative;
        padding: 9px 10px;
        order: 2;
    }
    
    /* 移除旧的 mobile-user-info 相关样式（通过覆盖或忽略） */
    .mobile-user-info { display: none !important; }

    /* 侧边菜单用户信息卡片 */
    .mobile-menu-options {
        padding: 15px;
        background: #f8fafc;
        border-bottom: 1px solid #e2e8f0;
        margin: 0;
    }
    
    .profile-card {
        display: flex;
        align-items: center;
        background: #fff;
        padding: 15px;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    
    .profile-avatar {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        object-fit: cover;
        margin-right: 15px;
        border: 2px solid #fff;
        box-shadow: 0 0 0 1px #e2e8f0;
    }
    
    .profile-info {
        flex: 1;
    }
    
    .profile-name {
        font-size: 16px;
        font-weight: 600;
        color: #1e293b;
        margin-bottom: 5px;
        display: flex;
        align-items: center;
    }
    
    .vip-badge-small {
        background: #f59e0b;
        color: #fff;
        font-size: 10px;
        padding: 1px 5px;
        border-radius: 3px;
        margin-left: 8px;
        font-weight: normal;
        vertical-align: middle;
    }
    
    .profile-action {
        font-size: 13px;
        color: #64748b;
    }
    
    .profile-action a {
        color: #64748b;
        text-decoration: none;
        display: inline-block; /* 确保可点击 */
        padding: 2px 0;
    }
    
    .profile-action .divider {
        margin: 0 8px;
        color: #cbd5e1;
    }
    
    /* 未登录状态按钮 */
    .user-auth-buttons {
        display: flex;
        gap: 10px;
        padding: 15px;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    
    .user-auth-buttons .btn {
        flex: 1;
        border-radius: 4px;
        height: 36px;
        line-height: 24px; /* (36 - 10 - 2) */
        font-weight: 500;
    }
    
    .btn-login {
        background-color: #3b82f6;
        border-color: #3b82f6;
        color: #fff;
    }
    
    .btn-register {
        background-color: #fff;
        border-color: #cbd5e1;
        color: #475569;
    }
}
