/**
 * 软件下载门户网站 - 公共样式文件
 * 
 * 色彩方案：蓝色系
 * - 主色：#1E88E5 (Material Blue 600) - 主要按钮、重要元素
 * - 辅助色：#42A5F5 (Material Blue 400) - 次要元素、悬停状态
 * - 强调色：#0D47A1 (Material Blue 900) - 标题、重点文字
 * - 背景色：#E3F2FD (Material Blue 50) - 浅蓝背景
 * 
 * 设计风格：简约时尚大气
 * 响应式断点：1200px, 992px, 768px, 576px
 */

/* ==================== CSS Reset ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    min-height: 100vh;
    min-width: 1200px;
    overflow-x: auto;
}

/* ==================== 颜色变量 ==================== */
:root {
    /* 蓝色系主色调 */
    --primary-color: #1E88E5;      /* 主色 - Material Blue 600 */
    --primary-light: #42A5F5;      /* 辅助色 - Material Blue 400 */
    --primary-dark: #0D47A1;       /* 强调色 - Material Blue 900 */
    --primary-bg: #E3F2FD;         /* 背景色 - Material Blue 50 */
    --primary-hover: #1565C0;      /* 悬停色 - Material Blue 700 */
    
    /* 功能色 */
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --danger-color: #F44336;
    --info-color: #2196F3;
    
    /* 灰度色 */
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #94a3b8;
    --gray-500: #96a0a9;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    
    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* ==================== 通用样式 ==================== */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: #aee5fe;
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* SVG 图标基础样式 */
svg {
    display: inline-block;
    vertical-align: middle;
    fill: #343a40;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ==================== 容器 ==================== */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-fluid {
    width: 100%;
    padding: 0 20px;
}

/* ==================== 栅格系统 ==================== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.col {
    flex: 1;
    padding: 0 10px;
}

/* 三栏布局 */
.col-left {
    flex: 0 0 220px;
    padding: 0 10px;
}

.col-main {
    flex: 1;
    padding: 0 10px;
    min-width: 0;
}

.col-right {
    flex: 0 0 300px;
    padding: 0 10px;
}

/* ==================== 头部样式 ==================== */
.header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* 头部隐藏状态 - 向上滑动 */
.header.is-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

/* 导航栏跟随滚动隐藏 */
.nav {
    background: white;
    border-bottom: 2px solid var(--primary-bg);
    position: sticky;
    top: 0;
    z-index: 999;
    overflow-x: auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav.is-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.header::-webkit-scrollbar {
    height: 6px;
}

.header::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

.header::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.header-top {
    background: rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    font-size: 14px;
}

.header-main {
    padding: 20px 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    min-width: fit-content;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 28px;
    font-weight: normal;
    color: white;
    flex-shrink: 0;
    white-space: nowrap;
}

.logo strong {
    font-weight: bold;
}

.logo-icon {
    width: 45px;
    height: 45px;
    background: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 32px;
    font-weight: bold;
}

/* 搜索框 */
.search-box {
    flex: 1;
    max-width: 500px;
    position: relative;
    margin-left: 180px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.search-input {
    flex: 1;
    padding: 12px 20px;
    border: none;
    outline: none;
    font-size: 15px;
}

.search-btn {
    padding: 12px 25px;
    background: var(--primary-light);
    color: white;
    font-weight: 500;
    transition: background var(--transition-fast);
}

.search-btn:hover {
    background: var(--primary-hover);
}

/* 搜索建议 */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1002;
}

.search-suggestions.active {
    display: block;
}

.suggestion-item {
    padding: 12px 20px;
    color: var(--gray-800);
    cursor: pointer;
    transition: background var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 10px;
}

.suggestion-item:hover {
    background: var(--primary-bg);
}

.suggestion-item .icon {
    color: var(--gray-500);
}

/* 用户操作区 */
.user-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    white-space: nowrap;
}

.user-link {
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: opacity var(--transition-fast);
}

.user-link:hover {
    color: white;
    opacity: 0.8;
}

/* ==================== 导航菜单 ==================== */
.nav {
    background: white;
    border-bottom: 2px solid var(--primary-bg);
    position: sticky;
    top: 0;
    z-index: 999;
    overflow-x: auto;
}

.nav::-webkit-scrollbar {
    height: 4px;
}

.nav::-webkit-scrollbar-track {
    background: var(--gray-100);
}

.nav::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

.nav-list {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    white-space: nowrap;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: block;
    padding: 15px 20px;
    color: var(--gray-800);
    font-weight: 500;
    transition: all var(--transition-fast);
    border-bottom: 3px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    background: var(--primary-bg);
    border-bottom-color: var(--primary-color);
}

/* 下拉菜单 */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 100;
}

.nav-item:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 12px 20px;
    color: var(--gray-700);
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--primary-bg);
    color: var(--primary-color);
    padding-left: 25px;
}

/* 多级菜单 */
.has-submenu {
    position: relative;
}

.has-submenu::after {
    content: '›';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
}

