/*
Theme Name: ONWAY Download Center
Theme URI: https://www.onwaytech.com
Author: 深圳市昂纬科技开发有限公司
Author URI: https://www.onwaytech.com
Description: 昂纬科技资料下载中心 WordPress 主题，支持自定义文章类型、分类筛选、搜索、下载计数功能。
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: onway-download
Tags: custom-post-type, download, technology, chinese
*/

/* ==========================================
   CSS 变量
   ========================================== */
:root {
    --primary: #0066cc;
    --primary-dark: #0052a3;
    --primary-light: #e6f0ff;
    --accent: #00b4d8;
    --bg-dark: #0a1628;
    --bg-light: #f5f7fa;
    --text-dark: #1a1a2e;
    --text-light: #6b7280;
    --white: #ffffff;
    --border: #e5e7eb;
    --success: #10b981;
    --gradient-1: linear-gradient(135deg, #0066cc 0%, #00b4d8 100%);
    --gradient-2: linear-gradient(135deg, #0a1628 0%, #1e3a5f 100%);
    --shadow-sm: 0 2px 8px rgba(0, 102, 204, 0.1);
    --shadow-md: 0 8px 30px rgba(0, 102, 204, 0.15);
    --shadow-lg: 0 20px 60px rgba(0, 102, 204, 0.2);
}

/* ==========================================
   全局重置
   ========================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
button { font-family: inherit; }

/* ==========================================
   顶部导航栏
   ========================================== */
.site-header {
    background: var(--bg-dark);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.site-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.site-logo-img {
    height: 32px;
    width: auto;
    display: block;
    /* Logo 是浅蓝色，深色导航栏背景下直接显示 */
    filter: brightness(1);
    transition: opacity 0.2s;
}

.site-logo:hover .site-logo-img {
    opacity: 0.85;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.site-nav a {
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 6px;
    transition: all 0.2s;
}

.site-nav a:hover,
.site-nav a.current {
    color: var(--white);
    background: rgba(255,255,255,0.1);
}

/* ==========================================
   Hero 区域（紧凑横向布局）
   ========================================== */
.hero-section {
    background: var(--gradient-2);
    padding: 32px 20px 90px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.hero-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.hero-icon {
    width: 64px;
    height: 64px;
    background: var(--gradient-1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.hero-icon svg {
    width: 32px;
    height: 32px;
    fill: white;
}

.hero-text .hero-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.hero-text .hero-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.65);
}

.stats-bar {
    display: flex;
    gap: 40px;
    flex-shrink: 0;
}

.stat-item {
    text-align: center;
    position: relative;
}

.stat-item + .stat-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 32px;
    background: rgba(255,255,255,0.15);
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    display: block;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* ==========================================
   搜索 & 筛选区
   ========================================== */
.filter-section {
    max-width: 1200px;
    margin: -60px auto 30px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.filter-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
}

.search-btn {
    padding: 14px 28px;
    background: var(--gradient-1);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.category-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-tab {
    padding: 8px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.category-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.category-tab.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    font-weight: 600;
}

.category-tab.active:hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

.category-tab .count {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.category-tab.active .count {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================
   内容区
   ========================================== */
.content-section {
    max-width: 1200px;
    margin: 0 auto 60px;
    padding: 0 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--gradient-1);
    border-radius: 2px;
}

.view-toggle {
    display: flex;
    gap: 8px;
}

.view-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    color: var(--text-light);
}

.view-btn.active, .view-btn:hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

/* ==========================================
   网格视图 - 下载卡片
   ========================================== */
.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.download-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.download-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-1);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.download-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.download-card:hover::before {
    transform: scaleX(1);
}

.card-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.file-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.file-icon.pdf  { background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%); color: white; }
.file-icon.zip  { background: linear-gradient(135deg, #feca57 0%, #ff9f43 100%); color: white; }
.file-icon.doc  { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); color: white; }
.file-icon.xls  { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); color: white; }
.file-icon.ppt  { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); color: white; }
.file-icon.other { background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); color: white; }

.file-icon svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

.card-info { flex: 1; min-width: 0; }

.card-category {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    font-size: 12px;
    color: var(--text-light);
}

.card-description {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.card-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-light);
}

.card-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.download-btn {
    padding: 10px 20px;
    background: var(--gradient-1);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.download-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
    color: white;
}

.download-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* ==========================================
   列表视图
   ========================================== */
.download-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.download-list-item {
    background: var(--white);
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    border: 1px solid transparent;
}

.download-list-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.list-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.list-info {
    flex: 1;
    min-width: 0;
}

.list-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.list-meta {
    font-size: 12px;
    color: var(--text-light);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.list-download {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.list-size {
    font-size: 13px;
    color: var(--text-light);
}

/* ==========================================
   空状态
   ========================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    grid-column: 1/-1;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    fill: var(--border);
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 8px;
}

/* ==========================================
   分页（现代胶囊按钮风格）
   ========================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 48px;
    padding: 0;
    list-style: none;
}

.pagination ul {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination li {
    display: inline-flex;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 16px;
    border: none;
    background: transparent;
    border-radius: 22px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.pagination a:not(.prev):not(.next):hover {
    background: var(--primary-light);
    color: var(--primary);
}

.pagination .current,
.pagination span.current {
    background: var(--gradient-1);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0, 102, 204, 0.35);
}

.pagination .dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    color: var(--text-light);
    font-size: 15px;
    background: transparent;
}

.pagination .prev,
.pagination .next {
    background: var(--white);
    border: 1.5px solid var(--border);
    color: var(--text-dark);
    font-weight: 500;
    gap: 4px;
}

.pagination .prev:hover,
.pagination .next:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--white);
}

.pagination .prev {
    margin-right: 8px;
}

.pagination .next {
    margin-left: 8px;
}

.pagination .prev::before {
    content: '‹';
    font-size: 18px;
    margin-right: 2px;
}

.pagination .next::after {
    content: '›';
    font-size: 18px;
    margin-left: 2px;
}

/* 禁用状态 */
.pagination .prev.disabled,
.pagination .next.disabled,
.pagination .prev:disabled,
.pagination .next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==========================================
   单文件详情页
   ========================================== */
.detail-page {
    max-width: 800px;
    margin: 40px auto 60px;
    padding: 0 20px;
}

.detail-card {
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-md);
}

.detail-header {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.detail-icon {
    width: 80px;
    height: 80px;
    border-radius: 18px;
    flex-shrink: 0;
}

.detail-info h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
    line-height: 1.4;
}

.detail-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-light);
}

