/* 画廊容器 */
.custom-gallery-container {
    width: 75vw;  /* 保持75%视口宽度 */
    margin-left: calc((100% - 75vw) / 2) !important; /* 强制居中 */
    margin-right: auto !important;
    padding: 20px;
    box-sizing: border-box;
    position: relative; /* 确保定位正确 */
    left: 0; /* 重置可能的左偏移 */
}

/* 筛选器样式 */
.gallery-filter {
    margin-bottom: 30px;
    text-align: center;
}

.filter-btn {
    background-color: #f5f5f5;
    border: none;
    padding: 8px 16px;
    margin: 0 5px 10px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background-color: #e0e0e0;
}

.filter-btn.active {
    background-color: #e60012;
    color: white;
}

/* 基本画廊样式 */
.gallery-grid {
    width: 100%;
    margin: 0 auto;
}

/* 列宽定义元素 */
.gallery-sizer,
.gallery-item {
    width: 25%;
    padding: 0 5px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

/* 图片容器样式 */
.gallery-image-container {
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.gallery-item.hover .gallery-image-container {
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.gallery-image {
    transition: transform 0.5s ease;
    width: 100%;
    height: auto;
    display: block;
}

.gallery-item.hover .gallery-image {
    transform: scale(1.05);
}

/* 响应式布局 */
@media (max-width: 992px) {
    .gallery-sizer,
    .gallery-item {
        width: 33.333%;
    }
}

@media (max-width: 768px) {
    .gallery-sizer,
    .gallery-item {
        width: 50%;
    }
    .custom-gallery-container {
        width: 90vw;
        margin-left: calc((100% - 90vw) / 2) !important;
    }
}

@media (max-width: 480px) {
    .gallery-sizer,
    .gallery-item {
        width: 100%;
    }
    .custom-gallery-container {
        width: 95vw;
        margin-left: calc((100% - 95vw) / 2) !important;
    }
}

/* 图片信息 */
.gallery-item-info {
    padding: 15px;
}

.gallery-item-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
}

.gallery-item-author {
    margin: 0 0 5px;
    font-size: 14px;
    color: #666;
}

.gallery-item-tags {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: rgba(0,0,0,0.6);
    display: flex;
    flex-wrap: wrap;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item.hover .gallery-item-tags {
    opacity: 1;
}

/* 查看更多按钮 */
.gallery-more {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 30px;
}

.gallery-more-link {
    display: inline-block;
    background-color: #e60012;
    color: white;
    padding: 10px 25px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.gallery-more-link:hover {
    background-color: #c5000f;
    color: white;
}

/* 附件页面样式 */
.attachment-image-container {
    width: 75vw;
    margin-left: calc((100% - 75vw) / 2) !important;
    margin-right: auto !important;
    padding: 0 20px;
    box-sizing: border-box;
    position: relative;
    left: 0;
}

.attachment-image-wrapper {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    overflow: hidden;
    padding: 30px;
}

.attachment-image-header {
    margin-bottom: 30px;
    text-align: center;
}

.attachment-image-title {
    margin: 0 0 15px;
    font-size: 28px;
    color: #333;
}

.attachment-image-meta {
    color: #666;
    font-size: 14px;
}

.attachment-image-meta span {
    margin: 0 10px;
}

.attachment-image-content {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.attachment-image-main {
    flex: 1;
    min-width: 300px;
}

.attachment-full-image {
    width: 100%;
    height: auto;
    border-radius: 5px;
}

.attachment-image-caption {
    margin-top: 15px;
    padding: 10px;
    background-color: #f9f9f9;
    border-left: 3px solid #e60012;
    font-style: italic;
    color: #666;
}

.attachment-image-sidebar {
    width: 300px;
}

.attachment-image-details,
.attachment-image-description {
    margin-bottom: 25px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.attachment-image-details h3,
.attachment-image-description h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #333;
}

.attachment-detail-item {
    margin-bottom: 10px;
}

.detail-label {
    font-weight: 600;
    color: #555;
}

.attachment-image-download {
    margin-bottom: 25px;
    text-align: center;
}

.download-button {
    display: inline-block;
    background-color: #e60012;
    color: white;
    padding: 12px 25px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.download-button:hover {
    background-color: #c5000f;
    color: white;
}

.attachment-image-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.nav-previous,
.nav-next,
.nav-gallery {
    flex: 1;
}

.nav-gallery {
    text-align: center;
}

.nav-next {
    text-align: right;
}

.attachment-image-navigation a {
    color: #e60012;
    text-decoration: none;
    font-weight: 600;
}

.attachment-image-navigation a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .attachment-image-content {
        flex-direction: column;
    }
    
    .attachment-image-sidebar {
        width: 100%;
    }
    .attachment-image-container {
        width: 90vw;
        margin-left: calc((100% - 90vw) / 2) !important;
    }
}

@media (max-width: 480px) {
    .attachment-image-container {
        width: 95vw;
        margin-left: calc((100% - 95vw) / 2) !important;
    }
}

/* 添加图片加载动画 */
@keyframes imageLoading {
    0% { opacity: 0.6; }
    50% { opacity: 0.8; }
    100% { opacity: 0.6; }
}

.gallery-image:not([src]) {
    animation: imageLoading 1.5s infinite;
    background-color: #efefef;
}

/* 添加测试样式 */
.test-mode .gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.test-mode .gallery-item {
    width: 300px;
    margin-bottom: 20px;
}

.test-mode .gallery-image-container {
    height: 200px;
    padding-bottom: 0;
}

.test-mode .gallery-image {
    position: static;
    width: 100%;
    height: 100%;
}

/* 确保头像正确显示 */
.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 15px;
}

.author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 如果头像仍然不显示，添加默认背景色 */
.author-avatar-img {
    background-color: #f0f0f0;
}

/* 确保描述区域正确显示 */
.attachment-image-description {
    margin: 20px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.attachment-image-description h3 {
    margin-top: 0;
    font-size: 18px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.description-content {
    font-size: 15px;
    line-height: 1.6;
    color: #444;
}

.description-content p {
    margin-bottom: 15px;
}

.description-content p:last-child {
    margin-bottom: 0;
}

/* 确保在Elementor中正确显示 */
.elementor .gallery-grid {
    width: 100% !important;
    margin: 0 auto !important;
}

.elementor .gallery-item {
    opacity: 1 !important;
    visibility: visible !important;
}

/* 防止Elementor隐藏我们的项目 */
.elementor-element .gallery-item {
    display: block !important;
}

/* 简化的交互效果样式 */

/* 1. 简单的图片悬停效果 */
.gallery-item {
    transition: transform 0.3s ease;
}

.gallery-item.hover {
    transform: translateY(-5px);
}

.gallery-image-container {
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.gallery-item.hover .gallery-image-container {
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.gallery-image {
    transition: transform 0.5s ease;
    width: 100%;
    height: auto;
    display: block;
}

.gallery-item.hover .gallery-image {
    transform: scale(1.05);
}

/* 2. 简单的模态框样式 */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.gallery-modal.show {
    opacity: 1;
}

.gallery-modal-img {
    max-width: 90%;
    max-height: 80vh;
    border-radius: 4px;
}

.gallery-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

.gallery-modal-title {
    color: white;
    margin-top: 15px;
    font-size: 16px;
}

/* 3. 简单的筛选按钮样式 */
.filter-btn {
    background-color: #f5f5f5;
    border: none;
    padding: 8px 16px;
    margin: 0 5px 10px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background-color: #e0e0e0;
}

.filter-btn.active {
    background-color: #e60012;
    color: white;
}

/* 确保链接覆盖整个画廊项目 */
.gallery-item-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

/* 确保悬停效果在链接上也能正常工作 */
.gallery-item-link:hover .gallery-image-container {
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.gallery-item-link:hover .gallery-image {
    transform: scale(1.05);
}

/* 隐藏详情页面上的导航按钮 */
.attachment-navigation,
.nav-links,
.navigation,
.post-navigation,
.image-navigation,
.attachment-previous,
.attachment-next,
.prev-image,
.next-image {
    display: none !important;
}

/* 只显示我们自定义的返回按钮 */
.attachment-image-navigation .back-to-gallery {
    display: inline-block !important;
}

/* 标签筛选按钮 */
.filter-btn[data-filter^=".tag-"] {
    background-color: #f8e5e7;
}

.filter-btn[data-filter^=".tag-"]:hover {
    background-color: #f5ccd0;
}

.filter-btn[data-filter^=".tag-"].active {
    background-color: #e60012;
    color: white;
}

/* 修改搜索框位置，使其与画廊左边第一个元素对齐 */
.gallery-search-container {
    margin-bottom: 20px;
    text-align: left; /* 改为左对齐 */
    position: relative;
    max-width: 400px;
    margin-left: 5px; /* 与画廊项目的左padding相同 */
    margin-right: auto;
}

.gallery-search-input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 1px solid #ddd;
    border-radius: 30px;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.gallery-search-input:focus {
    border-color: #e60012;
    box-shadow: 0 2px 10px rgba(230,0,18,0.1);
    outline: none;
}

.gallery-search-button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background-color:#575757;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.gallery-search-button:hover {
    background: #c5000f;
}

.gallery-search-button .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
    vertical-align: middle;
}

/* 确保显示/隐藏状态正确应用 */
.gallery-item {
    display: block !important; /* 默认显示 */
}

.gallery-item.hidden-by-search {
    display: none !important; /* 由搜索隐藏 */
}

/* 修改浏览量样式，使其只在悬停时显示 */
.gallery-item-views {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    z-index: 5;
    opacity: 0; /* 默认隐藏 */
    transition: opacity 0.3s ease; /* 添加过渡效果 */
}

/* 悬停时显示浏览量 */
.gallery-item:hover .gallery-item-views,
.gallery-item.hover .gallery-item-views {
    opacity: 1;
}

/* 只在画廊界面隐藏标签，不影响详细页面 */
.gallery-grid .gallery-item-tags,
.gallery-grid .gallery-tag {
    display: none !important;
}

/* 确保详细页面的标签正常显示 */
.attachment-image-container .attachment-tags {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 详情页面浏览量样式 */
.image-views {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
}

.image-views .dashicons {
    margin-right: 5px;
    color: #e60012;
}

/* 用户卡片样式 */
.attachment-user-card {
    display: flex;
    align-items: center;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.user-avatar-container {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 15px;
}

.user-avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    flex-grow: 1;
}

.user-name {
    font-weight: bold;
    font-size: 16px;
    color: #333;
}

.user-role {
    font-size: 14px;
    color: #666;
}

/* 图片信息样式 */
.attachment-details {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.attachment-details h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
}

.detail-item {
    display: flex;
    margin-bottom: 8px;
}

.detail-label {
    width: 80px;
    color: #666;
}

.detail-value {
    flex-grow: 1;
    color: #333;
}

/* 下载按钮样式 */
.attachment-download {
    margin-top: 20px;
}

.download-button {
    display: block;
    width: 100%;
    background-color: #4e56f3;
    color: white;
    text-align: center;
    padding: 12px 0;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s;
}

.download-button:hover {
    background-color: #3a41d0;
    color: white;
}

/* 详情页面标签样式 */
.attachment-tags {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.attachment-tags h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-item {
    background-color: #e6f2ff;
    color: #0066cc;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
}

/* 确保标签容器不影响布局 */
.gallery-tags {
    position: absolute;
    left: -9999px;
    top: -9999px;
    visibility: hidden;
    height: 0;
    overflow: hidden;
}

/* 确保搜索框在移动设备上也正确对齐 */
@media (max-width: 768px) {
    .gallery-search-container {
        margin-left: 5px;
    }
}

@media (max-width: 480px) {
    .gallery-search-container {
        margin-left: 5px;
        max-width: 95%;
    }
}

/* 登录提示样式 */
.gallery-login-required {
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin: 30px auto;
    max-width: 500px;
}

.gallery-login-required p {
    font-size: 16px;
    color: #333;
    margin: 0;
}

.gallery-login-required a {
    color: #e60012;
    text-decoration: none;
    font-weight: bold;
}

.gallery-login-required a:hover {
    text-decoration: underline;
}