/**
 * ============================================================
 * 文件：static/css/app.css
 * 类型：前端样式表
 * 用途：仿抖音全屏刷图界面样式
 * 修改记录：
 *   - 2026-07-24：Swiper 版本样式
 *   - 2026-07-27：提升详情弹窗 z-index 至 10000，关闭按钮至 10001
 * ============================================================
 */

/* ============================================================
   1. 全局重置
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #000;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #000;
    position: relative;
}

/* ============================================================
   2. 顶部导航
   ============================================================ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    height: 56px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
    pointer-events: none;
}

.header > * {
    pointer-events: auto;
}

/* ============================================================
   3. 标签浮层
   ============================================================ */
.tags-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.tags-menu.show {
    display: flex;
}

.tags-menu-inner {
    width: 90%;
    max-width: 400px;
    max-height: 70vh;
    background: #1a1a2e;
    border-radius: 16px;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.tags-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 18px;
    font-weight: 600;
}

.btn-close-tags {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
}

.btn-close-tags:hover {
    color: #fff;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 15px;
}

.tag-item {
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.tag-item:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.tag-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: transparent;
}

.no-tags {
    color: #666;
    padding: 20px;
    text-align: center;
}

/* ============================================================
   4. Swiper 容器
   ============================================================ */
.mySwiper {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    position: relative;
    z-index: 1;
}

.swiper-wrapper {
    height: 100%;
}

.swiper-slide {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
}

/* ============================================================
   5. 图片容器
   ============================================================ */
.feed-item {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: #111;
}

.feed-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #111;
    cursor: pointer;
}

/* ============================================================
   6. 底部标题
   ============================================================ */
.feed-title {
    position: absolute;
    bottom: 60px;
    left: 16px;
    right: 80px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    z-index: 5;
    pointer-events: none;
}

/* ============================================================
   7. 右侧操作按钮
   ============================================================ */
.feed-actions {
    position: absolute;
    right: 16px;
    bottom: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 10;
}

.feed-actions button {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    gap: 4px;
}

.feed-actions button .icon {
    font-size: 28px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.feed-actions button .count {
    font-weight: 600;
    font-size: 13px;
}

.feed-actions button:active {
    transform: scale(0.9);
}

.feed-actions .btn-like .icon {
    color: #ff6b6b;
}

/* ============================================================
   8. 底部导航
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: 60px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 10px 8px;
    overflow-x: auto;
}

.nav-list {
    display: flex;
    gap: 16px;
    white-space: nowrap;
    padding: 0 10px;
}

.nav-item {
    padding: 6px 14px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 20px;
    flex-shrink: 0;
}

.nav-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.nav-item:active {
    transform: scale(0.95);
}

.nav-list::-webkit-scrollbar {
    display: none;
}

/* ============================================================
   9. 加载状态
   ============================================================ */
.loading-spinner {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 20px;
    color: #666;
    font-size: 14px;
}

.loading-spinner .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.no-more {
    display: none;
    text-align: center;
    padding: 20px;
    color: #444;
    font-size: 13px;
}

.empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    font-size: 24px;
    color: #444;
}

/* ============================================================
   10. ★ 详情弹窗（修复层级）
   ============================================================ */
.detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000 !important;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.detail-overlay.show {
    display: flex;
}

.detail-container {
    width: 95%;
    max-width: 500px;
    max-height: 90vh;
    background: #1a1a2e;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.9);
}

/* ★ 关闭按钮在最上层 */
.detail-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10001 !important;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.3s;
}

.detail-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.detail-content {
    max-height: 90vh;
    overflow-y: auto;
}

.detail-content::-webkit-scrollbar {
    width: 4px;
}

.detail-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.detail-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    background: #111;
    overflow: hidden;
}

.detail-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.detail-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.3s;
    display: none;
    justify-content: center;
    align-items: center;
}

.detail-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.detail-nav.prev {
    left: 8px;
}

.detail-nav.next {
    right: 8px;
}

.detail-info {
    padding: 20px 20px 30px 20px;
}

.detail-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
}

.detail-desc {
    font-size: 15px;
    color: #aaa;
    margin-bottom: 12px;
    line-height: 1.6;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.detail-tags .tag {
    padding: 4px 12px;
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 16px;
    font-size: 12px;
    color: #a8b4ff;
}

.detail-stats {
    display: flex;
    gap: 24px;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 16px;
    color: #888;
    font-size: 14px;
}

.detail-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.detail-comment {
    min-height: 60px;
}

.comment-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
    text-align: center;
    border: 2px dashed rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
}

/* ============================================================
   11. Toast
   ============================================================ */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    padding: 10px 24px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    border-radius: 24px;
    font-size: 14px;
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: all 0.4s ease;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   12. 动画
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ============================================================
   13. 响应式适配
   ============================================================ */
@media (max-width: 480px) {
    .header {
        height: 50px;
        padding: 8px 12px;
    }
    .feed-title {
        font-size: 14px;
        bottom: 50px;
        right: 70px;
    }
    .feed-actions {
        right: 12px;
        bottom: 80px;
        gap: 16px;
    }
    .feed-actions button .icon { font-size: 24px; }
    .feed-actions button .count { font-size: 11px; }
    .bottom-nav { height: 56px; }
    .nav-item { font-size: 12px; padding: 4px 12px; }
    .detail-container {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    .detail-content { max-height: 100vh; }
    .detail-title { font-size: 17px; }
    .detail-desc { font-size: 14px; }
    .tags-menu-inner { width: 95%; padding: 16px; }
}

@media (min-width: 769px) {
    .mySwiper { max-width: 500px; margin: 0 auto; }
    .feed-actions button .icon { font-size: 32px; }
    .feed-actions button .count { font-size: 14px; }
    .feed-title { font-size: 18px; }
}