/**
 * Apple极简式模板 - 样式文件
 * 精简版：仅保留主页+弹窗所需样式
 */

/* ============ 基础 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    overflow-x: hidden;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.47059;
    -webkit-font-smoothing: antialiased;
}

/* ============ 导航栏 ============ */
.nav {
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.08);
    z-index: 1000;
}
.nav-content {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 22px;
    height: 44px;
    display: flex;
    align-items: center;
}
.logo {
    font-size: 18px;
    font-weight: 700;
    color: #1d1d1f;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    text-decoration: none;
    cursor: pointer;
}
.logo:hover { opacity: 0.7; }
.logo img { height: 28px; width: auto; max-width: 100px; object-fit: contain; }

.search-wrap {
    position: relative;
    flex: 0 1 280px;
    margin-left: auto;
    display: flex;
    align-items: center;
}
.nav-search {
    width: 100%;
    padding: 7px 32px 7px 14px;
    font-size: 14px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    background: #f5f5f7;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.nav-search:focus {
    background: #fff;
    border-color: #0071e3;
    box-shadow: 0 0 0 2px rgba(0,113,227,0.1);
}
.search-clear {
    position: absolute;
    right: 8px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #c7c7cc;
    color: #fff;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    display: none;
    border: none;
    padding: 0;
}
.search-clear:hover { background: #aeaeb2; }
.nav-search:not(:placeholder-shown) + .search-clear { display: block; }

/* ============ 平台导航（在nav内） ============ */
.platform-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0 16px;
}

/* 每个平台项（含下拉） */
.plat-item {
    position: relative;
}
.plat-btn {
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 400;
    color: #86868b;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 2px;
}
.plat-btn:hover { color: #1d1d1f; }
.plat-btn.active {
    color: #1d1d1f;
    font-weight: 600;
}
.plat-arrow {
    font-size: 8px;
    transition: transform 0.2s;
    opacity: 0.5;
}
.plat-item.open .plat-arrow { transform: rotate(180deg); }

/* 分类下拉面板 */
.plat-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 140px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 1001;
    padding: 4px;
    animation: platDropIn 0.15s ease;
}
.plat-item.open .plat-menu { display: block; }

@keyframes platDropIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.cat-menu-item {
    display: block;
    width: 100%;
    padding: 7px 14px;
    font-size: 13px;
    color: #1d1d1f;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
    white-space: nowrap;
}
.cat-menu-item:hover { background: #f5f5f7; }
.cat-menu-item.active {
    background: #0071e3;
    color: #fff;
}

/* ============ 容器 & 网格 ============ */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 22px 60px;
    width: 100%;
}
.software-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 12px;
}

/* ============ 软件卡片 ============ */
.software-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    overflow: hidden;
    min-width: 0;
}
.software-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.07);
}

