/* ==========================================================================
   HAP Store - Modern Cyber-Tech UI (2026 Gen-Z / 质感拟态 / 潮流微光 / 极致通透)
   ========================================================================== */

:root {
    --genz-primary: #3b82f6;
    --genz-primary-glow: rgba(59, 130, 246, 0.35);
    --genz-accent: #06b6d4;
    --genz-accent-purple: #8b5cf6;
    --genz-accent-pink: #ec4899;
    --genz-glass-bg: rgba(13, 18, 30, 0.78);
    --genz-glass-border: rgba(59, 130, 246, 0.22);
    --genz-card-bg: rgba(18, 25, 41, 0.75);
    --genz-card-hover-bg: rgba(24, 34, 56, 0.9);
    --genz-card-border: rgba(255, 255, 255, 0.08);
    --genz-card-hover-border: rgba(59, 130, 246, 0.45);
    --genz-card-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.45), 0 0 1px 1px rgba(255, 255, 255, 0.06);
    --genz-card-hover-shadow: 0 22px 48px -12px rgba(59, 130, 246, 0.35), 0 0 0 1px rgba(59, 130, 246, 0.5);
    --genz-radius-xl: 22px;
    --genz-radius-lg: 16px;
    --genz-radius-md: 12px;
    --genz-radius-sm: 8px;
    --genz-transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
    --genz-glass-bg: rgba(255, 255, 255, 0.82);
    --genz-glass-border: rgba(59, 130, 246, 0.18);
    --genz-card-bg: rgba(255, 255, 255, 0.85);
    --genz-card-hover-bg: #ffffff;
    --genz-card-border: rgba(59, 130, 246, 0.15);
    --genz-card-hover-border: rgba(59, 130, 246, 0.4);
    --genz-card-shadow: 0 14px 34px -10px rgba(59, 130, 246, 0.1), 0 0 1px 1px rgba(59, 130, 246, 0.08);
    --genz-card-hover-shadow: 0 22px 45px -12px rgba(59, 130, 246, 0.22), 0 0 0 1px rgba(59, 130, 246, 0.35);
}

/* 1. 沉浸式网格微光背景 */
body {
    background-attachment: fixed;
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 45%),
        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.12) 0px, transparent 45%),
        radial-gradient(at 50% 100%, rgba(6, 182, 212, 0.1) 0px, transparent 50%),
        linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%) !important;
}

/* 2. 顶栏 Cyber 磨砂玻璃质感 */
.header {
    backdrop-filter: blur(24px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(190%) !important;
    background: var(--genz-glass-bg) !important;
    border-bottom: 1px solid var(--genz-glass-border) !important;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.logo-text {
    font-weight: 800 !important;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #ffffff 0%, #a5f3fc 40%, #60a5fa 70%, #a78bfa 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    filter: drop-shadow(0 2px 8px rgba(59, 130, 246, 0.3));
}
[data-theme="light"] .logo-text {
    background: linear-gradient(135deg, #0f172a 0%, #1e40af 45%, #0284c7 80%, #7c3aed 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

/* 3. 导航胶囊微光态交互 */
.nav a {
    position: relative;
    border-radius: 999px !important;
    padding: 8px 15px !important;
    font-weight: 600 !important;
    font-size: 13.5px !important;
    transition: var(--genz-transition) !important;
    border: 1px solid transparent !important;
}
.nav a:hover {
    background: rgba(59, 130, 246, 0.12) !important;
    color: #38bdf8 !important;
    border-color: rgba(59, 130, 246, 0.25) !important;
    transform: translateY(-1px);
}
.nav a.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.18)) !important;
    color: #60a5fa !important;
    border-color: rgba(96, 165, 250, 0.45) !important;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.25);
}

/* 4. 偏好设置整合入口 */
.site-pref-wrapper {
    position: relative;
    flex: 0 0 auto;
}

.site-pref-trigger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    border-radius: 999px;
    border: 1px solid var(--genz-glass-border);
    background: var(--genz-glass-bg);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: var(--genz-transition);
    user-select: none;
    white-space: nowrap;
    line-height: 1.2;
}
.site-pref-trigger:hover,
.site-pref-wrapper.active .site-pref-trigger {
    border-color: #60a5fa;
    background: rgba(59, 130, 246, 0.18);
    box-shadow: 0 4px 18px rgba(59, 130, 246, 0.28);
}
.site-pref-trigger i {
    color: #38bdf8;
}

