/* ============================================================
 * base.css — 26下载站全站基础样式
 * 从 base.html 内联 <style> 块抽取，外部引用后浏览器缓存生效
 * ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    position: relative !important;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
}
a {
    text-decoration: none;
    color: inherit;
}

/* ========== 头部强制布局 ========== */
.header {
    background: #ffffff !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1) !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    width: 100% !important;
    display: block !important;
}
/* 第一行：Logo 和 搜索 */
.header-top {
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 70px !important;
    flex-wrap: nowrap !important;
}
.header-logo {
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
}
.header-logo img {
    height: 40px !important;
    width: auto !important;
    vertical-align: middle !important;
}
/* 搜索区域 */
.search-container {
    flex: 1 !important;
    max-width: 600px !important;
    margin: 0 30px !important;
}
.search-form {
    display: flex !important;
    align-items: center !important;
    background: #f5f7fa !important;
    border: 1px solid #e0e4e8 !important;
    border-radius: 30px !important;
    padding: 0 6px 0 20px !important;
    transition: all 0.3s ease !important;
    height: 42px !important;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05) !important;
}
.search-form:focus-within {
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(0,115,230,0.2) !important;
    border-color: #0073e6 !important;
}
.search-input {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    font-size: 15px !important;
    color: #333 !important;
    outline: none !important;
    flex: 1 !important;
    width: 100% !important;
}
.search-btn {
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 15px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #0073e6 !important;
}
.search-btn svg {
    width: 22px !important;
    height: 22px !important;
    fill: currentColor !important;
}
/* 第二行：导航栏 */
.nav-bar {
    background: #ffffff;
    border-top: 1px solid #f0f2f5;
    border-bottom: 1px solid #f0f2f5;
    width: 100%;
    display: block;
    overflow: visible;
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: block;
    height: 45px;
    overflow: visible;
}
.nav-bar .nav-menu {
    display: flex;
    align-items: center;
    gap: 25px;
    height: 100%;
    padding: 0;
    margin: 0;
    list-style: none;
}
.nav-bar .nav-menu a {
    font-size: 15px;
    color: #0073e6;
    font-weight: 500;
    transition: color 0.2s;
    text-decoration: none;
}
.nav-bar .nav-menu a:hover,
.nav-bar .nav-menu a.active {
    color: #005bb5;
    text-decoration: underline;
}

/* ========== 主容器 ========== */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    display: flex;
    gap: 30px;
}

.content {
    flex: 1;
    min-width: 600px;
}

.sidebar {
    flex: 0 0 300px;
    flex-shrink: 0;
    min-width: 0;
}

/* ========== 卡片基础 ========== */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 20px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

    .card:hover {
        transform: translateY(-3px);
        box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    }

.card-body {
    padding: 20px;
}

.card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.card p {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.card .meta {
    font-size: 13px;
    color: #999;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-block;
    background: #0073e6;
    color: #fff;
    padding: 6px 18px;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.2s;
}

    .btn:hover {
        background: #005bb5;
    }

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
}

    .pagination a, .pagination span {
        padding: 6px 14px;
        border-radius: 4px;
        background: #fff;
        border: 1px solid #ddd;
        font-size: 14px;
        color: #333;
    }

    .pagination .current {
        background: #0073e6;
        color: #fff;
        border-color: #0073e6;
    }

/* ========== 侧边栏 ========== */
.sidebar .card h4 {
    font-size: 16px;
    border-bottom: 2px solid #0073e6;
    padding-bottom: 8px;
    margin-bottom: 15px;
}

.sidebar .card {
    position: sticky;
    top: 45px;
}

.sidebar ul {
    list-style: none;
}

    .sidebar ul li a {
        display: block;
        padding: 6px 0;
        font-size: 14px;
        color: #555;
        border-bottom: 1px dashed #eee;
    }

        .sidebar ul li a:hover {
            color: #0073e6;
        }

/* ========== 热门推荐 增强样式 ========== */
.hot-rec-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.hot-rec-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    gap: 10px;
}
.hot-rec-item:last-child {
    border-bottom: none;
}
.hot-rec-rank {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    flex-shrink: 0;
    background: #ccc;
}
.hot-rec-rank.rank-1 { background: #ff6b00; }
.hot-rec-rank.rank-2 { background: #ffb800; }
.hot-rec-rank.rank-3 { background: #ffd700; }

.hot-rec-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    background: #f5f7fa;
    flex-shrink: 0;
}
.hot-rec-logo-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #e8f0fe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #0073e6;
    flex-shrink: 0;
}
.hot-rec-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.hot-rec-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;        /* 关键：防止长名字把 .hot-rec-details / .sidebar 撑开 */
    max-width: 100%;
}
.hot-rec-name.highlight {
    color: #ff6b00;
}
.hot-rec-cat {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hot-rec-btn {
    padding: 4px 12px;
    font-size: 12px;
    color: #666;
    background: #f0f2f5;
    border-radius: 12px;
    transition: background 0.2s;
    flex-shrink: 0;
}
.hot-rec-btn:hover {
    background: #e4e7eb;
    color: #333;
}

/* ========== 页脚 ========== */
.footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 13px;
    background: #fff;
    margin-top: 40px;
}

