/* 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; }

/* ================= 分页器 ================= */
.pagination { display: flex; justify-content: center; gap: 8px; margin: 40px 0; list-style: none; }
.page-link { padding: 8px 16px; background: white; border: 1px solid #edf0f2; border-radius: 20px; color: #739bb0; transition: all 0.3s; font-size: 0.9rem;}
.page-link:hover { background: #739bb0; color: white; border-color: #739bb0; }
.page-item.disabled .page-link { background: #fafafa; color: #bbb; border-color: #eee; pointer-events: none; }

/* ================= 自定义弹窗 (第一层：横向轮播) ================= */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 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; 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-counter { font-weight: bold; color: #666; }

.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; 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; }

/* ================= 自定义弹窗 (第二层：单图放大预览层) ================= */
.zoom-overlay { 
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    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) {
    .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: 100vh; width: 100%; border-radius: 0; }
    .zoom-close { top: 15px; right: 15px; width: 36px; height: 36px; font-size: 1.2rem; }
}