.site-pref-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 316px;
    max-width: calc(100vw - 24px);
    padding: 0 16px 16px;
    border: 1px solid rgba(53, 132, 247, 0.42);
    border-radius: 16px;
    background: rgba(8, 20, 35, 0.97);
    color: var(--text-primary);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    z-index: 1200;
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    transform-origin: top right;
    pointer-events: none;
    transition: var(--genz-transition);
    letter-spacing: 0;
}
.site-pref-wrapper.active .site-pref-dropdown {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
[data-theme="light"] .site-pref-dropdown {
    background: rgba(248, 251, 255, 0.98);
    border-color: rgba(53, 132, 247, 0.34);
    box-shadow: 0 20px 48px rgba(30, 64, 175, 0.16), inset 0 1px 0 #ffffff;
}

.site-pref-header {
    display: flex;
    align-items: center;
    min-height: 47px;
    border-bottom: 1px solid rgba(96, 165, 250, 0.14);
}

.site-pref-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
}

.site-pref-title i {
    width: 15px;
    color: #cbd5e1;
    font-size: 13px;
    text-align: center;
}

.site-pref-section {
    margin: 0;
    padding: 13px 0;
    border-bottom: 1px solid rgba(96, 165, 250, 0.1);
}

.site-pref-section:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.site-pref-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 18px;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.site-pref-label span,
.site-pref-label small {
    white-space: nowrap;
}

.site-pref-label small {
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 400;
}

.site-pref-options {
    display: grid;
    gap: 7px;
}

.site-pref-options.col-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.site-pref-options.col-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.site-pref-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 36px;
    padding: 0 9px;
    border: 1px solid rgba(53, 132, 247, 0.4);
    border-radius: 8px;
    background: rgba(10, 31, 52, 0.68);
    color: var(--text-secondary);
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.site-pref-btn i {
    flex: 0 0 auto;
    color: #60a5fa;
    font-size: 12px;
}

.site-pref-btn:hover {
    border-color: rgba(96, 165, 250, 0.78);
    background: rgba(53, 132, 247, 0.16);
    color: var(--text-primary);
}

.site-pref-btn:focus-visible {
    outline: 2px solid rgba(125, 211, 252, 0.95);
    outline-offset: 2px;
}

.site-pref-btn.active {
    border-color: #3b9bff;
    background: linear-gradient(135deg, #0f9cf5 0%, #3584f7 100%);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 7px 18px rgba(28, 132, 255, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.site-pref-btn.active i {
    color: #ffffff;
}

.site-pref-dropdown .site-translation-switcher {
    display: flex !important;
    width: 100% !important;
    max-width: none;
}

.site-pref-dropdown .site-translation-trigger {
    justify-content: flex-start;
    width: 100%;
    max-width: none;
    min-height: 38px;
    padding: 0 11px;
    border-color: rgba(53, 132, 247, 0.4);
    border-radius: 8px;
    background: rgba(10, 31, 52, 0.68);
    color: var(--text-secondary);
    box-shadow: none;
}

.site-pref-dropdown .site-translation-trigger:hover,
.site-pref-dropdown .site-translation-switcher-open .site-translation-trigger {
    border-color: rgba(96, 165, 250, 0.78);
    background: rgba(53, 132, 247, 0.16);
    color: var(--text-primary);
    box-shadow: none;
}

.site-pref-dropdown .site-translation-current {
    flex: 1 1 auto;
    max-width: none;
}

.site-pref-dropdown .site-translation-arrow {
    margin-left: auto;
}

.site-pref-dropdown .site-translation-panel {
    top: calc(100% + 8px);
    right: 0;
    bottom: auto;
    left: 0;
    width: 100%;
}

[data-theme="light"] .site-pref-header,
[data-theme="light"] .site-pref-section {
    border-color: rgba(53, 132, 247, 0.12);
}

[data-theme="light"] .site-pref-title i {
    color: #475569;
}

[data-theme="light"] .site-pref-btn,
[data-theme="light"] .site-pref-dropdown .site-translation-trigger {
    border-color: rgba(53, 132, 247, 0.3);
    background: rgba(255, 255, 255, 0.78);
    color: #475569;
}

[data-theme="light"] .site-pref-btn:hover,
[data-theme="light"] .site-pref-dropdown .site-translation-trigger:hover,
[data-theme="light"] .site-pref-dropdown .site-translation-switcher-open .site-translation-trigger {
    border-color: rgba(53, 132, 247, 0.62);
    background: rgba(53, 132, 247, 0.08);
    color: #0f172a;
}

[data-theme="light"] .site-pref-btn.active {
    border-color: #3584f7;
    background: linear-gradient(135deg, #0f9cf5 0%, #3584f7 100%);
    color: #ffffff;
}

[data-theme="light"] .site-pref-btn.active i {
    color: #ffffff;
}

/* 5. 卡片系统质感升级与流光边框 (Cards & Grids) */
.card,
.hap-card,
.feature-card,
.dev-card,
.comment-box,
.version-card,
.stat-card {
    background: var(--genz-card-bg) !important;
    border: 1px solid var(--genz-card-border) !important;
    border-radius: var(--genz-radius-xl) !important;
    backdrop-filter: blur(20px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(160%) !important;
    box-shadow: var(--genz-card-shadow) !important;
    transition: var(--genz-transition) !important;
    position: relative;
    overflow: hidden;
}

.card:hover,
.hap-card:hover,
.feature-card:hover,
.dev-card:hover {
    background: var(--genz-card-hover-bg) !important;
    border-color: var(--genz-card-hover-border) !important;
    box-shadow: var(--genz-card-hover-shadow) !important;
    transform: translateY(-4px);
}

.card::before,
.hap-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.6), rgba(168, 85, 247, 0.6), transparent);
    opacity: 0;
    transition: var(--genz-transition);
}
.card:hover::before,
.hap-card:hover::before {
    opacity: 1;
}

