/* 图片查看器样式 */

/* 模态框样式 */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden;
}

.image-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.image-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    cursor: grab;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    opacity: 0;
    transition: opacity 0.3s ease;
    visibility: hidden;
    transform-origin: center center;
    user-select: none;
    -webkit-user-drag: none;
}

.image-modal img.dragging {
    cursor: grabbing;
}

.image-modal.active img {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
}

/* 可点击图片的样式 */
.zoomable-image {
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}


/* 右上角工具栏容器 */
.top-toolbar {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 0 0 0 6px;
    padding: 8px;
    gap: 0;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-modal.active .top-toolbar {
    opacity: 1;
}

/* 工具栏按钮统一样式 */
.top-toolbar-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    border: none;
    background: none;
    border-radius: 4px;
}

.top-toolbar-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.top-toolbar-btn:active {
    transform: scale(0.95);
}

/* 关闭按钮特殊样式 */
.modal-close-new {
    font-size: 20px;
    margin-left: 4px;
}

/* 工具栏分隔线 */
.top-toolbar-divider {
    width: 1px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.3);
    margin: 0 4px;
}

/* 移除原有的关闭按钮样式 */
.modal-close {
    display: none;
}

/* 缩放提示 */
.zoom-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.zoom-hint.show {
    opacity: 1;
}

/* 导航箭头 */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(80, 80, 80, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10002;
    transition: all 0.3s ease;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.nav-arrow:before {
    content: '';
    width: 0;
    height: 0;
    border: none;
}

.nav-arrow.prev:before {
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 10px solid white;
    margin-right: 3px;
}

.nav-arrow.next:before {
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 10px solid white;
    margin-left: 3px;
}

.nav-arrow:hover {
    background-color: rgba(100, 100, 100, 0.9);
    transform: translateY(-50%) scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.nav-arrow.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
    background-color: rgba(60, 60, 60, 0.5);
}

.nav-arrow.disabled.prev:before {
    border-right-color: rgba(255, 255, 255, 0.5);
}

.nav-arrow.disabled.next:before {
    border-left-color: rgba(255, 255, 255, 0.5);
}

.nav-arrow.prev {
    left: 30px;
}

.nav-arrow.next {
    right: 30px;
}

/* 图片计数器 */
.image-counter {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-modal.active .image-counter {
    opacity: 1;
}

/* 让所有图片居中显示 */
.md-content img {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 100% !important;
    height: auto !important;
}

/* 如果图片在段落中，也要居中 */
.md-content p img {
    display: block !important;
    margin: 10px auto !important;
}

/* 如果图片有父容器，确保父容器也居中 */
.md-content figure {
    text-align: center !important;
    margin: 20px auto !important;
}

.md-content figure img {
    margin: 0 auto !important;
}

/* ==========================================================================
   图片查看器优化：手机/平板端隐藏左右切换箭头
   防止遮挡图片，避免误触
   ========================================================================== */
@media screen and (max-width: 1220px) {
    /* 直接隐藏左右箭头 */
    .nav-arrow {
        display: none !important;
    }
}
