/* static/css/style.css */

/* ================= 基础重置 ================= */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif; background-color: #f7f8f9; color: #5a5a5a; line-height: 1.6; }
a { text-decoration: none; color: inherit; }

/* ================= 导航栏 & 语言下拉菜单 ================= */
.navbar { 
    background-color: #ffffff; padding: 15px 1.5vw; 
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 25px; border-bottom: 1px solid #edf0f2; box-shadow: 0 2px 10px rgba(0,0,0,0.02); 
    flex-wrap: wrap; gap: 15px; 
}
.navbar-brand { font-size: 1.3rem; font-weight: bold; color: #739bb0; letter-spacing: 1px; white-space: nowrap; flex-shrink: 0; }
.navbar-links { display: flex; align-items: center; white-space: nowrap; flex-shrink: 0; }

.lang-switcher { position: relative; border-left: 1px solid #eee; padding-left: 20px; margin-left: 20px; display: flex; align-items: center;}
.dropdown-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; color: #666; font-size: 0.95rem; transition: color 0.3s; padding: 5px 0; }
.dropdown-toggle:hover { color: #739bb0; }
.dropdown-menu { 
    display: none; position: absolute; top: 100%; right: 0; background: white; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.08); border-radius: 8px; padding: 10px 0; 
    min-width: 120px; z-index: 100; flex-direction: column; border: 1px solid #f0f2f5;
}
.lang-switcher:hover .dropdown-menu, .dropdown-menu.show { display: flex; }
.dropdown-menu a { padding: 8px 20px; color: #555; text-decoration: none; font-size: 0.9rem; transition: background 0.3s, color 0.3s; white-space: nowrap; }
.dropdown-menu a:hover, .dropdown-menu a.active { background: #f4f7f9; color: #739bb0; font-weight: bold; }

.search-form { display: flex; gap: 8px; flex: 1 1 260px; justify-content: flex-end; }
.search-input { padding: 8px 15px; border: 1px solid #e2e6e9; border-radius: 20px; background: #fbfbfc; color: #555; outline: none; transition: border 0.3s; font-size: 0.9rem; width: 100%; max-width: 350px; }
.search-input:focus { border-color: #739bb0; }
.search-input::placeholder { color: #bbb; }
.search-btn { padding: 8px 18px; border: none; border-radius: 20px; background: #739bb0; color: white; cursor: pointer; transition: background 0.3s; font-size: 0.9rem; white-space: nowrap; flex-shrink: 0; }
.search-btn:hover { background: #62889c; }

/* ================= 布局与容器 ================= */
.container { width: 100%; padding: 0 1.5vw; margin: 0 auto; }
.page-header { margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px dashed #e2e6e9; font-size: 1.4rem; color: #666; font-weight: 500;}

/* ================= 标准网格 ================= */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.card { position: relative; background: #ffffff; border-radius: 10px; overflow: hidden; box-shadow: 0 3px 10px rgba(0,0,0,0.03); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); z-index: 1;}
.card-img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; cursor: pointer; transition: transform 0.3s ease; }
.card:hover .card-img { transform: scale(1.03); }
.img-count { position: absolute; top: 10px; left: 10px; background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); color: white; padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; z-index: 2; pointer-events: none; font-weight: bold; }

/* ================= 悬浮标签层 ================= */
.tags-overlay { position: absolute; bottom: 0; left: 0; width: 100%; padding: 40px 12px 12px; background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%); display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; gap: 6px; scrollbar-width: none; }
.tags-overlay::-webkit-scrollbar { display: none; } 
.tags-overlay .tag { background: rgba(255, 255, 255, 0.25); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; transition: background 0.3s; white-space: nowrap; flex-shrink: 0; }
.tags-overlay .tag:hover { background: rgba(255, 255, 255, 0.5); }
.tags-overlay, .modal-tags-wrapper { pointer-events: auto !important; cursor: grab; }
.tags-overlay:active, .modal-tags-wrapper:active { cursor: grabbing; }
.tags-overlay .tag, .modal-tags-wrapper .tag-primary { -webkit-user-drag: none; user-select: none; }

/* ================= 卡片信息区 (标题与作者) ================= */
.card-info { padding: 10px 12px 14px; background: #ffffff; display: flex; flex-direction: column; gap: 5px; border-top: 1px solid #f2f4f6; }
.card-title { font-size: 0.92rem; font-weight: 600; color: #3d4952; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; text-decoration: none; transition: color 0.2s; }
.card-title:hover { color: #739bb0; }
.card-author { font-size: 0.8rem; color: #888; display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-author-icon { font-size: 0.75rem; color: #739bb0; }

/* ================= 分页器 ================= */

.pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; margin: 40px 0; list-style: none; }
.page-link { display: flex; align-items: center; justify-content: center; height: 38px; min-width: 38px; padding: 0 10px; background: white; border: 1px solid #edf0f2; border-radius: 20px; color: #739bb0; transition: all 0.3s; font-size: 0.9rem; text-decoration: none; user-select: none; }
.page-link:hover { background: #f0f4f7; color: #62889c; border-color: #dce6eb; }
.page-item.active .page-link { background: #739bb0; color: #fff; border-color: #739bb0; font-weight: bold; cursor: default; }
.page-item.disabled .page-link { background: #fafafa; color: #bbb; border-color: #eee; pointer-events: none; }
.page-item.ellipsis .page-link { border: none; background: transparent; color: #aaa; cursor: default; min-width: 22px; padding: 0; }
.page-arrow { border-radius: 50% !important; width: 38px; padding: 0 !important; }
.page-jump-box { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; background: #fafbfc; border: 1px solid #edf0f2; border-radius: 20px; }

/* ================= 详情页相关图集推荐 ================= */
.related-section { max-width: 1400px; margin: 30px auto 40px auto; padding: 0 15px; }
.related-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px dashed #e2e6e9; margin-bottom: 18px; padding-bottom: 12px; }
.related-title { font-size: 1.2rem; color: #5a5a5a; font-weight: 600; display: flex; align-items: center; gap: 8px; margin: 0; }
.related-more-link { font-size: 0.88rem; color: #739bb0; transition: color 0.3s; text-decoration: none; }
.related-more-link:hover { color: #55788d; text-decoration: underline; }
.related-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.related-card { display: flex; flex-direction: column; background: #ffffff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.03); transition: transform 0.3s ease, box-shadow 0.3s ease; text-decoration: none; color: inherit; }
.related-card:hover { transform: translateY(-4px); box-shadow: 0 6px 16px rgba(0,0,0,0.08); }
.related-card-img-wrap { width: 100%; aspect-ratio: 2 / 3; overflow: hidden; background: #f0f2f5; }
.related-card-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.related-card:hover .related-card-img-wrap img { transform: scale(1.04); }
.related-card-info { padding: 10px 10px 12px; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.related-card-title { font-size: 0.85rem; color: #444; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }

/* ================= 详情页最新活跃标签 ================= */
.recent-tags-section { max-width: 1400px; margin: 10px auto 40px auto; padding: 0 15px; }
.recent-tags-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.recent-tag-pill { display: inline-flex; align-items: center; padding: 7px 14px; background: #ffffff; color: #50616d; border: 1px solid #e1e7eb; border-radius: 20px; font-size: 0.88rem; text-decoration: none; transition: all 0.25s ease; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
.recent-tag-pill:hover { background: #739bb0; color: #ffffff; border-color: #739bb0; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(115, 155, 176, 0.2); }

/* ================= 自定义弹窗 (第一层：横向轮播) ================= */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; height: 100dvh; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 1000; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.4s ease; }
.modal-overlay.active { display: flex; opacity: 1; }

.modal-content { background: white; width: 98%; max-width: 1400px; height: 98vh; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; transform: translateY(10px); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s; border: 1px solid #eee; }
.modal-overlay.active .modal-content { transform: translateY(0); }

.slider-container { position: relative; flex: 1; min-height: 0; display: flex; overflow: hidden; background: #fafbfc; }
.modal-body { display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; width: 100%; padding: 0; }
.modal-body::-webkit-scrollbar { display: none; }
.modal-body img { scroll-snap-align: center; flex: 0 0 100%; width: 100%; height: 100%; object-fit: contain; margin: 0; border-radius: 0; box-shadow: none; cursor: zoom-in; }

.slider-meta { display: flex; align-items: center; gap: 12px; font-size: 0.8rem; color: #888; flex-shrink: 0; }
.slider-date { background: #f0f2f5; padding: 2px 8px; border-radius: 10px; }

.slider-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, 0.75); color: #555; border: none; width: 40px; height: 40px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; z-index: 10; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(0,0,0,0.05); backdrop-filter: blur(4px); transition: all 0.3s; }
.slider-btn:hover { background: #739bb0; color: white; }
.prev-btn { left: 15px; }
.next-btn { right: 15px; }

/* 底部功能区：更加紧凑 */
.modal-footer { padding: 10px 20px; padding-bottom: max(10px, env(safe-area-inset-bottom)); flex-shrink: 0; background: white; border-top: 1px solid #f0f2f5; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.modal-tags-wrapper { display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; gap: 8px; align-items: center; flex: 1; min-width: 0; scrollbar-width: none; }
.modal-tags-wrapper::-webkit-scrollbar { display: none; } 
.tag-primary { background: #eef3f6; color: #739bb0; font-size: 0.8rem; padding: 4px 10px; border-radius: 15px; border: 1px solid #dce6eb; display: inline-block; text-decoration: none; white-space: nowrap; flex-shrink: 0; }
.tag-primary:hover { background: #739bb0; color: white; }
.btn-close { padding: 6px 18px; background: #f2f5f7; color: #666; border: none; border-radius: 15px; cursor: pointer; transition: all 0.3s; font-size: 0.85rem; flex-shrink: 0; }
.btn-close:hover { background: #739bb0; color: white; }

/* ================= 轮播图圆点指示器 (居中悬浮版) ================= */
.slider-dots {
    position: absolute;
    bottom: 20px;       /* 距离图片容器底部的距离 */
    left: 50%;
    transform: translateX(-50%); /* 完美的水平居中 */
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    max-width: 80%;     /* 允许更宽的展示区域 */
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 8px 14px;
    scroll-behavior: smooth;
    
    /* 增加半透明毛玻璃背景，防止图片是白色时看不清点 */
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 20px;
    z-index: 20; /* 确保悬浮在图片最上方 */
}

/* 【细节优化】当里面没有圆点(如图片为0或1张时不生成)，背景自动消失防穿帮 */
.slider-dots:empty {
    display: none; 
}

.slider-dots::-webkit-scrollbar { 
    display: none; 
}

.slider-dot {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.4); /* 默认半透明白色 */
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.slider-dot:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

.slider-dot.active {
    background-color: #ff3366; /* 激活时为亮红色 */
    transform: scale(1.25);
}

/* ================= 加载提示指示器 (轮播弹窗 & 全屏放大镜) ================= */
.slider-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    z-index: 15;
    pointer-events: none;
}
.slider-loader.active {
    display: flex;
}

.zoom-loader {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 7px 18px;
    background: rgba(15, 15, 15, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 2005;
    pointer-events: none;
}
.zoom-loader.active {
    display: flex;
}
.zoom-loader .spinner-ring {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
}
.zoom-loader .loader-text {
    font-size: 0.8rem;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.spinner-ring {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(115, 155, 176, 0.2);
    border-top-color: #739bb0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.spinner-ring-light {
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
}

.loader-text {
    font-size: 0.85rem;
    color: #555;
    font-weight: 500;
    letter-spacing: 0.5px;
}
.loader-text-light {
    color: #ffffff;
}

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

/* ================= 自定义弹窗 (第二层：单图放大预览层) ================= */
.zoom-overlay { 
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; width: 100%; height: 100%; height: 100dvh; 
    background: rgba(0, 0, 0, 0.92); z-index: 2000; justify-content: center; align-items: center; 
    touch-action: none; 
}
.zoom-img { 
    max-width: 100%; max-height: 100%; object-fit: contain; 
    transform-origin: center center; cursor: grab; user-select: none; -webkit-user-drag: none;
}
.zoom-img:active { cursor: grabbing; }
.zoom-close { 
    position: absolute; top: 25px; right: 25px; background: rgba(255,255,255,0.15); 
    color: white; border: none; width: 44px; height: 44px; border-radius: 50%; 
    font-size: 1.5rem; cursor: pointer; z-index: 2010; transition: background 0.3s; 
}
.zoom-close:hover { background: rgba(255,255,255,0.4); }

/* ================= 其它及响应式 ================= */
.error-text { color: #d88383; margin-top: 40px; }
.empty-text { color: #aaa; margin-top: 40px; }
.info-box { text-align: center; padding: 80px 20px; background: white; border-radius: 12px; color: #888; box-shadow: 0 4px 15px rgba(0,0,0,0.02);}

@media (max-width: 768px) {
    /* 移动端两列双排布局与间距优化 */
    .container {
        padding: 0 8px;
    }
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .card {
        border-radius: 8px;
    }
    .card-img {
        border-radius: 8px;
    }

    /* 角标与标签层精细化自适应 */
    .img-count {
        top: 6px;
        left: 6px;
        padding: 2px 7px;
        font-size: 0.7rem;
        border-radius: 10px;
    }
    .tags-overlay {
        padding: 28px 8px 8px;
        gap: 4px;
    }
    .tags-overlay .tag {
        padding: 2px 6px;
        font-size: 0.7rem;
        border-radius: 4px;
    }

    /* 原有移动端弹窗与导航组件保持兼容 */
    .slider-btn { display: none; }
    .search-input { max-width: 100%; flex-grow: 1; }
    .lang-switcher { margin-left: 10px; padding-left: 10px; }
    .dropdown-menu { right: -10px; } 
    .modal-content { height: 100%; height: 100dvh; max-height: 100%; width: 100%; border-radius: 0; }
    .zoom-close { top: 15px; right: 15px; width: 36px; height: 36px; font-size: 1.2rem; }

    /* 移动端分页器精简自适应 */
    .pagination { gap: 4px; margin: 25px 0; }
    .page-link { height: 34px; min-width: 34px; padding: 0 6px; font-size: 0.85rem; }
    .page-arrow { width: 34px; }
    .page-jump-box { height: 34px; padding: 0 8px; font-size: 0.8rem; }
    .page-num-far { display: none; }

    /* 移动端相关图集推荐自适应：3列布局 */
    .related-section { padding: 0 8px; margin: 20px auto 30px auto; }
    .related-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .related-card { border-radius: 6px; }
    .related-card-img-wrap { border-radius: 6px 6px 0 0; }
    .related-card-info { padding: 6px 6px 8px; }
    .related-card-title { font-size: 0.75rem; -webkit-line-clamp: 2; }
    .recent-tags-section { padding: 0 8px; margin: 10px auto 30px auto; }
    .recent-tags-cloud { gap: 6px; }
    .recent-tag-pill { font-size: 0.78rem; padding: 4px 10px; }
}