.card-title {
    font-weight: 700 !important;
    letter-spacing: -0.2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 6. 详情页现代视觉微调 (Detail View) */
.app-header {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.85)) !important;
    border: 1px solid rgba(59, 130, 246, 0.25) !important;
    border-radius: var(--genz-radius-xl) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    box-shadow: var(--genz-card-shadow) !important;
    padding: 30px !important;
    margin-bottom: 28px !important;
}
[data-theme="light"] .app-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 249, 255, 0.9)) !important;
    border-color: rgba(59, 130, 246, 0.2) !important;
}

.app-icon {
    border-radius: 26px !important;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.12) !important;
    transition: var(--genz-transition) !important;
}
.app-icon:hover {
    transform: scale(1.03) rotate(-1deg);
    box-shadow: 0 20px 42px rgba(59, 130, 246, 0.35), 0 0 0 2px rgba(59, 130, 246, 0.5) !important;
}

.app-title h1 {
    font-weight: 800 !important;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #93c5fd 50%, #38bdf8 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}
[data-theme="light"] .app-title h1 {
    background: linear-gradient(135deg, #0f172a 0%, #1e40af 50%, #0284c7 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

/* 元信息与标签胶囊 (Meta & Badges) */
.meta-item,
.badge,
.category-badges .badge {
    border-radius: 999px !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(59, 130, 246, 0.18) !important;
    transition: var(--genz-transition) !important;
}
.meta-item {
    background: rgba(59, 130, 246, 0.06) !important;
    padding: 6px 14px !important;
    font-size: 13px !important;
}
.badge-category {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #38bdf8 !important;
}
.badge-category:hover {
    background: rgba(59, 130, 246, 0.22) !important;
    border-color: #38bdf8 !important;
    transform: translateY(-2px);
}
.badge-category.selected,
.badge-category:has(input:checked) {
    background: linear-gradient(135deg, #2563eb 0%, #0891b2 100%) !important;
    border-color: rgba(125, 211, 252, 0.9) !important;
    color: #ffffff !important;
    box-shadow: 0 5px 16px rgba(37, 99, 235, 0.38) !important;
}
.badge-category.selected:hover,
.badge-category:has(input:checked):hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #0e7490 100%) !important;
    border-color: #bae6fd !important;
}
.badge-featured {
    background: linear-gradient(135deg, #f43f5e 0%, #fb923c 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35) !important;
}
.badge-original {
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35) !important;
}

/* 操作按钮与下载胶囊组 (CTA Buttons) */
.vip-download-btn,
.btn-primary,
.hero-action.primary,
.submit-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%) !important;
    border-radius: 14px !important;
    box-shadow: 0 10px 28px rgba(59, 130, 246, 0.4) !important;
    font-weight: 700 !important;
    border: 0 !important;
    transition: var(--genz-transition) !important;
    color: #ffffff !important;
}
.vip-download-btn.fast-mode {
    background: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%) !important;
    box-shadow: 0 10px 28px rgba(139, 92, 246, 0.45) !important;
}
.vip-download-btn:hover,
.btn-primary:hover,
.hero-action.primary:hover,
.submit-btn:hover {
    box-shadow: 0 14px 34px rgba(6, 182, 212, 0.55) !important;
    transform: translateY(-2px) scale(1.01) !important;
}