.software-icon {
    width: 48px;
    height: 48px;
    border-radius: 11px;
    background: #f5f5f7;
    flex-shrink: 0;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.software-icon img { width: 100%; height: 100%; object-fit: cover; }

.software-info { flex: 1; min-width: 0; }
.software-title {
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.software-desc {
    font-size: 12px;
    color: #86868b;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.software-meta {
    font-size: 11px;
    color: #86868b;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-btn {
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #0071e3;
    background: rgba(0,113,227,0.08);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
}
.download-btn:hover { background: rgba(0,113,227,0.15); }

/* ============ 底部 ============ */
.footer {
    text-align: center;
    padding: 24px 22px;
    color: #86868b;
    font-size: 12px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

/* ============ 弹窗 ============ */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.modal-content {
    background: #fff;
    margin: 6vh auto;
    border-radius: 16px;
    width: 92%;
    max-width: 520px;
    max-height: 88vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: modalIn 0.25s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid #e5e5e7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}
.modal-header h2 { font-size: 16px; font-weight: 600; color: #1d1d1f; margin: 0; }
.close {
    width: 26px; height: 26px;
    background: #e8e8ed;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: #86868b;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    line-height: 1;
}
.close:hover { background: #d2d2d7; color: #1d1d1f; }

.modal-body {
    padding: 20px;
    max-height: calc(88vh - 56px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.15) transparent;
}
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* 弹窗内-详情 */
.software-detail { display: flex; flex-direction: column; gap: 16px; }
.detail-header {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 0; background: none; border: none; box-shadow: none; margin: 0; border-radius: 0;
}
.detail-header::before { display: none; }

.modal-body .software-icon {
    width: 56px; height: 56px;
    border-radius: 13px;
    flex-shrink: 0;
}
.detail-info h3 { font-size: 17px; font-weight: 600; color: #1d1d1f; margin: 0 0 4px 0; }
.detail-info .description { color: #86868b; font-size: 13px; line-height: 1.4; margin: 0 0 8px 0; }

.meta-info { display: flex; gap: 6px; flex-wrap: wrap; }
.meta-info span {
    background: #f5f5f7; color: #515154;
    padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 500;
}

.versions-section h4 { font-size: 14px; font-weight: 600; color: #1d1d1f; margin: 0 0 10px 0; }
.versions-list { display: flex; flex-direction: column; gap: 10px; }

.version-item {
    padding: 14px;
    background: #f9f9fb;
    border-radius: 12px;
    border: 1px solid #e8e8ed;
}
.version-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.version-tag {
    background: #0071e3; color: #fff;
    padding: 3px 10px; border-radius: 10px;
    font-size: 11px; font-weight: 600;
}
.version-size { color: #86868b; font-size: 11px; }

.version-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.download-link, .tutorial-link, .xu5-direct-link {
    padding: 6px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: filter 0.15s, transform 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #fff;
    border: none;
}
.download-link:hover, .tutorial-link:hover, .xu5-direct-link:hover { filter: brightness(1.1); transform: translateY(-1px); }
.xu5-direct-link { background: #607D8B; }

.qr-trigger { cursor: pointer; }
.qr-trigger:hover { filter: brightness(1.1); }

/* ============ 骨架屏 ============ */
.skeleton {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: #fff;
    border-radius: 14px;
    gap: 12px;
}
.skeleton-icon {
    width: 48px; height: 48px;
    border-radius: 11px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    flex-shrink: 0;
}
.skeleton-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
.skeleton-line:first-child { width: 60%; height: 14px; }
.skeleton-line:last-child { width: 40%; }
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
    .nav-content {
        padding: 6px 16px;
        height: auto;
        flex-wrap: wrap;
    }
    .logo { font-size: 15px; }
    .platform-tabs { margin: 0 0 0 auto; gap: 0; }
    .plat-btn { padding: 4px 6px; font-size: 12px; }
    .plat-menu { min-width: 110px; left: auto; right: 0; transform: none; animation-name: platDropInMobile; }
    @keyframes platDropInMobile {
        from { opacity: 0; transform: translateY(-6px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .cat-menu-item { padding: 6px 10px; font-size: 12px; }
    .search-wrap {
        flex: 0 0 100%;
        margin: 4px 0 0;
        order: 3;
    }
    .nav-search { padding: 6px 32px 6px 10px; font-size: 13px; }

    .container { padding: 12px 16px 40px; }
    .software-grid { grid-template-columns: 1fr; gap: 8px; }
    .software-item { padding: 12px; border-radius: 12px; }
    .software-icon { width: 42px; height: 42px; margin-right: 10px; border-radius: 10px; }
    .software-title { font-size: 14px; }
    .download-btn { padding: 4px 12px; font-size: 12px; }

    .modal-content { margin: 3vh auto; width: 96%; max-height: 94vh; border-radius: 14px; }
    .modal-body { padding: 16px; max-height: calc(94vh - 52px); }
    .version-item { padding: 12px; }
}