/* ========== 卡片内部水平布局 ========== */
.card-horizontal {
    display: flex;
    align-items: flex-start;
    padding: 18px;
    text-decoration: none;
    color: inherit;
}

    .card-horizontal .card-logo {
        flex-shrink: 0;
        width: 64px;
        height: 64px;
        margin-right: 18px;
        border-radius: 12px;
        object-fit: contain;
        background: #f5f7fa;
    }

    .card-horizontal .card-logo-placeholder {
        flex-shrink: 0;
        width: 64px;
        height: 64px;
        margin-right: 18px;
        border-radius: 12px;
        background: #e8f0fe;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 28px;
        color: #0073e6;
    }

    .card-horizontal .card-body-flex {
        flex: 1;
        min-width: 0;
    }

    .card-horizontal .card-title {
        font-size: 17px;
        font-weight: 600;
        color: #222;
        margin: 0 0 6px;
        line-height: 1.4;
    }

        .card-horizontal .card-title .version {
            font-size: 12px;
            font-weight: 400;
            color: #aaa;
            margin-left: 6px;
        }

    .card-horizontal .card-desc {
        font-size: 13px;
        color: #666;
        line-height: 1.6;
        margin: 0 0 10px;
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .card-horizontal .card-meta {
        font-size: 12px;
        color: #999;
        display: flex;
        flex-wrap: wrap;
        gap: 14px;
    }

/* ========== 分类导航菜单 ========== */
.nav-menu {
    display: flex;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    align-items: center;
}

.nav-menu > li {
    position: relative;
}

.nav-menu > li > a {
    display: block;
    padding: 8px 16px;
    font-size: 15px;
    color: #666;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.nav-menu > li > a:hover,
.nav-menu > li > a.active {
    color: #0073e6;
    background-color: #f0f4ff;
}

.nav-menu > li > a.active {
    font-weight: 600;
}

/* 带下拉箭头的链接 */
.dropbtn {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.dropbtn::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 5px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1024 1024' width='300' height='300'%3E%3Cpath d='M512 562.005l211.2-211.2 60.33 60.331L512 682.666l-271.53-271.53 60.33-60.33z' fill='%23999'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.5;
    transition: transform 0.3s ease;
}

.has-dropdown:hover > .dropbtn::after {
    transform: rotate(-180deg);
}

/* 下拉包裹层 - 用于容纳桥接面板 */
.dropdown-panel {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    pointer-events: none;
}

.has-dropdown:hover .dropdown-panel {
    display: block;
    pointer-events: auto;
}

/* 桥接层 — 填补父链接和下拉菜单之间的空隙，防止鼠标移动时闪烁关闭 */
.dropdown-bridge {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
}

/* 下拉面板 */
.dropdown-menu {
    position: relative;
    min-width: 200px;
    margin-top: 8px;
    padding: 6px 0;
    font-size: 14px;
    text-align: left;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-height: 480px;
    overflow-y: auto;
}

/* 面板顶部小三角箭头 */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -7px;
    left: 20px;
    width: 14px;
    height: 14px;
    background: #fff;
    transform: rotate(45deg);
    border-radius: 2px 0 0 0;
    box-shadow: -3px -3px 0 3px rgba(0, 0, 0, 0.04);
}

/* 遮罩层：防止下拉时选中底下的 iframe/元素 */
.has-dropdown > .dropdown-overlay {
    display: none;
}

.has-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-inner {
    padding: 4px 0;
}

/* 子分类条目 — 简洁竖排链接 */
.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 20px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-item:first-child {
    border-radius: 0;
}

.dropdown-item:hover {
    background: #f5f5f5;
    color: #0073e6;
}

.dropdown-item.active {
    color: #0073e6;
    font-weight: 500;
}

/* 数量徽章 */
.dropdown-item .count {
    display: inline-block;
    margin-left: 8px;
    font-size: 12px;
    color: #bbb;
    font-weight: 400;
    flex-shrink: 0;
}

.dropdown-item:hover .count {
    color: #999;
}

/* 空状态 */
.dropdown-empty {
    display: block;
    padding: 20px;
    color: #999;
    font-size: 14px;
    text-align: center;
}

/* ========== 通用卡片与间距适配 ========== */
.card-body-custom {
    padding: 24px 30px;
}

/* 详情页头部布局 */
.detail-header {
    display: flex;
    gap: 30px;
    padding: 20px 30px 24px;
}

.detail-logo {
    flex-shrink: 0;
    position: relative;
}

.detail-logo.game {
    width: 150px;
    height: 200px;
}

.detail-logo.standard {
    width: 120px;
    height: 120px;
}

/* 软件列表/首页卡片 Logo 尺寸 */
.card-logo-fixed {
    flex-shrink: 0;
    border-radius: 12px;
    background: #f5f7fa;
    object-fit: contain;
}
.card-logo-fixed.game {
    width: 60px;
    height: 80px;
    object-fit: cover;
}
.card-logo-fixed.standard {
    width: 80px;
    height: 80px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        margin: 20px auto;
        gap: 20px;
    }

    .content {
        min-width: auto;
    }

    .sidebar {
        flex: 0 0 auto;
        width: 100%;
    }

    .sidebar .card {
        position: static;
    }

    .header-top {
        flex-direction: row !important;
        height: auto !important;
        padding: 10px 15px !important;
        gap: 10px !important;
        justify-content: space-between !important;
    }
    .header-logo img {
        height: 30px !important;
    }
    .search-container {
        margin: 0 !important;
        flex: 1 !important;
        max-width: none !important;
    }
    .nav-inner {
        justify-content: flex-start !important;
        overflow-x: auto !important;
    }
    .nav-bar .nav-menu {
        gap: 15px !important;
    }
    .nav-menu > li > a {
        padding: 8px 10px !important;
    }
    .hot-rec-item {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 8px !important;
    }
    .hot-rec-details {
        min-width: 0 !important;
        flex: 1 !important;
    }
    .hot-rec-cat {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .detail-logo {
        margin: 0 auto 10px;
        width: auto !important;
        max-width: 150px;
        height: 120px; /* 设置固定高度，防止长图撑开 */
    }

    .detail-logo img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important; /* 强制裁剪填充，不再随原图高度伸缩 */
        border-radius: 12px;
    }

    .card-body-custom {
        padding: 15px;
    }

    .card-horizontal {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .card-horizontal .card-logo,
    .card-horizontal .card-logo-placeholder {
        margin-right: 0;
        margin-bottom: 15px;
    }

    .card-horizontal .card-title {
        margin-bottom: 10px;
    }

    .card-horizontal .card-meta {
        justify-content: center;
    }

    .dropdown-panel {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        z-index: 1000 !important;
        width: 100%;
    }

    .dropdown-menu {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100%;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
        background: #fff !important;
        border-radius: 0 0 8px 8px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, opacity 0.2s ease;
        padding: 0;
        margin: 0;
    }

    .has-dropdown:hover .dropdown-panel {
        display: block;
    }

    .has-dropdown:hover .dropdown-menu {
        max-height: 400px;
        padding: 4px 0;
    }

    .dropdown-bridge {
        display: none;
    }

    .dropdown-item {
        padding: 10px 16px;
    }

    .dropbtn::after {
        display: none;
    }
}

/* ========== 更多链接 ========== */
.more-link {
    display: block;
    text-align: right;
    margin-top: 10px;
    font-size: 14px;
    color: #0073e6;
}

/* 移动端适配搜索框 */
@media (max-width: 768px) {
    .search-form {
        width: 100%;
        max-width: none;
    }
}

/* ========== 轮播图 ========== */
.carousel {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.carousel-track {
    display: flex;
    transition: transform 0.5s ease;
}

.carousel-slide {
    flex: 0 0 100%;
    position: relative;
    cursor: pointer;
}

.carousel-slide img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.carousel-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 40px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff;
}

.carousel-caption h3 {
    font-size: 22px;
    margin-bottom: 6px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.carousel-caption p {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
}

.carousel-indicators {
    position: absolute;
    bottom: 15px;
    right: 40px;
    display: flex;
    gap: 8px;
}

.carousel-indicators button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: transparent;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    padding: 0;
}

.carousel-indicators button.active,
.carousel-indicators button:hover {
    background: #fff;
    transform: scale(1.2);
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.4);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.3s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-btn:hover {
    background: rgba(0,0,0,0.7);
    transition: background 0.3s;
}

.carousel-prev {
    left: 15px;
}

.carousel-next {
    right: 15px;
}

@media (max-width: 768px) {
    .carousel-slide img {
        height: 180px;
    }
    .carousel-caption {
        padding: 15px 20px;
    }
    .carousel-caption h3 {
        font-size: 16px;
    }
    .carousel-caption p {
        font-size: 12px;
    }
    .carousel-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    .carousel-indicators {
        right: 20px;
        bottom: 10px;
    }
}
