.modal-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    z-index: 1200;
}

.modal-nav-btn {
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: 15px;
    margin: 0;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-nav-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-nav-btn.prev-btn {
    margin-left: 20px;
}

.modal-nav-btn.next-btn {
    margin-right: 20px;
}

.modal-counter {
    position: absolute;
    bottom: -40px;
    left: 0;
    right: 0;
    color: var(--light-text);
    text-align: center;
    font-size: 1rem;
}

.modal-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--light-text);
    font-size: 1.5rem;
}

/* 改進的模態框樣式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1100;
    overflow: hidden;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-image {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: var(--light-text);
    font-size: 2rem;
    cursor: pointer;
    z-index: 1300;
    background-color: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* 觸摸設備優化 */
@media (max-width: 768px) {
    .modal-nav-btn {
        font-size: 1.5rem;
        padding: 10px;
        width: 40px;
        height: 40px;
    }
    
    .modal-nav-btn.prev-btn {
        margin-left: 10px;
    }
    
    .modal-nav-btn.next-btn {
        margin-right: 10px;
    }
    
    .modal-close {
        top: 10px;
        right: 10px;
    }
    
    .modal-title {
        bottom: 10px;
    }
}