.submenu {
    position: absolute;
    left: 100%;
    top: 0;
    background: white;
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all var(--transition-fast);
}

.has-submenu:hover .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* ==================== 主要内容区 ==================== */
.main-content {
    padding: 30px 0;
    min-height: calc(100vh - 200px);
}

/* 三栏布局 */
.three-column-layout {
    display: flex;
    gap: 20px;
}

.sidebar-left {
    flex: 0 0 220px;
}

.content-main {
    flex: 1;
    min-width: 0;
}

.sidebar-right {
    flex: 0 0 300px;
}

/* ==================== 卡片组件 ==================== */
.card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-fast);
}

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

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-100);
}

/* ==================== 软件卡片 ==================== */
.software-card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 15px;
    transition: all var(--transition-fast);
    display: flex;
    gap: 15px;
}

.software-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.software-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background: var(--primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.software-icon img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

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

.software-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 5px;
    display: block;
}

.software-name:hover {
    color: var(--primary-color);
}

.software-desc {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.software-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 12px;
    color: var(--gray-500);
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: white;
}

.btn-secondary {
    background: var(--primary-light);
    color: white;
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-outline {
    background: transparent;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-download {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 12px 30px;
    font-size: 16px;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: white;
}

/* ==================== 标签 ==================== */
.tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: var(--primary-bg);
    color: var(--primary-color);
}

.tag-hot {
    background: #ffe0e0;
    color: #d32f2f;
}

.tag-new {
    background: #e8f5e9;
    color: #388e3c;
}

.tag-free {
    background: #fff3e0;
    color: #f57c00;
}

/* ==================== 排行榜 ==================== */
.rank-list {
    counter-reset: rank;
}

.rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-200);
    counter-increment: rank;
}

.rank-item:last-child {
    border-bottom: none;
}

.rank-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.rank-item:nth-child(1) .rank-number {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
}

.rank-item:nth-child(2) .rank-number {
    background: linear-gradient(135deg, #C0C0C0, #A8A8A8);
    color: white;
}

.rank-item:nth-child(3) .rank-number {
    background: linear-gradient(135deg, #CD7F32, #B8860B);
    color: white;
}

/* ==================== 轮播图 ==================== */
.carousel {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
}

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

.carousel-item {
    flex: 0 0 100%;
    position: relative;
}

.carousel-item img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

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

.carousel-controls {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
}

.carousel-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    pointer-events: auto;
    transition: all var(--transition-fast);
}

.carousel-btn:hover {
    background: white;
    transform: scale(1.1);
}

.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.carousel-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.carousel-indicator.active {
    background: white;
    transform: scale(1.2);
}

/* ==================== 分类导航 ==================== */
.category-nav {
    display: grid;
    /* grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); */
    gap: 15px;
}

.category-item {
    text-align: center;
    padding: 15px 10px;
    border-radius: var(--radius-md);
    background: var(--gray-100);
    transition: all var(--transition-fast);
}

.category-item:hover {
    background: var(--primary-bg);
    transform: translateY(-3px);
}

.category-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    border-radius: var(--radius-md);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--primary-color);
}

.category-name {
    font-size: 14px;
    color: var(--gray-700);
    font-weight: 500;
}

/* ==================== 页脚 ==================== */
.footer {
    background: var(--gray-800);
    color: #9ba5b2;
    padding: 30px 0 20px;
    /* margin-top: 50px; */
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    color: white;
    font-size: 16px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.footer-links a {
    display: block;
    color: var(--gray-400);
    padding: 8px 0;
    transition: all var(--transition-fast);
}

.footer-links a:hover {
    color: white;
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    /* padding-top: 30px;
    border-top: 1px solid var(--gray-700); */
    font-size: 13px;
    line-height: 1.8;
    font-weight: 400;
}

/* Footer 中的超链接样式 */
.footer-bottom a {
    color: #9ba5b2;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-bottom a:hover {
    color: rgb(194, 194, 194);
    text-decoration: none;
}

/* ==================== 返回顶部按钮 ==================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 50%;
    font-size: 14px;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.back-to-top svg {
    transition: transform 0.3s ease;
}

.back-to-top:hover svg {
    transform: translateY(-3px);
}

/* 返回顶部按钮 - 移动端适配 */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
}

/* ==================== 工具类 ==================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.p-10 { padding: 10px; }
.p-20 { padding: 20px; }
.p-30 { padding: 30px; }

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }

.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* ==================== 懒加载占位 ==================== */
.lazy-image {
    background: var(--gray-200);
    position: relative;
}

.lazy-image::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-300);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.lazy-image.loaded::before {
    display: none;
}



/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-200);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ==================== 图片预览模态框 ==================== */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.image-preview-modal.active {
    display: flex;
}

.image-preview-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.image-preview-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.image-preview-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-800);
}

.image-preview-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-800);
}

.image-preview-prev {
    left: -70px;
}

.image-preview-next {
    right: -70px;
}

/* ==================== 加载动画 ==================== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-300);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-in {
    animation: slideIn 0.4s ease;
}