.btn-secondary,
.hero-action.secondary {
    background: rgba(59, 130, 246, 0.1) !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
    border-radius: 14px !important;
    color: var(--text-primary) !important;
    transition: var(--genz-transition) !important;
}
.btn-secondary:hover,
.hero-action.secondary:hover {
    background: rgba(59, 130, 246, 0.2) !important;
    border-color: #38bdf8 !important;
    transform: translateY(-2px);
}

/* 节点选择滑块与标签页 */
.node-switch-container {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(59, 130, 246, 0.2) !important;
    border-radius: 999px !important;
    padding: 6px 14px !important;
}
[data-theme="light"] .node-switch-container {
    background: rgba(241, 245, 249, 0.8) !important;
    border-color: rgba(59, 130, 246, 0.15) !important;
}

/* 7. 投稿页拖拽区、表单控件与步进 (Submit & Upload View) */
.drop-zone,
.upload-box,
.file-upload {
    border: 2px dashed rgba(59, 130, 246, 0.38) !important;
    border-radius: var(--genz-radius-xl) !important;
    background: rgba(59, 130, 246, 0.04) !important;
    padding: 36px 24px !important;
    text-align: center;
    transition: var(--genz-transition) !important;
    position: relative;
}
.drop-zone:hover,
.upload-box:hover,
.file-upload:hover,
.file-upload.dragover {
    border-color: #38bdf8 !important;
    background: rgba(59, 130, 246, 0.1) !important;
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.15);
}
.file-upload-icon {
    font-size: 48px !important;
    color: #38bdf8 !important;
    margin-bottom: 12px;
    filter: drop-shadow(0 4px 12px rgba(56, 189, 248, 0.4));
}

.editable-title,
.editable-textarea,
.editable-input,
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
    background: rgba(15, 23, 42, 0.5) !important;
    border: 1px solid rgba(59, 130, 246, 0.2) !important;
    border-radius: 12px !important;
    color: var(--text-primary) !important;
    padding: 12px 16px !important;
    transition: var(--genz-transition) !important;
}
[data-theme="light"] .editable-title,
[data-theme="light"] .editable-textarea,
[data-theme="light"] .editable-input,
[data-theme="light"] .form-control,
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="url"],
[data-theme="light"] textarea,
[data-theme="light"] select {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(59, 130, 246, 0.2) !important;
}
.editable-title:focus,
.editable-textarea:focus,
.editable-input:focus,
.form-control:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2) !important;
    outline: none !important;
}

/* 8. 进度条质感 (Progress Bars) */
.progress-bar,
.detail-release-progress-track {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(59, 130, 246, 0.2) !important;
    border-radius: 999px !important;
    overflow: hidden !important;
    height: 10px !important;
}
.progress-fill,
.detail-release-progress-bar {
    background: linear-gradient(90deg, #3b82f6, #06b6d4, #a855f7) !important;
    background-size: 200% 100% !important;
    animation: genz-gradient-shift 3s ease infinite !important;
    border-radius: 999px !important;
}

@keyframes genz-gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 9. 响应式防重叠断点增强 (Responsive Anti-Overlap Protection) */
@media (max-width: 992px) {
    .nav {
        background: rgba(13, 18, 30, 0.95) !important;
        backdrop-filter: blur(28px) !important;
        border-radius: 0 0 24px 24px !important;
    }
    .content-grid {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }
    .app-header {
        grid-template-columns: 1fr !important;
        text-align: center;
        gap: 20px !important;
    }
    .app-icon {
        margin: 0 auto;
    }
    .app-actions {
        width: 100% !important;
        margin: 0 auto !important;
    }
    .app-meta {
        justify-content: center;
        gap: 12px;
    }
    .category-badges {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .header-content {
        gap: 10px !important;
    }
    .site-pref-dropdown {
        position: fixed !important;
        top: auto !important;
        bottom: 20px !important;
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
    }
    .app-header {
        padding: 20px 16px !important;
    }
    .app-meta .meta-item {
        font-size: 12px !important;
        padding: 4px 10px !important;
    }
    .form-row {
        grid-template-columns: 1fr !important;
    }
}