.detail-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.detail-body {
    margin-bottom: 32px;
}

.detail-body h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.detail-body p {
    color: var(--text-light);
    line-height: 1.8;
    font-size: 15px;
}

.detail-action {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.btn-download-large {
    padding: 16px 48px;
    background: var(--gradient-1);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    letter-spacing: 0.3px;
}

.btn-download-large:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    color: white;
}

.btn-download-large svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* ==========================================
   页脚
   ========================================== */
.site-footer {
    background: var(--bg-dark);
    color: rgba(255,255,255,0.5);
    text-align: center;
    padding: 24px 20px;
    font-size: 13px;
}

.site-footer a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}

.site-footer a:hover { color: var(--white); }

/* ==========================================
   后台管理相关样式（admin only）
   ========================================== */
.onway-meta-box {
    padding: 12px 0;
}

.onway-meta-box .meta-field {
    margin-bottom: 16px;
}

.onway-meta-box label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
}

.onway-meta-box input[type="text"],
.onway-meta-box input[type="number"],
.onway-meta-box input[type="url"],
.onway-meta-box select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* ==========================================
   响应式
   ========================================== */
@media (max-width: 768px) {
    .hero-section { padding: 24px 20px 80px; }
    .hero-content { flex-direction: column; align-items: flex-start; gap: 20px; }
    .hero-left { gap: 14px; }
    .hero-icon { width: 48px; height: 48px; border-radius: 12px; }
    .hero-icon svg { width: 24px; height: 24px; }
    .hero-text .hero-title { font-size: 20px; }
    .hero-text .hero-subtitle { font-size: 13px; }
    .stats-bar { gap: 24px; }
    .stat-number { font-size: 22px; }
    .download-grid { grid-template-columns: 1fr; }

    .category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 10px;
        scrollbar-width: none;
    }
    .category-tabs::-webkit-scrollbar { display: none; }

    .download-list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .list-download {
        width: 100%;
        justify-content: space-between;
        margin-top: 12px;
    }

    .detail-header { flex-direction: column; }
    .detail-card { padding: 24px; }

    .site-nav { display: none; }


